@defra/interactive-map 0.0.59-alpha → 0.0.61-alpha

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.
Files changed (125) hide show
  1. package/assets/templates/add-polygons.njk +2 -2
  2. package/assets/templates/add-symbols.njk +2 -2
  3. package/dist/css/index.css +1 -1
  4. package/dist/esm/im-core.js +1 -1
  5. package/dist/esm/im-shell.js +1 -1
  6. package/dist/umd/im-core.js +1 -1
  7. package/dist/umd/index.js +1 -1
  8. package/docs/api/button-definition.md +11 -0
  9. package/docs/api/context.md +2 -0
  10. package/docs/api/panel-definition.md +30 -0
  11. package/docs/api/symbol-config.md +12 -0
  12. package/docs/api.md +21 -2
  13. package/docs/assets/images/slot-map.svg +3 -3
  14. package/docs/plugins/datasets.md +11 -1
  15. package/docs/plugins/draw.md +26 -0
  16. package/package.json +1 -1
  17. package/plugins/datasets/dist/esm/index.js +1 -1
  18. package/plugins/datasets/dist/esm/layerAdapter.js +1 -1
  19. package/plugins/datasets/dist/umd/im-datasets-ml-adapter.js +1 -1
  20. package/plugins/datasets/dist/umd/im-datasets-ol-adapter.js +1 -1
  21. package/plugins/datasets/dist/umd/im-datasets-plugin.js +1 -1
  22. package/plugins/datasets/dist/umd/index.js +1 -1
  23. package/plugins/datasets/src/index.js +0 -1
  24. package/plugins/datasets/src/index.test.js +2 -8
  25. package/plugins/datasets/src/registry/dataset.test.js +9 -0
  26. package/plugins/draw/dist/esm/im-draw-ml-adapter.js +1 -1
  27. package/plugins/draw/dist/esm/im-draw-ol-adapter.js +1 -1
  28. package/plugins/draw/dist/esm/im-draw-plugin.js +1 -1
  29. package/plugins/draw/dist/umd/im-draw-ml-adapter.js +1 -1
  30. package/plugins/draw/dist/umd/im-draw-ol-adapter.js +1 -1
  31. package/plugins/draw/dist/umd/im-draw-plugin.js +1 -1
  32. package/plugins/draw/dist/umd/index.js +1 -1
  33. package/plugins/draw/src/DrawInit.jsx +3 -0
  34. package/plugins/draw/src/DrawInit.test.jsx +16 -0
  35. package/plugins/draw/src/adapters/maplibre/MaplibreDrawAdapter.js +19 -3
  36. package/plugins/draw/src/adapters/maplibre/MaplibreDrawAdapter.test.js +27 -0
  37. package/plugins/draw/src/adapters/openlayers/OLDrawAdapter.js +10 -2
  38. package/plugins/draw/src/adapters/openlayers/OLDrawAdapter.test.js +14 -0
  39. package/plugins/draw/src/defaults.js +4 -0
  40. package/plugins/draw/src/hooks/useSnapMinZoom.js +29 -0
  41. package/plugins/draw/src/hooks/useSnapMinZoom.test.js +82 -0
  42. package/plugins/draw/src/manifest.js +4 -1
  43. package/plugins/draw/src/manifest.test.js +15 -2
  44. package/plugins/draw/src/utils/snapMinZoom.js +8 -0
  45. package/plugins/draw/src/utils/snapMinZoom.test.js +22 -0
  46. package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
  47. package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
  48. package/plugins/map-key/dist/esm/im-map-key-plugin.js +1 -1
  49. package/plugins/map-key/dist/umd/im-map-key-plugin.js +1 -1
  50. package/plugins/map-key/src/manifest.js +1 -1
  51. package/plugins/search/dist/css/index.css +1 -1
  52. package/plugins/search/src/components/Form/Form.module.scss +1 -0
  53. package/providers/esri/dist/esm/im-esri-provider.js +1 -1
  54. package/providers/esri/src/esriProvider.js +10 -21
  55. package/providers/esri/src/utils/coords.js +37 -7
  56. package/providers/esri/src/utils/coords.test.js +22 -1
  57. package/providers/esri/src/utils/spatial.js +1 -47
  58. package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
  59. package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
  60. package/providers/maplibre/src/maplibreProvider.js +5 -14
  61. package/providers/maplibre/src/maplibreProvider.test.js +143 -146
  62. package/providers/maplibre/src/utils/spatial.js +0 -40
  63. package/providers/maplibre/src/utils/spatial.test.js +0 -35
  64. package/providers/openlayers/dist/esm/im-openlayers-provider.js +1 -1
  65. package/providers/openlayers/dist/umd/im-openlayers-provider.js +1 -1
  66. package/providers/openlayers/src/openlayersProvider.js +5 -14
  67. package/providers/openlayers/src/openlayersProvider.test.js +12 -10
  68. package/providers/openlayers/src/utils/spatial.js +0 -39
  69. package/providers/openlayers/src/utils/spatial.test.js +1 -26
  70. package/src/App/components/Hints/Hints.jsx +9 -21
  71. package/src/App/components/Hints/Hints.test.jsx +20 -33
  72. package/src/App/components/MapButton/MapButton.jsx +20 -2
  73. package/src/App/components/MapButton/MapButton.module.scss +15 -1
  74. package/src/App/components/MapButton/MapButton.test.jsx +21 -3
  75. package/src/App/components/Panel/Panel.jsx +16 -1
  76. package/src/App/components/Panel/Panel.test.jsx +44 -0
  77. package/src/App/components/Tooltip/Tooltip.jsx +29 -11
  78. package/src/App/components/Tooltip/Tooltip.test.jsx +45 -3
  79. package/src/App/components/Viewport/MapController.jsx +2 -0
  80. package/src/App/components/Viewport/MapController.test.jsx +3 -0
  81. package/src/App/hooks/useCrossHairAPI.js +27 -28
  82. package/src/App/hooks/useCrossHairAPI.test.js +64 -7
  83. package/src/App/hooks/useLayoutMeasurements.js +175 -131
  84. package/src/App/hooks/useLayoutMeasurements.test.js +227 -122
  85. package/src/App/hooks/useMapProviderOverrides.js +114 -35
  86. package/src/App/hooks/useMapProviderOverrides.test.js +188 -5
  87. package/src/App/hooks/useModalPanelBehaviour.js +18 -32
  88. package/src/App/hooks/useModalPanelBehaviour.test.js +45 -33
  89. package/src/App/hooks/useUserMoveTracking.js +65 -0
  90. package/src/App/hooks/useUserMoveTracking.test.js +99 -0
  91. package/src/App/hooks/useVisibleGeometry.js +35 -45
  92. package/src/App/hooks/useVisibleGeometry.test.js +149 -121
  93. package/src/App/layout/Layout.jsx +4 -4
  94. package/src/App/layout/layout.module.scss +124 -61
  95. package/src/App/renderer/mapButtons.js +1 -0
  96. package/src/App/renderer/mapButtons.test.js +8 -0
  97. package/src/App/store/AppProvider.jsx +3 -0
  98. package/src/App/store/appDispatchMiddleware.js +18 -10
  99. package/src/App/store/appDispatchMiddleware.test.js +42 -4
  100. package/src/App/store/mapActionsMap.js +2 -1
  101. package/src/App/store/mapActionsMap.test.js +6 -0
  102. package/src/App/store/mapReducer.js +2 -0
  103. package/src/App/store/mapReducer.test.js +1 -0
  104. package/src/InteractiveMap/InteractiveMap.js +3 -2
  105. package/src/InteractiveMap/InteractiveMap.test.js +2 -2
  106. package/src/config/events.js +1 -1
  107. package/src/config/mapPanelSlots.js +8 -0
  108. package/src/config/symbolConfig.js +1 -1
  109. package/src/scss/settings/_colors.scss +4 -0
  110. package/src/services/symbolRegistry.js +1 -1
  111. package/src/services/symbolRegistry.test.js +19 -0
  112. package/src/types.js +33 -8
  113. package/src/utils/getFitMove.js +73 -0
  114. package/src/utils/getFitMove.test.js +114 -0
  115. package/src/utils/getSafeZoneInset.js +122 -77
  116. package/src/utils/getSafeZoneInset.test.js +241 -54
  117. package/src/utils/getValueForStyle.js +10 -5
  118. package/src/utils/getValueForStyle.test.js +13 -2
  119. package/src/utils/renderedBoxes.js +25 -0
  120. package/src/utils/renderedBoxes.test.js +61 -0
  121. package/src/utils/screenBox.js +70 -0
  122. package/src/utils/screenBox.test.js +69 -0
  123. package/src/utils/symbolUtils.js +9 -9
  124. package/src/utils/symbolUtils.test.js +21 -0
  125. package/providers/esri/src/utils/spatial.test.js +0 -58
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see im-datasets-ol-adapter.js.LICENSE.txt */
2
- "use strict";(Object("undefined"!=typeof self?self:this).webpackChunkdefra_DefraMap=Object("undefined"!=typeof self?self:this).webpackChunkdefra_DefraMap||[]).push([[809],{913:function(t,e,i){function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function r(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,s(n.key),n)}}function s(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function a(){var t,e,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",r=i.toStringTag||"@@toStringTag";function s(i,n,r,s){var a=n&&n.prototype instanceof h?n:h,c=Object.create(a.prototype);return l(c,"_invoke",function(i,n,r){var s,a,l,h=0,c=r||[],u=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return s=e,a=0,l=t,d.n=i,o}};function f(i,n){for(a=i,l=n,e=0;!u&&h&&!r&&e<c.length;e++){var r,s=c[e],f=d.p,g=s[2];i>3?(r=g===n)&&(l=s[(a=s[4])?5:(a=3,3)],s[4]=s[5]=t):s[0]<=f&&((r=i<2&&f<s[1])?(a=0,d.v=n,d.n=s[1]):f<g&&(r=i<3||s[0]>n||n>g)&&(s[4]=i,s[5]=n,d.n=g,a=0))}if(r||i>1)return o;throw u=!0,n}return function(r,c,g){if(h>1)throw TypeError("Generator is already running");for(u&&1===c&&f(c,g),a=c,l=g;(e=a<2?t:l)||!u;){s||(a?a<3?(a>1&&(d.n=-1),f(a,l)):d.n=l:d.v=l);try{if(h=2,s){if(a||(r="next"),e=s[r]){if(!(e=e.call(s,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,a<2&&(a=0)}else 1===a&&(e=s.return)&&e.call(s),a<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),a=1);s=t}else if((e=(u=d.n<0)?l:i.call(n,d))!==o)break}catch(e){s=t,a=1,l=e}finally{h=1}}return{value:e,done:u}}}(i,r,s),!0),c}var o={};function h(){}function c(){}function u(){}e=Object.getPrototypeOf;var d=[][n]?e(e([][n]())):(l(e={},n,function(){return this}),e),f=u.prototype=h.prototype=Object.create(d);function g(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,l(t,r,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=u,l(f,"constructor",u),l(u,"constructor",c),c.displayName="GeneratorFunction",l(u,r,"GeneratorFunction"),l(f),l(f,r,"Generator"),l(f,n,function(){return this}),l(f,"toString",function(){return"[object Generator]"}),(a=function(){return{w:s,m:g}})()}function l(t,e,i,n){var r=Object.defineProperty;try{r({},"",{})}catch(t){r=0}l=function(t,e,i,n){function s(e,i){l(t,e,function(t){return this._invoke(e,i,t)})}e?r?r(t,e,{value:i,enumerable:!n,configurable:!n,writable:!n}):t[e]=i:(s("next",0),s("throw",1),s("return",2))},l(t,e,i,n)}function h(t,e,i,n,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,r)}function c(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,u(n.key),n)}}function u(t){var e=function(t){if("object"!=o(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=o(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==o(e)?e:e+""}function d(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(d=function(){return!!t})()}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function g(t,e){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},g(t,e)}i.d(e,{h:function(){return p}});var p=function(t){function e(t,i,n,r){var s;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(s=function(t,e,i){return e=f(e),function(t,e){if(e&&("object"==o(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,d()?Reflect.construct(e,i||[],f(t).constructor):e.apply(t,i))}(this,e))._mapProvider=t,s._map=t.map,s._symbolRegistry=i,s._patternRegistry=n,s._datasetRegistry=r,s}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&g(t,e)}(e,t),i=e,n=[{key:"_pixelRatio",get:function(){return this._map.getPixelRatio()}},{key:"addDataset",value:(r=a().m(function t(e){var i;return a().w(function(t){for(;;)switch(t.n){case 0:if(i=this._datasetRegistry.getDataset(e)){t.n=1;break}return t.a(2);case 1:return t.n=2,this._registerPatternsAndSymbols(i);case 2:this._addLayers(i);case 3:return t.a(2)}},t,this)}),s=function(){var t=this,e=arguments;return new Promise(function(i,n){var s=r.apply(t,e);function o(t){h(s,i,n,o,a,"next",t)}function a(t){h(s,i,n,o,a,"throw",t)}o(void 0)})},function(t){return s.apply(this,arguments)})},{key:"applyDatasetOpacity",value:function(t){var e=this._datasetRegistry.getDataset(t);e&&this._applyRegistryDatasetOpacity(e)}},{key:"_applyRegistryDatasetOpacity",value:function(t){var e=this;t.getLayersWithOpacity().forEach(function(t){var i=t.layerIds,n=t.opacity;i.forEach(function(t){return e._setLayerOpacity(t,n)})})}},{key:"applyGlobalOpacity",value:function(){var t=this;this._datasetRegistry.forEachDataset(function(e){return t._applyRegistryDatasetOpacity(e)})}},{key:"applyDatasetVisibility",value:function(t){var e=this._datasetRegistry.getDataset(t);e&&this._applyRegistryDatasetVisibility(e)}},{key:"_applyRegistryDatasetVisibility",value:function(t){var e=this;t.getLayersWithVisibility().forEach(function(t){var i=t.layerIds,n=t.visibility;i.forEach(function(t){return e._setLayerVisibility(t,n)})})}},{key:"applyGlobalVisibility",value:function(){var t=this;this._datasetRegistry.forEachDataset(function(e){return t._applyRegistryDatasetVisibility(e)})}}],n&&c(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,n,r,s}(function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},(e=[{key:"attachDynamicSources",value:function(t){this._dynamicSources=t}},{key:"dynamicSources",get:function(){return this._dynamicSources}}])&&r(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}())},382:function(t,e,i){i.r(e),i.d(e,{default:function(){return zc}});var n=i(416),r=i(247);function s(t){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s(t)}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function a(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,l(n.key),n)}}function l(t){var e=function(t){if("object"!=s(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=s(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==s(e)?e:e+""}function h(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(h=function(){return!!t})()}function c(){return c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,i){var n=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=u(t)););return t}(t,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?t:i):r.value}},c.apply(null,arguments)}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}function d(t,e){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},d(t,e)}var f=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,i){return e=u(e),function(t,e){if(e&&("object"==s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,h()?Reflect.construct(e,i||[],u(t).constructor):e.apply(t,i))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e)}(e,t),i=e,n=[{key:"leafLayerIds",get:function(){return this.hasSublayers?[]:this.hasFill||this.hasStroke||this.hasSymbol?[this.id]:[]}},{key:"source",get:function(){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}},{key:"idStrategy",get:function(){return this.hasDynamicGeoJSON?this.dynamicGeoJSON.idProperty||null:this.idProperty||null}},{key:"filter",get:function(){var t,i,n=(t=e,i=this,c(u(1&1?t.prototype:t),"filter",i));if(!this.sourceLayer)return n;var r=["==",["get","layer"],this.sourceLayer];return n?"all"===n[0]?[].concat(function(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?o(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(n),[r]):["all",n,r]:r}},{key:"_wrapWithFilter",value:function(t){return this.filter?[{filter:this.filter,style:t}]:t}},{key:"getSymbolMeta",value:function(t){var e=t.pixelRatio,i=t.symbolRegistry;if(!this.hasSymbol)return null;var n=i.getSymbolImageId(this.style,this._datasetRegistry.mapStyle,"normal",e);return n?{imageId:n,anchor:i.getSymbolDef(this.style).anchor,pixelRatio:e}:null}},{key:"_symbolStyle",value:function(t){var e={},i=this.getSymbolMeta(t),n=i&&t.getSymbolDataUri(i.imageId);return n&&(e["icon-src"]=n,e["icon-anchor"]=i.anchor,e["icon-scale"]=1/t.pixelRatio),this._wrapWithFilter(e)}},{key:"getFlatStyle",value:function(t){var e;if(this.hasSymbol)return this._symbolStyle(t);var i=null===(e=this._datasetRegistry.mapStyle)||void 0===e?void 0:e.id,n={};return this.hasFill&&!this.hasPattern&&(n["fill-color"]=(0,r.o)(this.style.fill,i)),this.hasStroke&&(n["stroke-color"]=(0,r.o)(this.style.stroke,i),n["stroke-width"]=this.style.strokeWidth,this.style.strokeDashArray&&(n["stroke-line-dash"]=this.style.strokeDashArray)),this._wrapWithFilter(n)}}],n&&a(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,n}(n.f),g=i(913),p="add",_="remove",m="propertychange";function y(t){for(const e in t)delete t[e]}function x(t){let e;for(e in t)return!1;return!e}function v(t,e,i,n,r){if(r){const r=i;i=function(s){return t.removeEventListener(e,i),r.call(n??this,s)}}else n&&n!==t&&(i=i.bind(n));const s={target:t,type:e,listener:i};return t.addEventListener(e,i),s}function S(t,e,i,n){return v(t,e,i,n,!0)}function w(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),y(t))}var C="change",b=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function R(t,e){return t>e?1:t<e?-1:0}function T(t,e){return t<e?1:t>e?-1:0}function E(t,e,i){if(t[0]<=e)return 0;const n=t.length;if(e<=t[n-1])return n-1;if("function"==typeof i){for(let r=1;r<n;++r){const n=t[r];if(n===e)return r;if(n<e)return i(e,t[r-1],n)>0?r-1:r}return n-1}if(i>0){for(let i=1;i<n;++i)if(t[i]<e)return i-1;return n-1}if(i<0){for(let i=1;i<n;++i)if(t[i]<=e)return i;return n-1}for(let i=1;i<n;++i){if(t[i]==e)return i;if(t[i]<e)return t[i-1]-e<e-t[i]?i-1:i}return n-1}function I(t,e,i){for(;e<i;){const n=t[e];t[e]=t[i],t[i]=n,++e,--i}}function M(t,e){const i=Array.isArray(e)?e:[e],n=i.length;for(let e=0;e<n;e++)t[t.length]=i[e]}function P(t,e){const i=t.length;if(i!==e.length)return!1;for(let n=0;n<i;n++)if(t[n]!==e[n])return!1;return!0}function F(){return!0}function O(){}function k(t){let e,i,n;return function(){const r=Array.prototype.slice.call(arguments);return i&&this===n&&P(r,i)||(n=this,i=r,e=t.apply(this,arguments)),e}}var A=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},L=class extends b{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_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e="string"==typeof t,i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const r=e?new A(t):t;r.target||(r.target=this.eventTarget_||this);const s=this.dispatching_||(this.dispatching_={}),o=this.pendingRemovals_||(this.pendingRemovals_={});let a;i in s||(s[i]=0,o[i]=0),++s[i];for(let t=0,e=n.length;t<e;++t)if(a="handleEvent"in n[t]?n[t].handleEvent(r):n[t].call(this,r),!1===a||r.propagationStopped){a=!1;break}if(0===--s[i]){let t=o[i];for(delete o[i];t--;)this.removeEventListener(i,O);delete s[i]}return a}disposeInternal(){this.listeners_&&y(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 n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=O,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}};class D extends L{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(C)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=v(this,t[r],e);return n}return v(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const n=t.length;i=new Array(n);for(let r=0;r<n;++r)i[r]=S(this,t[r],e)}else i=S(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)w(t[e]);else w(t)}(i);else if(Array.isArray(t))for(let i=0,n=t.length;i<n;++i)this.removeEventListener(t[i],e);else this.removeEventListener(t,e)}}D.prototype.on,D.prototype.once,D.prototype.un;var j=D;function G(){throw new Error("Unimplemented abstract method.")}let W=0;function X(t){return t.ol_uid||(t.ol_uid=String(++W))}class z extends A{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}var Y=class extends j{constructor(t){super(),this.on,this.once,this.un,X(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 z(i,t,e)),i=m,this.hasListener(i)&&this.dispatchEvent(new z(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const n=this.values_||(this.values_={});if(i)n[t]=e;else{const i=n[t];n[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],x(this.values_)&&(this.values_=null),e||this.notify(t,i)}}};const N="length";class B extends A{constructor(t,e,i){super(t),this.element=e,this.index=i}}var Z=class extends Y{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,n=e.length;i<n;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(N)}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 B(p,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,n=e.length;i<n;++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 B(_,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 B(_,i,t)),this.dispatchEvent(new B(p,e,t))}updateLength_(){this.set(N,this.array_.length)}assertUnique_(t,e){const i=this.array_;for(let n=0,r=i.length;n<r;++n)if(i[n]===t&&n!==e)throw new Error("Duplicate item added to a unique collection")}};function V(t,e){if(!t)throw new Error(e)}function U(t){const e=[1/0,1/0,-1/0,-1/0];for(let i=0,n=t.length;i<n;++i)ot(e,t[i]);return e}function K(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 $(t,e,i){let n,r;return n=e<t[0]?t[0]-e:t[2]<e?e-t[2]:0,r=i<t[1]?t[1]-i:t[3]<i?i-t[3]:0,n*n+r*r}function q(t,e){return J(t,e[0],e[1])}function H(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function J(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function Q(t,e){const i=t[0],n=t[1],r=t[2],s=t[3],o=e[0],a=e[1];let l=0;return o<i?l|=16:o>r&&(l|=4),a<n?l|=8:a>s&&(l|=2),0===l&&(l=1),l}function tt(t,e,i,n,r){return r?(r[0]=t,r[1]=e,r[2]=i,r[3]=n,r):[t,e,i,n]}function et(t){return tt(1/0,1/0,-1/0,-1/0,t)}function it(t,e){const i=t[0],n=t[1];return tt(i,n,i,n,e)}function nt(t,e,i,n,r){return at(et(r),t,e,i,n)}function rt(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function st(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 ot(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 at(t,e,i,n,r){for(;i<n;i+=r)lt(t,e[i],e[i+1]);return t}function lt(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 ht(t,e){let i;return i=e(ut(t)),i||(i=e(dt(t)),i||(i=e(vt(t)),i||(i=e(xt(t)),i||!1)))}function ct(t){let e=0;return Ct(t)||(e=St(t)*_t(t)),e}function ut(t){return[t[0],t[1]]}function dt(t){return[t[2],t[1]]}function ft(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function gt(t,e){let i;if("bottom-left"===e)i=ut(t);else if("bottom-right"===e)i=dt(t);else if("top-left"===e)i=xt(t);else{if("top-right"!==e)throw new Error("Invalid corner");i=vt(t)}return i}function pt(t,e,i,n){const r=e*n[0]/2,s=e*n[1]/2,o=Math.cos(i),a=Math.sin(i),l=r*o,h=r*a,c=s*o,u=s*a,d=t[0],f=t[1];return[d-l+u,f-h-c,d-l-u,f-h+c,d+l-u,f+h+c,d+l+u,f+h-c,d-l+u,f-h-c]}function _t(t){return t[3]-t[1]}function mt(t,e,i){const n=i||[1/0,1/0,-1/0,-1/0];return wt(t,e)?(t[0]>e[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]<e[2]?n[2]=t[2]:n[2]=e[2],t[3]<e[3]?n[3]=t[3]:n[3]=e[3]):et(n),n}function yt(t,e){if(!wt(t,e))return[t.slice()];if(H(e,t))return[];const[i,n,r,s]=t,o=Math.max(i,e[0]),a=Math.max(n,e[1]),l=Math.min(r,e[2]),h=Math.min(s,e[3]),c=[];return o>i&&c.push([i,n,o,s]),l<r&&c.push([l,n,r,s]),a>n&&c.push([o,n,l,a]),h<s&&c.push([o,h,l,s]),c}function xt(t){return[t[0],t[3]]}function vt(t){return[t[2],t[3]]}function St(t){return t[2]-t[0]}function wt(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Ct(t){return t[2]<t[0]||t[3]<t[1]}function bt(t,e){const i=e.getExtent(),n=ft(t);if(e.canWrapX()&&(n[0]<i[0]||n[0]>=i[2])){const e=St(i),r=Math.floor((n[0]-i[0])/e)*e;t[0]-=r,t[2]-=r}return t}function Rt(t,e,i){if(e.canWrapX()){const n=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[n[0],t[1],n[2],t[3]]];bt(t,e);const r=St(n);if(St(t)>r&&!i)return[[n[0],t[1],n[2],t[3]]];if(t[0]<n[0])return[[t[0]+r,t[1],n[2],t[3]],[n[0],t[1],t[2],t[3]]];if(t[2]>n[2])return[[t[0],t[1],n[2],t[3]],[n[0],t[1],t[2]-r,t[3]]]}return[t]}function Tt(t,e){let i=[t];for(let t=0,n=e.length;t<n&&i.length>0;++t){const n=[];for(let r=0,s=i.length;r<s;++r)n.push(...yt(i[r],e[t]));i=n}return i}function Et(t,e,i,n,r,s,o){const a=new XMLHttpRequest;a.open("GET","function"==typeof t?t(i,n,r):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 n;"text"==t||"json"==t?n=a.responseText:"xml"==t?n=a.responseXML||a.responseText:"arraybuffer"==t&&(n=a.response),n?s(e.readFeatures(n,{extent:i,featureProjection:r}),e.readProjection(n)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function It(t,e){return function(i,n,r,s,o){Et(t,e,i,n,r,(t,e)=>{this.addFeatures(t),void 0!==s&&s(t)},()=>{this.changed(),void 0!==o&&o()})}}const Mt=2;let Pt=1;function Ft(t,e,i){return Math.min(Math.max(t,e),i)}function Ot(t,e,i,n,r,s){const o=r-i,a=s-n;if(0!==o||0!==a){const l=((t-i)*o+(e-n)*a)/(o*o+a*a);l>1?(i=r,n=s):l>0&&(i+=o*l,n+=a*l)}return kt(t,e,i,n)}function kt(t,e,i,n){const r=i-t,s=n-e;return r*r+s*s}function At(t){return 180*t/Math.PI}function Lt(t){return t*Math.PI/180}function Dt(t,e){const i=t%e;return i*e<0?i+e:i}function jt(t,e,i){return t+i*(e-t)}function Gt(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function Wt(t,e){return Math.floor(Gt(t,e))}function Xt(t,e){return Math.ceil(Gt(t,e))}function zt(t,e,i){if(t>=e&&t<i)return t;const n=i-e;return((t-e)%n+n)%n+e}function Yt(t,e){let i=!0;for(let n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function Nt(t,e){if(e.canWrapX()){const i=St(e.getExtent()),n=function(t,e,i){const n=e.getExtent();let r=0;return e.canWrapX()&&(t[0]<n[0]||t[0]>n[2])&&(i=i||St(n),r=Math.floor((t[0]-n[0])/i)),r}(t,e,i);n&&(t[0]-=n*i)}return t}const Bt={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var Zt=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_||Bt[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 Vt=6378137,Ut=Math.PI*Vt,Kt=[-Ut,-Ut,Ut,Ut],$t=[-180,-85,180,85],qt=Vt*Math.log(Math.tan(Math.PI/2));class Ht extends Zt{constructor(t){super({code:t,units:"m",extent:Kt,global:!0,worldExtent:$t,getPointResolution:function(t,e){return t/Math.cosh(e[1]/Vt)}})}}const Jt=[new Ht("EPSG:3857"),new Ht("EPSG:102100"),new Ht("EPSG:102113"),new Ht("EPSG:900913"),new Ht("http://www.opengis.net/def/crs/EPSG/0/3857"),new Ht("http://www.opengis.net/gml/srs/epsg.xml#3857")];const Qt=[-180,-90,180,90],te=6378137*Math.PI/180;class ee extends Zt{constructor(t,e){super({code:t,units:"degrees",extent:Qt,axisOrientation:e,global:!0,metersPerUnit:te,worldExtent:Qt})}}const ie=[new ee("CRS:84"),new ee("EPSG:4326","neu"),new ee("urn:ogc:def:crs:OGC:1.3:CRS84"),new ee("urn:ogc:def:crs:OGC:2:84"),new ee("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new ee("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new ee("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let ne={},re={};function se(t,e,i){const n=t.getCode(),r=e.getCode();n in re||(re[n]={}),re[n][r]=i}function oe(t,e){return t in re&&e in re[t]?re[t][e]:null}const ae=.9996,le=.00669438,he=le*le,ce=he*le,ue=le/(1-le),de=Math.sqrt(1-le),fe=(1-de)/(1+de),ge=fe*fe,pe=ge*fe,_e=pe*fe,me=_e*fe,ye=.9983242984503243,xe=15*he/256+45*ce/1024,ve=35*ce/3072,Se=1.5*fe-27/32*pe+269/512*me,we=21/16*ge-55/32*_e,Ce=151/96*pe-417/128*me,be=1097/512*_e,Re=6378137;function Te(t,e,i){const n=t-5e5,r=(i.north?e:e-1e7)/ae/(Re*ye),s=r+Se*Math.sin(2*r)+we*Math.sin(4*r)+Ce*Math.sin(6*r)+be*Math.sin(8*r),o=Math.sin(s),a=o*o,l=Math.cos(s),h=o/l,c=h*h,u=c*c,d=1-le*a,f=Math.sqrt(1-le*a),g=ue*l**2,p=g*g,_=n/(Re/f*ae),m=_*_,y=m*_,x=y*_,v=x*_,S=s-h/((1-le)/d)*(m/2-x/24*(5+3*c+10*g-4*p-9*ue))+v*_/720*(61+90*c+298*g+45*u-252*ue-3*p);let w=(_-y/6*(1+2*c+g)+v/120*(5-2*g+28*c-3*p+8*ue+24*u))/l;return w=zt(w+Lt(Ie(i.number)),-Math.PI,Math.PI),[At(w),At(S)]}function Ee(t,e,i){t=zt(t,-180,180),e<-80?e=-80:e>84&&(e=84);const n=Lt(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,h=Lt(t),c=Lt(Ie(i.number)),u=Re/Math.sqrt(1-le*r**2),d=ue*s**2,f=s*zt(h-c,-Math.PI,Math.PI),g=f*f,p=g*f,_=p*f,m=_*f,y=m*f,x=Re*(ye*n-.002514607064228144*Math.sin(2*n)+xe*Math.sin(4*n)-ve*Math.sin(6*n)),v=ae*u*(f+p/6*(1-a+d)+m/120*(5-18*a+l+72*d-58*ue))+5e5;let S=ae*(x+u*o*(g/2+_/24*(5-a+9*d+4*d**2)+y/720*(61-58*a+l+600*d-330*ue)));return i.north||(S+=1e7),[v,S]}function Ie(t){return 6*(t-1)-180+3}const Me=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function Pe(t){let e=0;for(const i of Me){const n=t.match(i);if(n){e=parseInt(n[1]);break}}if(!e)return null;let i=0,n=!1;return e>32700&&e<32761?i=e-32700:e>32600&&e<32661&&(n=!0,i=e-32600),i?{number:i,north:n}:null}function Fe(t,e){return function(i,n,r,s){const o=i.length;r=r>1?r:2,s=s??r,n||(n=r>2?i.slice():new Array(o));for(let r=0;r<o;r+=s){const s=i[r],o=i[r+1],a=t(s,o,e);n[r]=a[0],n[r+1]=a[1]}return n}}function Oe(t,e,i){i=i||6371008.8;const n=Lt(t[1]),r=Lt(e[1]),s=(r-n)/2,o=Lt(e[0]-t[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(r);return 2*i*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}const ke=[function(t){const e=Pe(t.getCode());return e?{forward:Fe(Ee,e),inverse:Fe(Te,e)}:null}],Ae=[function(t){return Pe(t)?new Zt({code:t,units:"m"}):null}];let Le=!0;function De(t,e){if(void 0!==e)for(let i=0,n=t.length;i<n;++i)e[i]=t[i];else e=t.slice();return e}function je(t){!function(t,e){ne[t]=e}(t.getCode(),t),se(t,t,De)}function Ge(t){if("string"!=typeof t)return t;const e=ne[i=t]||ne[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null;var i;if(e)return e;for(const e of Ae){const i=e(t);if(i)return i}return null}function We(t,e,i,n){let r;const s=(t=Ge(t)).getPointResolutionFunc();if(s){if(r=s(e,i),n&&n!==t.getUnits()){const e=t.getMetersPerUnit();e&&(r=r*e/Bt[n])}}else{const s=t.getUnits();if("degrees"==s&&!n||"degrees"==n)r=e;else{const o=Ne(t,Ge("EPSG:4326"));if(o||"degrees"===s){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=o(t,t,2),r=(Oe(t.slice(0,2),t.slice(2,4))+Oe(t.slice(4,6),t.slice(6,8)))/2}else r=e*t.getMetersPerUnit();const a=n?Bt[n]:t.getMetersPerUnit();void 0!==a&&(r/=a)}}return r}function Xe(t){!function(t){t.forEach(je)}(t),t.forEach(function(e){t.forEach(function(t){e!==t&&se(e,t,De)})})}function ze(t,e){return t?"string"==typeof t?Ge(t):t:Ge(e)}function Ye(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();return(t.getCode()===e.getCode()||Ne(t,e)===De)&&i}function Ne(t,e){const i=t.getCode(),n=e.getCode();let r=oe(i,n);if(r)return r;let s=null,o=null;for(const i of ke)s||(s=i(t)),o||(o=i(e));if(!s&&!o)return null;const a="EPSG:4326";if(o)if(s)r=Be(s.inverse,o.forward);else{const t=oe(i,a);t&&(r=Be(t,o.forward))}else{const t=oe(a,n);t&&(r=Be(s.inverse,t))}return r&&(je(t),je(e),se(t,e,r)),r}function Be(t,e){return function(i,n,r,s){return n=t(i,n,r,s),e(n,n,r,s)}}function Ze(t,e){return Ne(Ge(t),Ge(e))}function Ve(t,e,i){const n=Ze(e,i);if(!n){const t=Ge(e).getCode(),n=Ge(i).getCode();throw new Error(`No transform available between ${t} and ${n}`)}return n(t,void 0,t.length)}function Ue(t,e,i,n){return function(t,e,i,n){if(Ct(t))return et(i);let r=[];if(n>1){const e=t[2]-t[0],i=t[3]-t[1];for(let s=0;s<n;++s)r.push(t[0]+e*s/n,t[1],t[2],t[1]+i*s/n,t[2]-e*s/n,t[3],t[0],t[3]-i*s/n)}else r=[t[0],t[1],t[2],t[1],t[2],t[3],t[0],t[3]];e(r,r,2);const s=[],o=[];for(let t=0,e=r.length;t<e;t+=2)s.push(r[t]),o.push(r[t+1]);return function(t,e,i){return tt(Math.min.apply(null,t),Math.min.apply(null,e),Math.max.apply(null,t),Math.max.apply(null,e),i)}(s,o,i)}(t,Ze(e,i),void 0,n)}let Ke=null;function $e(){return Ke}function qe(t,e){return t}function He(t,e){return Le&&!Yt(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(Le=!1,function(...t){Pt>Mt||console.warn(...t)}("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t}function Je(t,e){return t}function Qe(t,e){return t}function ti(t,e){return t}var ei,ii,ni;function ri(t,e){return[[-1/0,-1/0,1/0,1/0]]}function si(t,e,i,n){const r=[];let s=[1/0,1/0,-1/0,-1/0];for(let o=0,a=i.length;o<a;++o){const a=i[o];s=nt(t,e,a[0],n),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),e=a[a.length-1]}return r}function oi(t,e,i,n,r){return!ht(r,function(r){return!ai(t,e,i,n,r[0],r[1])})}function ai(t,e,i,n,r,s){let o=0,a=t[i-n],l=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];l<=s?n>s&&(i-a)*(s-l)-(r-a)*(n-l)>0&&o++:n<=s&&(i-a)*(s-l)-(r-a)*(n-l)<0&&o--,a=i,l=n}return 0!==o}function li(t,e,i,n,r,s){if(0===i.length)return!1;if(!ai(t,e,i[0],n,r,s))return!1;for(let e=1,o=i.length;e<o;++e)if(ai(t,i[e-1],i[e],n,r,s))return!1;return!0}function hi(t,e,i,n,r,s,o){let a,l,h,c,u,d,f;const g=r[s+1],p=[];for(let r=0,s=i.length;r<s;++r){const s=i[r];for(c=t[s-n],d=t[s-n+1],a=e;a<s;a+=n)u=t[a],f=t[a+1],(g<=d&&f<=g||d<=g&&g<=f)&&(h=(g-d)/(f-d)*(u-c)+c,p.push(h)),c=u,d=f}let _=NaN,m=-1/0;for(p.sort(R),c=p[0],a=1,l=p.length;a<l;++a){u=p[a];const r=Math.abs(u-c);r>m&&(h=(c+u)/2,li(t,e,i,n,h,g)&&(_=h,m=r)),c=u}return isNaN(_)&&(_=r[s]),o?(o.push(_,g,m),o):[_,g,m]}function ci(t,e,i,n,r){let s=[];for(let o=0,a=i.length;o<a;++o){const a=i[o];s=hi(t,e,a,n,r,2*o,s),e=a[a.length-1]}return s}function ui(t,e,i,n,r,s,o){let a,l;const h=(i-e)/n;if(1===h)a=e;else if(2===h)a=e,l=r;else if(0!==h){let s=t[e],o=t[e+1],h=0;const c=[0];for(let r=e+n;r<i;r+=n){const e=t[r],i=t[r+1];h+=Math.sqrt((e-s)*(e-s)+(i-o)*(i-o)),c.push(h),s=e,o=i}const u=r*h,d=function(t,e,i){let n,r;i=i||R;let s=0,o=t.length,a=!1;for(;s<o;)n=s+(o-s>>1),r=+i(t[n],e),r<0?s=n+1:(o=n,a=!r);return a?s:~s}(c,u);d<0?(l=(u-c[-d-2])/(c[-d-1]-c[-d-2]),a=e+(-d-2)*n):a=e+d*n}o=o>1?o:2,s=s||new Array(o);for(let e=0;e<o;++e)s[e]=void 0===a?NaN:void 0===l?t[a+e]:jt(t[a+e],t[a+n+e],l);return s}function di(t,e,i,n,r,s){if(i==e)return null;let o;if(r<t[e+n-1])return s?(o=t.slice(e,e+n),o[n-1]=r,o):null;if(t[i-1]<r)return s?(o=t.slice(i-n,i),o[n-1]=r,o):null;if(r==t[e+n-1])return t.slice(e,e+n);let a=e/n,l=i/n;for(;a<l;){const e=a+l>>1;r<t[(e+1)*n-1]?l=e:a=e+1}const h=t[a*n-1];if(r==h)return t.slice((a-1)*n,(a-1)*n+n);const c=(r-h)/(t[(a+1)*n-1]-h);o=[];for(let e=0;e<n-1;++e)o.push(jt(t[(a-1)*n+e],t[a*n+e],c));return o.push(r),o}function fi(t,e,i,n){for(;e<i-n;){for(let r=0;r<n;++r){const s=t[e+r];t[e+r]=t[i-n+r],t[i-n+r]=s}e+=n,i-=n}}function gi(t,e,i,n){let r=0,s=t[i-n],o=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];r+=(i-s)*(n+o),s=i,o=n}return 0===r?void 0:r>0}function pi(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=gi(t,e,o,n);if(0===s){if(r&&a||!r&&!a)return!1}else if(r&&!a||!r&&a)return!1;e=o}return!0}function _i(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];if(!pi(t,e,o,n,r))return!1;o.length&&(e=o[o.length-1])}return!0}function mi(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=gi(t,e,o,n);(0===s?r&&a||!r&&!a:r&&!a||!r&&a)&&fi(t,e,o,n),e=o}return e}function yi(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s)e=mi(t,e,i[s],n,r);return e}function xi(t,e){const i=[];let n,r=0,s=0;for(let o=0,a=e.length;o<a;++o){const a=e[o],l=gi(t,r,a,2);if(void 0===n&&(n=l),l===n)i.push(e.slice(s,o+1));else{if(0===i.length)continue;i[i.length-1].push(e[s])}s=o+1,r=a}return i}function vi(t,e,i,n,r,s,o){const a=(i-e)/n;if(a<3){for(;e<i;e+=n)s[o++]=t[e],s[o++]=t[e+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[e,i-n];let c=0;for(;h.length>0;){const i=h.pop(),s=h.pop();let o=0;const a=t[s],u=t[s+1],d=t[i],f=t[i+1];for(let e=s+n;e<i;e+=n){const i=Ot(t[e],t[e+1],a,u,d,f);i>o&&(c=e,o=i)}o>r&&(l[(c-e)/n]=1,s+n<c&&h.push(s,c),c+n<i&&h.push(c,i))}for(let i=0;i<a;++i)l[i]&&(s[o++]=t[e+i*n],s[o++]=t[e+i*n+1]);return o}function Si(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=vi(t,e,h,n,r,s,o),a.push(o),e=h}return o}function wi(t,e){return e*Math.round(t/e)}function Ci(t,e,i,n,r,s,o){if(e==i)return o;let a,l,h=wi(t[e],r),c=wi(t[e+1],r);e+=n,s[o++]=h,s[o++]=c;do{if(a=wi(t[e],r),l=wi(t[e+1],r),(e+=n)==i)return s[o++]=a,s[o++]=l,o}while(a==h&&l==c);for(;e<i;){const i=wi(t[e],r),u=wi(t[e+1],r);if(e+=n,i==a&&u==l)continue;const d=a-h,f=l-c,g=i-h,p=u-c;d*p==f*g&&(d<0&&g<d||d==g||d>0&&g>d)&&(f<0&&p<f||f==p||f>0&&p>f)?(a=i,l=u):(s[o++]=a,s[o++]=l,h=a,c=l,a=i,l=u)}return s[o++]=a,s[o++]=l,o}function bi(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=Ci(t,e,h,n,r,s,o),a.push(o),e=h}return o}function Ri(t,e,i,n,r,s,o){s=s||[],o=o||2;let a=0;for(let l=e;l<i;l+=n){const e=t[l],i=t[l+1];s[a++]=r[0]*e+r[2]*i+r[4],s[a++]=r[1]*e+r[3]*i+r[5];for(let e=2;e<o;e++)s[a++]=t[l+e]}return s&&s.length!=a&&(s.length=a),s}function Ti(t,e,i,n,r,s,o){o=o||[];const a=Math.cos(r),l=Math.sin(r),h=s[0],c=s[1];let u=0;for(let r=e;r<i;r+=n){const e=t[r]-h,i=t[r+1]-c;o[u++]=h+e*a-i*l,o[u++]=c+e*l+i*a;for(let e=r+2;e<r+n;++e)o[u++]=t[e]}return o&&o.length!=u&&(o.length=u),o}Xe(Jt),Xe(ie),ei=Jt,ii=function(t,e,i,n){const r=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(r));for(let i=0;i<r;i+=n){e[i]=Ut*t[i]/180;let n=Vt*Math.log(Math.tan(Math.PI*(+t[i+1]+90)/360));n>qt?n=qt:n<-qt&&(n=-qt),e[i+1]=n}return e},ni=function(t,e,i,n){const r=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(r));for(let i=0;i<r;i+=n)e[i]=180*t[i]/Ut,e[i+1]=360*Math.atan(Math.exp(t[i+1]/Vt))/Math.PI-90;return e},ie.forEach(function(t){ei.forEach(function(e){se(t,e,ii),se(e,t,ni)})});const Ei=[1,0,0,1,0,0],Ii=new Array(6);function Mi(){return Ei.slice(0)}function Pi(t){return Oi(t,1,0,0,1,0,0)}function Fi(t,e){const i=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=e[0],h=e[1],c=e[2],u=e[3],d=e[4],f=e[5];return t[0]=i*l+r*h,t[1]=n*l+s*h,t[2]=i*c+r*u,t[3]=n*c+s*u,t[4]=i*d+r*f+o,t[5]=n*d+s*f+a,t}function Oi(t,e,i,n,r,s,o){return t[0]=e,t[1]=i,t[2]=n,t[3]=r,t[4]=s,t[5]=o,t}function ki(t,e){const i=e[0],n=e[1];return e[0]=t[0]*i+t[2]*n+t[4],e[1]=t[1]*i+t[3]*n+t[5],e}function Ai(t,e,i){return Fi(t,Oi(Ii,e,0,0,i,0,0))}function Li(t,e,i,n,r,s,o,a){const l=Math.sin(s),h=Math.cos(s);return t[0]=n*h,t[1]=r*l,t[2]=-n*l,t[3]=r*h,t[4]=o*n*h-a*n*l+e,t[5]=o*r*l+a*r*h+i,t}const Di=[1e5,1e5,1e5,1e5,2,2];function ji(t){return t.substring(7,t.length-1).split(",").map(parseFloat)}const Gi=Mi();class Wi{constructor(t,e,i,n,r,s){this.styleFunction,this.extent_,this.id_=s,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=r,this.squaredTolerance_,this.stride_=n,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?it(this.flatCoordinates_):nt(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=ft(this.getExtent());this.flatInteriorPoints_=hi(this.flatCoordinates_,0,this.ends_,this.stride_,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=xi(this.flatCoordinates_,this.ends_),e=si(this.flatCoordinates_,0,t,this.stride_);this.flatInteriorPoints_=ci(this.flatCoordinates_,0,t,this.stride_,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=ui(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 n=0,r=i.length;n<r;++n){const r=i[n],s=ui(t,e,r,this.stride_,.5);M(this.flatMidpoints_,s),e=r}}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=Ge(t)).getExtent(),i=t.getWorldExtent();if(e&&i){const t=_t(i)/_t(e);Li(Gi,i[0],i[3],t,-t,0,0,0),Ri(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,Gi,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new Wi(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=k((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let n;switch(this.type_){case"LineString":i.length=vi(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),n=[i.length];break;case"MultiLineString":n=[],i.length=Si(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,n);break;case"Polygon":n=[],i.length=bi(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,n)}return n&&(this.simplifiedGeometry_=new Wi(this.type_,i,n,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}Wi.prototype.getFlatCoordinates=Wi.prototype.getOrientedFlatCoordinates;var Xi=Wi;function zi(t,e,i=0,n=t.length-1,r=Ni){for(;n>i;){if(n-i>600){const s=n-i+1,o=e-i+1,a=Math.log(s),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);zi(t,e,Math.max(i,Math.floor(e-o*l/s+h)),Math.min(n,Math.floor(e+(s-o)*l/s+h)),r)}const s=t[e];let o=i,a=n;for(Yi(t,i,e),r(t[n],s)>0&&Yi(t,i,n);o<a;){for(Yi(t,o,a),o++,a--;r(t[o],s)<0;)o++;for(;r(t[a],s)>0;)a--}0===r(t[i],s)?Yi(t,i,a):(a++,Yi(t,a,n)),a<=e&&(i=a+1),e<=a&&(n=a-1)}}function Yi(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function Ni(t,e){return t<e?-1:t>e?1:0}class Bi{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(!nn(t,e))return i;const n=this.toBBox,r=[];for(;e;){for(let s=0;s<e.children.length;s++){const o=e.children[s],a=e.leaf?n(o):o;nn(t,a)&&(e.leaf?i.push(o):en(t,a)?this._all(o,i):r.push(o))}e=r.pop()}return i}collides(t){let e=this.data;if(!nn(t,e))return!1;const i=[];for(;e;){for(let n=0;n<e.children.length;n++){const r=e.children[n],s=e.leaf?this.toBBox(r):r;if(nn(t,s)){if(e.leaf||en(t,s))return!0;i.push(r)}}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=rn([]),this}remove(t,e){if(!t)return this;let i=this.data;const n=this.toBBox(t),r=[],s=[];let o,a,l;for(;i||r.length;){if(i||(i=r.pop(),a=r[r.length-1],o=s.pop(),l=!0),i.leaf){const n=Zi(t,i.children,e);if(-1!==n)return i.children.splice(n,1),r.push(i),this._condense(r),this}l||i.leaf||!en(i,n)?a?(o++,i=a.children[o],l=!1):i=null:(r.push(i),s.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,n){const r=i-e+1;let s,o=this._maxEntries;if(r<=o)return s=rn(t.slice(e,i+1)),Vi(s,this.toBBox),s;n||(n=Math.ceil(Math.log(r)/Math.log(o)),o=Math.ceil(r/Math.pow(o,n-1))),s=rn([]),s.leaf=!1,s.height=n;const a=Math.ceil(r/o),l=a*Math.ceil(Math.sqrt(o));sn(t,e,i,l,this.compareMinX);for(let r=e;r<=i;r+=l){const e=Math.min(r+l-1,i);sn(t,r,e,a,this.compareMinY);for(let i=r;i<=e;i+=a){const r=Math.min(i+a-1,e);s.children.push(this._build(t,i,r,n-1))}}return Vi(s,this.toBBox),s}_chooseSubtree(t,e,i,n){for(;n.push(e),!e.leaf&&n.length-1!==i;){let i,n=1/0,r=1/0;for(let s=0;s<e.children.length;s++){const o=e.children[s],a=Hi(o),l=Qi(t,o)-a;l<r?(r=l,n=a<n?a:n,i=o):l===r&&a<n&&(n=a,i=o)}e=i||e.children[0]}return e}_insert(t,e,i){const n=i?t:this.toBBox(t),r=[],s=this._chooseSubtree(n,this.data,e,r);for(s.children.push(t),Ki(s,n);e>=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)}_split(t,e){const i=t[e],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);const s=this._chooseSplitIndex(i,r,n),o=rn(i.children.splice(s,i.children.length-s));o.height=i.height,o.leaf=i.leaf,Vi(i,this.toBBox),Vi(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=rn([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Vi(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let n,r=1/0,s=1/0;for(let o=e;o<=i-e;o++){const e=Ui(t,0,o,this.toBBox),a=Ui(t,o,i,this.toBBox),l=tn(e,a),h=Hi(e)+Hi(a);l<r?(r=l,n=o,s=h<s?h:s):l===r&&h<s&&(s=h,n=o)}return n||i-e}_chooseSplitAxis(t,e,i){const n=t.leaf?this.compareMinX:$i,r=t.leaf?this.compareMinY:qi;this._allDistMargin(t,e,i,n)<this._allDistMargin(t,e,i,r)&&t.children.sort(n)}_allDistMargin(t,e,i,n){t.children.sort(n);const r=this.toBBox,s=Ui(t,0,e,r),o=Ui(t,i-e,i,r);let a=Ji(s)+Ji(o);for(let n=e;n<i-e;n++){const e=t.children[n];Ki(s,t.leaf?r(e):e),a+=Ji(s)}for(let n=i-e-1;n>=e;n--){const e=t.children[n];Ki(o,t.leaf?r(e):e),a+=Ji(o)}return a}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)Ki(e[n],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():Vi(t[i],this.toBBox)}}function Zi(t,e,i){if(!i)return e.indexOf(t);for(let n=0;n<e.length;n++)if(i(t,e[n]))return n;return-1}function Vi(t,e){Ui(t,0,t.children.length,e,t)}function Ui(t,e,i,n,r){r||(r=rn(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=e;s<i;s++){const e=t.children[s];Ki(r,t.leaf?n(e):e)}return r}function Ki(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 $i(t,e){return t.minX-e.minX}function qi(t,e){return t.minY-e.minY}function Hi(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Ji(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Qi(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 tn(t,e){const i=Math.max(t.minX,e.minX),n=Math.max(t.minY,e.minY),r=Math.min(t.maxX,e.maxX),s=Math.min(t.maxY,e.maxY);return Math.max(0,r-i)*Math.max(0,s-n)}function en(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function nn(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function rn(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function sn(t,e,i,n,r){const s=[e,i];for(;s.length;){if((i=s.pop())-(e=s.pop())<=n)continue;const o=e+Math.ceil((i-e)/n/2)*n;zi(t,o,e,i,r),s.push(e,o,o,i)}}var on=class{constructor(t){this.rbush_=new Bi(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_[X(e)]=i}load(t,e){const i=new Array(e.length);for(let n=0,r=e.length;n<r;n++){const r=t[n],s=e[n],o={minX:r[0],minY:r[1],maxX:r[2],maxY:r[3],value:s};i[n]=o,this.items_[X(s)]=o}this.rbush_.load(i)}remove(t){const e=X(t),i=this.items_[e];return delete this.items_[e],null!==this.rbush_.remove(i)}update(t,e){const i=this.items_[X(e)];rt([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 n=0,r=t.length;n<r;n++)if(i=e(t[n]),i)return i;return i}isEmpty(){return x(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return tt(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]}};function an(t){return t?"function"==typeof t?t:(Array.isArray(t)||(t=[t]),e=>t):null}var ln=class extends Y{constructor(t){super(),this.projection=Ge(t.projection),this.attributions_=an(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 n=this.getState();"ready"===n?(this.un("change",i),t()):"error"===n&&(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_=an(t),this.changed()}setState(t){this.state_=t,this.changed()}},hn="addfeature",cn="removefeature";class un extends A{constructor(t,e,i){super(t),this.feature=e,this.features=i}}var dn=class extends ln{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_=O,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_&&(V(this.format_,"`format` must be set when `url` is set"),this.loader_=It(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:ri;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,n;this.featuresRtree_=e?new on:null,this.loadedExtentsRtree_=new on,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(t.features)?n=t.features:t.features&&(i=t.features,n=i.getArray()),e||void 0!==i||(i=new Z(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=X(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 un(hn,t))}setupChangeEvents_(t,e){e instanceof Xi||(this.featureChangeKeys_[t]=[v(e,C,this.handleFeatureChange_,this),v(e,m,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 Xi){const n=this.idIndex_[t];n instanceof Xi?Array.isArray(n)?n.push(e):this.idIndex_[t]=[n,e]:i=!1}else i=!1;else this.idIndex_[t]=e}return i&&(V(!(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=[],n=[];for(let e=0,n=t.length;e<n;e++){const n=t[e],r=X(n);this.addToIndex_(r,n)&&i.push(n)}for(let t=0,r=i.length;t<r;t++){const r=i[t],s=X(r);this.setupChangeEvents_(s,r);const o=r.getGeometry();if(o){const t=o.getExtent();e.push(t),n.push(r)}else this.nullGeometryFeatures_[s]=r}if(this.featuresRtree_&&this.featuresRtree_.load(e,n),this.hasListener(hn))for(let t=0,e=i.length;t<e;t++)this.dispatchEvent(new un(hn,i[t]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(hn,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(cn,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(p,t=>{e||(e=!0,this.addFeature(t.element),e=!1)}),t.addEventListener(_,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(w);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 un("clear");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 n=i.getGeometry();if(n instanceof Xi||n.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 n=i.getGeometry();if(n instanceof Xi||n.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(),x(this.nullGeometryFeatures_)||M(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=Rt(t,e);return[].concat(...i.map(t=>this.featuresRtree_.getInExtent(t)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let r=null;const s=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||F,this.featuresRtree_.forEachInExtent(a,function(t){if(e(t)){const e=t.getGeometry(),l=o;if(o=e instanceof Xi?0:e.closestPointXY(i,n,s,o),o<l){r=t;const e=Math.sqrt(o);a[0]=i-e,a[1]=n-e,a[2]=i+e,a[3]=n+e}}}),r}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=X(e),n=e.getGeometry();if(n){const t=n.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 r=e.getId();if(void 0!==r){const t=r.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 un("changefeature",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 X(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&x(this.nullGeometryFeatures_):!this.featuresCollection_||0===this.featuresCollection_.getLength()}loadFeatures(t,e,i){const n=this.loadedExtentsRtree_,r=this.strategy_(t,e,i);for(let t=0,s=r.length;t<s;++t){const s=r[t];if(!n.forEachInExtent(s,function(t){return H(t.extent,s)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new un("featuresloadstart"));const t=t=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new un("featuresloadend",void 0,t))},r=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new un("featuresloaderror"))};let o=!1;const a=this.loader_.call(this,s,e,i,e=>o||t(e),()=>o||r());a instanceof Promise?(o=!0,a.then(e=>{this.addFeatures(e),t(e)}).catch(r)):this.loader_.length<4&&(this.loading=!1),n.insert(s,{extent:s.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 n=yt(i.extent,t);for(const t of n)e.insert(t,{extent:t})})}removeFeatures(t){let e=!1;for(let i=0,n=t.length;i<n;++i)e=this.removeFeatureInternal(t[i])||e;e&&this.changed()}removeFeature(t){t&&this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=X(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(w),delete this.featureChangeKeys_[e];const n=t.getId();if(void 0!==n){const e=n.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(cn)&&this.dispatchEvent(new un(cn,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){V(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(It(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}};const fn="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",gn=(fn.includes("safari")&&!fn.includes("chrom")&&(fn.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(fn)),fn.includes("webkit")&&fn.includes("edge"),fn.includes("macintosh"),"undefined"!=typeof devicePixelRatio&&devicePixelRatio,"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope),pn="undefined"!=typeof Image&&Image.prototype.decode;function _n(t,e,i,n){let r;return r=i&&i.length?i.shift():gn?new class extends OffscreenCanvas{style={}}(t??300,e??150):document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e),r.getContext("2d",n)}let mn;function yn(){return mn||(mn=_n(1,1)),mn}function xn(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function vn(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 Sn="prerender",wn="postrender";const Cn=[NaN,NaN,NaN,0];let bn;const Rn=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Tn=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,En=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,In=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Mn(t,e){return t.endsWith("%")?Number(t.substring(0,t.length-1))/e:Number(t)}function Pn(t){throw new Error('failed to parse "'+t+'" as color')}function Fn(t){if(t.toLowerCase().startsWith("rgb")){const e=t.match(Tn)||t.match(Rn)||t.match(En);if(e){const t=e[4],i=100/255;return[Ft(Mn(e[1],i)+.5|0,0,255),Ft(Mn(e[2],i)+.5|0,0,255),Ft(Mn(e[3],i)+.5|0,0,255),void 0!==t?Ft(Mn(t,100),0,1):1]}Pn(t)}if(t.startsWith("#")){if(In.test(t)){const e=t.substring(1),i=e.length<=4?1:2,n=[0,0,0,255];for(let t=0,r=e.length;t<r;t+=i){let r=parseInt(e.substring(t,t+i),16);1===i&&(r+=r<<4),n[t/i]=r}return n[3]=n[3]/255,n}Pn(t)}const e=(bn||(bn=_n(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),bn);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&&Pn(t));const n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return Fn(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);const r=Array.from(e.getImageData(0,0,1,1).data);return r[3]=Gt(r[3]/255,3),r}const On={};let kn=0;function An(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function Ln(t){return t>.0031308?269.025*Math.pow(t,1/2.4)-14.025:3294.6*t}function Dn(t){return t>.2068965?Math.pow(t,3):108/841*(t-4/29)}function jn(t){return t>10.314724?Math.pow((t+14.025)/269.025,2.4):t/3294.6}function Gn(t){return t>.0088564?Math.pow(t,1/3):t/(108/841)+4/29}function Wn(t){const e=jn(t[0]),i=jn(t[1]),n=jn(t[2]),r=Gn(.222488403*e+.716873169*i+.06060791*n),s=500*(Gn(.452247074*e+.399439023*i+.148375274*n)-r),o=200*(r-Gn(.016863605*e+.117638439*i+.865350722*n)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,t[3]]}function Xn(t){if("none"===t)return Cn;if(On.hasOwnProperty(t))return On[t];if(kn>=1024){let t=0;for(const e in On)3&t++||(delete On[e],--kn)}const e=Fn(t);4!==e.length&&Pn(t);for(const i of e)isNaN(i)&&Pn(t);return On[t]=e,++kn,e}function zn(t){return Array.isArray(t)?t:Xn(t)}function Yn(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];return n!=(0|n)&&(n=n+.5|0),"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}function Nn(t,e){return t+":"+(e?zn(e):"null")}const Bn=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=Nn(t,e);return i in this.cache_?this.cache_[i]:null}getPattern(t,e){const i=Nn(t,e);return i in this.patternCache_?this.patternCache_[i]:null}set(t,e,i,n){const r=Nn(t,e),s=r in this.cache_;this.cache_[r]=i,n&&(0===i.getImageState()&&i.load(),1===i.getImageState()?i.ready().then(()=>{this.patternCache_[r]=yn().createPattern(i.getImage(1),"repeat")}):this.patternCache_[r]=yn().createPattern(i.getImage(1),"repeat")),s||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};let Zn=null;class Vn extends L{constructor(t,e,i,n,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i?.crossOrigin,this.referrerPolicy_=i?.referrerPolicy,this.canvas_={},this.color_=r,this.imageState_=void 0===n?0:n,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_&&2===this.imageState_){Zn||(Zn=_n(1,1,void 0,{willReadFrequently:!0})),Zn.drawImage(this.image_,0,0);try{Zn.getImageData(0,0,1,1),this.tainted_=!1}catch{Zn=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(C)}handleImageError_(){this.imageState_=3,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=2,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=_n(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(0===this.imageState_){this.image_||this.initializeImage_(),this.imageState_=1;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&(t=this.image_,e=this.src_,e&&(t.src=e),t.src&&pn?new Promise((e,i)=>t.decode().then(()=>e(t)).catch(n=>t.complete&&t.width?e(t):i(n))):function(t){return new Promise((e,i)=>{function n(){s(),e(t)}function r(){s(),i(new Error("Image load error"))}function s(){t.removeEventListener("load",n),t.removeEventListener("error",r)}t.addEventListener("load",n),t.addEventListener("error",r)})}(t)).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}var t,e}replaceColor_(t){if(!this.color_||this.canvas_[t]||2!==this.imageState_)return;const e=this.image_,i=_n(Math.ceil(e.width*t),Math.ceil(e.height*t)),n=i.canvas;var r;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle="string"==typeof(r=this.color_)?r:Yn(r),i.fillRect(0,0,n.width/t,n.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=n}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(2===this.imageState_||3===this.imageState_)t();else{const e=()=>{2!==this.imageState_&&3!==this.imageState_||(this.removeEventListener(C,e),t())};this.addEventListener(C,e)}})),this.ready_}}function Un(t,e,i,n,r,s){let o=void 0===e?void 0:Bn.get(e,r);return o||(o=new Vn(t,t&&"src"in t?t.src||void 0:e,i,n,r),Bn.set(e,r,o,s)),s&&o&&!Bn.getPattern(e,r)&&Bn.set(e,r,o,s),o}var Kn=Vn;function $n(t){return t?Array.isArray(t)?Yn(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return Bn.getPattern(t.src,t.color);const e=t.src+":"+t.offset,i=Bn.getPattern(e,t.color);if(i)return i;const n=Bn.get(t.src,null);if(2!==n.getImageState())return null;const r=_n(t.size[0],t.size[1]);return r.drawImage(n.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),Un(r.canvas,e,void 0,2,t.color,!0),Bn.getPattern(e,t.color)}(t):t:null}function qn(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=e;o<i;o+=n)r[s++]=t.slice(o,o+n);return r.length=s,r}function Hn(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];r[s++]=qn(t,e,a,n,r[s]),e=a}return r.length=s,r}function Jn(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];r[s++]=1===a.length&&a[0]===e?[]:Hn(t,e,a,n,r[s]),e=a[a.length-1]}return r.length=s,r}var Qn=class{drawCustom(t,e,i,n,r){}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 tr=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"),er=["style","variant","weight","size","lineHeight","family"],ir={normal:400,bold:700},nr=function(t){const e=t.match(tr);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let t=0,n=er.length;t<n;++t){const n=e[t+1];void 0!==n&&(i[er[t]]="string"==typeof n?n.trim():n)}return isNaN(Number(i.weight))&&i.weight in ir&&(i.weight=ir[i.weight]),i.families=i.family.split(/,\s?/).map(t=>t.trim().replace(/^['"]|['"]$/g,"")),i},rr="10px sans-serif",sr="#000",or="round",ar=[],lr="round",hr="#000",cr="center",ur="middle",dr=[0,0,0,0],fr=new Y;let gr,pr=null;const _r={},mr=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function yr(t,e,i){return`${t} ${e} 16px "${i}"`}const xr=function(){const t=100;let e,i;async function n(t){await i.ready;const e=nr(t),n=e.families[0].toLowerCase(),r=e.weight,s=[];return i.forEach(t=>{const i=t.family.replace(/^['"]|['"]$/g,"").toLowerCase(),o=ir[t.weight]||t.weight;i===n&&t.style===e.style&&o==r&&s.push(t)}),0!==s.length&&(await Promise.all(s.map(t=>t.load().then(()=>!0,()=>!1)))).some(t=>t)}async function r(){await i.ready;let s=!0;const o=fr.getProperties(),a=Object.keys(o).filter(e=>o[e]<t);for(let e=a.length-1;e>=0;--e){const i=a[e];let r=o[i];r<t&&(await n(i)?(y(_r),fr.set(i,t)):(r+=10,fr.set(i,r,!0),r<t&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(t){i||(i=gn?self.fonts:document.fonts);const n=nr(t);if(!n)return;const s=n.families;let o=!1;for(const t of s){if(mr.has(t))continue;const e=yr(n.style,n.weight,t);void 0===fr.get(e)&&(fr.set(e,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(r,100))}}(),vr=function(){let t;return function(e){let i=_r[e];if(null==i){if(gn){const t=nr(e),n=Sr(e,"Žg");i=(isNaN(Number(t.lineHeight))?1.2:Number(t.lineHeight))*(n.actualBoundingBoxAscent+n.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);_r[e]=i}return i}}();function Sr(t,e){return pr||(pr=_n(1,1)),t!=gr&&(pr.font=t,gr=pr.font),pr.measureText(e)}function wr(t,e){return Sr(t,e).width}function Cr(t,e,i){if(e in i)return i[e];const n=e.split("\n").reduce((e,i)=>Math.max(e,wr(t,i)),0);return i[e]=n,n}const br={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},Rr=[br.FILL],Tr=[br.STROKE],Er=[br.BEGIN_PATH],Ir=[br.CLOSE_PATH];var Mr=br,Pr=class extends Qn{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,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(),n=this.tmpCoordinate_,r=this.coordinates;let s=r.length;for(let o=0,a=t.length;o<a;o+=e)n[0]=t[o],n[1]=t[o+1],q(i,n)&&(r[s++]=n[0],r[s++]=n[1]);return s}appendFlatLineCoordinates(t,e,i,n,r,s){const o=this.coordinates;let a=o.length;const l=this.getBufferedMaxExtent();s&&(e+=n);let h=t[e],c=t[e+1];const u=this.tmpCoordinate_;let d,f,g,p=!0;for(d=e+n;d<i;d+=n)u[0]=t[d],u[1]=t[d+1],g=Q(l,u),g!==f?(p&&(o[a++]=h,o[a++]=c,p=!1),o[a++]=u[0],o[a++]=u[1]):1===g?(o[a++]=u[0],o[a++]=u[1],p=!1):p=!0,h=u[0],c=u[1],f=g;return(r&&p||d===e+n)&&(o[a++]=h,o[a++]=c),a}drawCustomCoordinates_(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s],a=this.appendFlatLineCoordinates(t,e,o,n,!1,!1);r.push(a),e=o}return e}drawCustom(t,e,i,n,r){this.beginGeometry(t,e,r);const s=t.getType(),o=t.getStride(),a=this.coordinates.length;let l,h,c,u,d;switch(s){case"MultiPolygon":l=t.getOrientedFlatCoordinates(),u=[];const e=t.getEndss();d=0;for(let t=0,i=e.length;t<i;++t){const i=[];d=this.drawCustomCoordinates_(l,d,e[t],o,i),u.push(i)}this.instructions.push([Mr.CUSTOM,a,u,t,i,Jn,r]),this.hitDetectionInstructions.push([Mr.CUSTOM,a,u,t,n||i,Jn,r]);break;case"Polygon":case"MultiLineString":c=[],l="Polygon"==s?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(l,0,t.getEnds(),o,c),this.instructions.push([Mr.CUSTOM,a,c,t,i,Hn,r]),this.hitDetectionInstructions.push([Mr.CUSTOM,a,c,t,n||i,Hn,r]);break;case"LineString":case"Circle":l=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(l,0,l.length,o,!1,!1),this.instructions.push([Mr.CUSTOM,a,h,t,i,qn,r]),this.hitDetectionInstructions.push([Mr.CUSTOM,a,h,t,n||i,qn,r]);break;case"MultiPoint":l=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(l,o),h>a&&(this.instructions.push([Mr.CUSTOM,a,h,t,i,qn,r]),this.hitDetectionInstructions.push([Mr.CUSTOM,a,h,t,n||i,qn,r]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([Mr.CUSTOM,a,h,t,i,void 0,r]),this.hitDetectionInstructions.push([Mr.CUSTOM,a,h,t,n||i,void 0,r])}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[Mr.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[Mr.BEGIN_GEOMETRY,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 n,r,s=-1;for(e=0;e<i;++e)n=t[e],r=n[0],r==Mr.END_GEOMETRY?s=e:r==Mr.BEGIN_GEOMETRY&&(n[2]=e,I(this.hitDetectionInstructions,s,e),s=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&"object"==typeof i&&"src"in i?this.pixelRatio:1,e.fillStyle=$n(i||sr)??void 0}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=$n(i||hr);const n=t.getLineCap();e.lineCap=void 0!==n?n:or;const r=t.getLineDash();e.lineDash=r?r.slice():ar;const s=t.getLineDashOffset();e.lineDashOffset=s||0;const o=t.getLineJoin();e.lineJoin=void 0!==o?o:lr;const a=t.getWidth();e.lineWidth=void 0!==a?a:1;const l=t.getMiterLimit();e.miterLimit=void 0!==l?l:10;const h=t.getOffset();e.strokeOffset=h??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=[Mr.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[Mr.SET_STROKE_STYLE,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,n=t.lineCap,r=t.lineDash,s=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit,h=t.strokeOffset;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!P(t.currentLineDash,r)||t.currentLineDashOffset!=s||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l||t.currentStrokeOffset!=h)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=s,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l,t.currentStrokeOffset=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[Mr.END_GEOMETRY,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;K(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Fr=class extends Pr{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinatess_(t,e,i,n,r){const s=this.state,o=void 0!==s.fillStyle,a=void 0!==s.strokeStyle,l=i.length;this.instructions.push(Er),this.hitDetectionInstructions.push(Er);for(let s=0;s<l;++s){const o=i[s],l=this.coordinates.length,h=this.appendFlatLineCoordinates(t,e,o,n,!0,!a);this.instructions.push([Mr.MOVE_TO_LINE_TO,l,h,r*this.pixelRatio,!0]),this.hitDetectionInstructions.push([Mr.MOVE_TO_LINE_TO,l,h,r,!0]),a&&(this.instructions.push(Ir),this.hitDetectionInstructions.push(Ir)),e=o}return o&&(this.instructions.push(Rr),this.hitDetectionInstructions.push(Rr)),a&&(this.instructions.push(Tr),this.hitDetectionInstructions.push(Tr)),e}drawCircle(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_(()=>this.drawCircle(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Mr.SET_FILL_STYLE,sr]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Mr.SET_STROKE_STYLE,hr,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,ar,0]);const a=t.getFlatCoordinates(),l=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const c=[Mr.CIRCLE,h,o];this.instructions.push(Er,c),this.hitDetectionInstructions.push(Er,c),void 0!==n.fillStyle&&(this.instructions.push(Rr),this.hitDetectionInstructions.push(Rr)),void 0!==n.strokeStyle&&(this.instructions.push(Tr),this.hitDetectionInstructions.push(Tr)),this.endGeometry(e)}drawPolygon(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_(()=>this.drawPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Mr.SET_FILL_STYLE,sr]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Mr.SET_STROKE_STYLE,hr,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,ar,0]);const a=t.getEnds(),l=t.getOrientedFlatCoordinates(),h=t.getStride();this.drawFlatCoordinatess_(l,0,a,h,o),this.endGeometry(e)}drawMultiPolygon(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_(()=>this.drawMultiPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Mr.SET_FILL_STYLE,sr]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Mr.SET_STROKE_STYLE,hr,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,ar,0]);const a=t.getEndss(),l=t.getOrientedFlatCoordinates(),h=t.getStride();let c=0;for(let t=0,e=a.length;t<e;++t)c=this.drawFlatCoordinatess_(l,c,a[t],h,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,n=e.length;i<n;++i)e[i]=wi(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,n=e.strokeStyle,r=e.strokeOffset;return Math.abs(r)>0&&void 0!==i&&void 0!==n&&(e.strokeStyle=void 0,e.strokeOffset=0,t(),e.fillStyle=void 0,e.strokeStyle=n,e.strokeOffset=r,t(),e.fillStyle=i,!0)}};let Or=0,kr=1;function Ar(t,e,i,n,r,s,o,a){const l=o-r,h=a-s;let c=0,u=1;if(0===l){if(r<t||r>i)return!1}else{let e=(t-r)/l,n=(i-r)/l;if(e>n){const t=e;e=n,n=t}if(e>c&&(c=e),n<u&&(u=n),c>u)return!1}if(0===h){if(s<e||s>n)return!1}else{let t=(e-s)/h,i=(n-s)/h;if(t>i){const e=t;t=i,i=e}if(t>c&&(c=t),i<u&&(u=i),c>u)return!1}return Or=c,kr=u,!0}function Lr(t,e,i,n,r){const s=[];let o=i,a=0,l=e.slice(i,2);for(;a<t&&o+r<n;){const[i,n]=l.slice(-2),h=e[o+r],c=e[o+r+1],u=Math.sqrt((h-i)*(h-i)+(c-n)*(c-n));if(a+=u,a>=t){const e=(t-a+u)/u,d=jt(i,h,e),f=jt(n,c,e);l.push(d,f),s.push(l),l=[d,f],a==t&&(o+=r),a=0}else if(a<t)l.push(e[o+r],e[o+r+1]),o+=r;else{const t=u-a,e=jt(i,h,t/u),d=jt(n,c,t/u);l.push(e,d),s.push(l),l=[e,d],a=0,o+=r}}return a>0&&s.push(l),s}function Dr(t,e,i,n,r){let s,o,a,l,h,c,u,d,f,g,p=i,_=i,m=0,y=0,x=i;for(o=i;o<n;o+=r){const i=e[o],n=e[o+1];void 0!==h&&(f=i-h,g=n-c,l=Math.sqrt(f*f+g*g),void 0!==u&&(y+=a,s=Math.acos((u*f+d*g)/(a*l)),s>t&&(y>m&&(m=y,p=x,_=o),y=0,x=o-r)),a=l,u=f,d=g),h=i,c=n}return y+=l,y>m?[x,o]:[p,_]}const jr={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};const Gr={Circle:Fr,Default:Pr,Image:class extends Pr{constructor(t,e,i,n){super(t,e,i,n),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!q(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=t.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(n,r);this.instructions.push([Mr.DRAW_IMAGE,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([Mr.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=[];for(let e=0,i=n.length;e<i;e+=t.getStride())this.maxExtent&&!q(this.maxExtent,n.slice(e,e+2))||r.push(n[e],n[e+1]);const s=this.coordinates.length,o=this.appendFlatPointCoordinates(r,2);this.instructions.push([Mr.DRAW_IMAGE,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([Mr.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),n=t.getSize(),r=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}},LineString:class extends Pr{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n,r){const s=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,n,!1,!1);return this.instructions.push([Mr.MOVE_TO_LINE_TO,s,o,r*this.pixelRatio]),this.hitDetectionInstructions.push([Mr.MOVE_TO_LINE_TO,s,o,r]),i}drawLineString(t,e,i){const n=this.state,r=n.strokeStyle,s=n.lineWidth,o=n.strokeOffset;if(void 0===r||void 0===s)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([Mr.SET_STROKE_STYLE,hr,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,ar,0],Er);const a=t.getFlatCoordinates(),l=t.getStride();this.drawFlatCoordinates_(a,0,a.length,l,o),this.hitDetectionInstructions.push(Tr),this.endGeometry(e)}drawMultiLineString(t,e,i){const n=this.state,r=n.strokeStyle,s=n.lineWidth,o=n.strokeOffset;if(void 0===r||void 0===s)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([Mr.SET_STROKE_STYLE,hr,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,ar,0],Er);const a=t.getEnds(),l=t.getFlatCoordinates(),h=t.getStride();let c=0;for(let t=0,e=a.length;t<e;++t)c=this.drawFlatCoordinates_(l,c,a[t],h,o);this.hitDetectionInstructions.push(Tr),this.endGeometry(e)}finish(){const t=this.state;return null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(Tr),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(Tr),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(Er)}},Polygon:Fr,Text:class extends Pr{constructor(t,e,i,n){super(t,e,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[sr]={fillStyle:sr},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 n=this.textFillState_,r=this.textStrokeState_,s=this.textState_;if(""===this.text_||!s||!n&&!r)return;const o=this.coordinates;let a=o.length;const l=t.getType();let h=null,c=t.getStride();if("line"!==s.placement||"LineString"!=l&&"MultiLineString"!=l&&"Polygon"!=l&&"MultiPolygon"!=l){let n=s.overflow?null:[];switch(l){case"Point":case"MultiPoint":h=t.getFlatCoordinates();break;case"LineString":h=t.getFlatMidpoint();break;case"Circle":h=t.getCenter();break;case"MultiLineString":h=t.getFlatMidpoints(),c=2;break;case"Polygon":h=t.getFlatInteriorPoint(),s.overflow||n.push(h[2]/this.resolution),c=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();h=[];for(let t=0,i=e.length;t<i;t+=3)s.overflow||n.push(e[t+2]/this.resolution),h.push(e[t],e[t+1]);if(0===h.length)return;c=2}const r=this.appendFlatPointCoordinates(h,c);if(r===a)return;if(n&&(r-a)/2!==h.length/c){let t=a/2;n=n.filter((e,i)=>{const n=o[2*(t+i)]===h[i*c]&&o[2*(t+i)+1]===h[i*c+1];return n||--t,n})}this.saveTextStates_();const u=s.backgroundFill?this.createFill(this.fillStyleToState(s.backgroundFill)):null,d=s.backgroundStroke?this.createStroke(this.strokeStyleToState(s.backgroundStroke)):null;this.beginGeometry(t,e,i);let f=s.padding;if(f!=dr&&(s.scale[0]<0||s.scale[1]<0)){let t=s.padding[0],e=s.padding[1],i=s.padding[2],n=s.padding[3];s.scale[0]<0&&(e=-e,n=-n),s.scale[1]<0&&(t=-t,i=-i),f=[t,e,i,n]}const g=this.pixelRatio;this.instructions.push([Mr.DRAW_IMAGE,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,f==dr?dr:f.map(function(t){return t*g}),u,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]);const p=1/g,_=u?u.slice(0):null;_&&(_[1]=sr),this.hitDetectionInstructions.push([Mr.DRAW_IMAGE,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[p,p],NaN,this.declutterMode_,this.declutterImageWithText_,f,_,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?sr:this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]),this.endGeometry(e)}else{const n=t.getExtent();if(!wt(this.maxExtent,n))return;let r;if(h=t.getFlatCoordinates(),"LineString"==l)r=[h.length];else if("MultiLineString"==l)r=t.getEnds();else if("Polygon"==l)r=t.getEnds().slice(0,1);else if("MultiPolygon"==l){const e=t.getEndss();r=[];for(let t=0,i=e.length;t<i;++t)r.push(e[t][0])}if(("LineString"==l||"MultiLineString"==l)&&!H(this.getBufferedMaxExtent(),n)){const t=function(t,e,i,n){const r=n[0],s=n[1],o=n[2],a=n[3],l=[],h=[];let c,u,d=!1,f=0;for(let n=0,g=e.length;n<g;++n){const g=e[n];let p=t[f],_=t[f+1],m=!1;for(let e=f+i;e<g;e+=i){const i=t[e],n=t[e+1];if(Ar(r,s,o,a,p,_,i,n)){const t=i-p,e=n-_,r=p+Or*t,s=_+Or*e,o=p+kr*t,a=_+kr*e;d&&m&&r===c&&s===u?l.push(o,a):(d&&h.push(l.length),l.push(r,s,o,a),d=!0),c=o,u=a,m=!0}p=i,_=n}f=g}return d&&h.push(l.length),{flatCoordinates:l,ends:h}}(h,r,c,this.getBufferedMaxExtent());if(h=t.flatCoordinates,r=t.ends,c=2,0===r.length)return}this.beginGeometry(t,e,i);const u=s.repeat,d=u?void 0:s.textAlign;let f=0;for(let t=0,e=r.length;t<e;++t){let e;e=u?Lr(u*this.resolution,h,f,r[t],c):[h.slice(f,r[t])];for(let i=0,n=e.length;i<n;++i){const n=e[i];let l=0,h=n.length;if(null==d){const t=Dr(s.maxAngle,n,0,n.length,2);l=t[0],h=t[1]}for(let t=l;t<h;t+=c)o.push(n[t],n[t+1]);const u=o.length;f=r[t],this.drawChars_(a,u),a=u}}this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,n=this.strokeKey_;t&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const r=this.textKey_;r in this.textStates||(this.textStates[r]={font:e.font,textAlign:e.textAlign||cr,justify:e.justify,textBaseline:e.textBaseline||ur,scale:e.scale});const s=this.fillKey_;i&&(s in this.fillStates||(this.fillStates[s]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,n=this.textState_,r=this.strokeKey_,s=this.textKey_,o=this.fillKey_;this.saveTextStates_();const a=this.pixelRatio,l=jr[n.textBaseline],h=this.textOffsetX_*a,c=this.textOffsetY_*a,u=this.text_,d=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([Mr.DRAW_CHARS,t,e,l,n.overflow,o,n.maxAngle,a,c,r,d*a,u,s,1,this.declutterMode_,this.textKeepUpright_,h]),this.hitDetectionInstructions.push([Mr.DRAW_CHARS,t,e,l,n.overflow,o?sr:o,n.maxAngle,a,c,r,d*a,u,s,1/a,this.declutterMode_,this.textKeepUpright_,h])}setTextStyle(t,e){let i,n,r;if(t){const e=t.getFill();e?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=$n(e.getColor()||sr)):(n=null,this.textFillState_=n);const s=t.getStroke();if(s){r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const t=s.getLineDash(),e=s.getLineDashOffset(),i=s.getWidth(),n=s.getMiterLimit();r.lineCap=s.getLineCap()||or,r.lineDash=t?t.slice():ar,r.lineDashOffset=void 0===e?0:e,r.lineJoin=s.getLineJoin()||lr,r.lineWidth=void 0===i?1:i,r.miterLimit=void 0===n?10:n,r.strokeStyle=$n(s.getColor()||hr)}else r=null,this.textStrokeState_=r;i=this.textState_;const o=t.getFont()||rr;xr(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()||ur,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||dr,i.scale=void 0===a?[1,1]:a;const l=t.getOffsetX(),h=t.getOffsetY(),c=t.getRotateWithView(),u=t.getKeepUpright(),d=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=void 0===l?0:l,this.textOffsetY_=void 0===h?0:h,this.textRotateWithView_=void 0!==c&&c,this.textKeepUpright_=void 0===u||u,this.textRotation_=void 0===d?0:d,this.strokeKey_=r?("string"==typeof r.strokeStyle?r.strokeStyle:X(r.strokeStyle))+r.lineCap+r.lineDashOffset+"|"+r.lineWidth+r.lineJoin+r.miterLimit+"["+r.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=n&&n.fillStyle?"string"==typeof n.fillStyle?n.fillStyle:"|"+X(n.fillStyle):""}else this.text_="";this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}};var Wr=class{constructor(t,e,i,n){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=n,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 n in i){const r=i[n].finish();t[e][n]=r}}return t}getBuilder(t,e){const i=void 0!==t?t.toString():"0";let n=this.buildersByZIndex_[i];void 0===n&&(n={},this.buildersByZIndex_[i]=n);let r=n[e];return void 0===r&&(r=new(0,Gr[e])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=r),r}};function Xr(t,e,i,n){let r=t[e],s=t[e+1],o=0;for(let a=e+n;a<i;a+=n){const e=t[a],i=t[a+1];o+=Math.sqrt((e-r)*(e-r)+(i-s)*(i-s)),r=e,s=i}return o}function zr(t,e,i,n,r,s,o,a){o=o??[],a=a??n;const l=t[e+n],h=t[e+n+1],c=t[i-2*n],u=t[i-2*n+1];let d,f,g,p,_,m,y,x,v=0;for(let S=e;S<i;S+=n){g=d,p=f,_=void 0,m=void 0,S+n<i&&(_=t[S+n],m=t[S+n+1]),s&&S===e&&(g=c,p=u),s&&S===i-n&&(_=l,m=h),d=t[S],f=t[S+1],[y,x]=Yr(d,f,g,p,_,m,r),o[v++]=y,o[v++]=x;for(let e=2;e<a;e++)o[v++]=t[S+e]}return o.length!=v&&(o.length=v),o}function Yr(t,e,i,n,r,s,o){let a,l;void 0!==i&&void 0!==n?(a=t-i,l=e-n):void 0!==r&&void 0!==s?(a=r-t,l=s-e):(a=1,l=0);const h=Math.hypot(a,l),c=a/h,u=l/h;if(a=-u,l=c,void 0===i||void 0===n)return[t+a*o,e+l*o];if(void 0===r||void 0===s)return[t+a*o,e+l*o];const d=function(t,e,i){const n=Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),r=[(e[0]-t[0])/n,(e[1]-t[1])/n],s=[-r[1],r[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 l=0===n||0===o?0:Math.acos(Ft(a[0]*r[0]+a[1]*r[1],-1,1));return l=Math.max(l,1e-5),a[0]*s[0]+a[1]*s[1]>0?l:2*Math.PI-l}([t,e],[i,n],[r,s]);if(Math.cos(d)>.998)return[t+c*o,e+u*o];const f=Math.cos(d/2),g=Math.sin(d/2);return[t+1/g*(g*a+f*l)*o,e+1/g*(-f*a+g*l)*o]}function Nr(t,e,i=!1){for(let n=0,r=t.length-2;n<r;n+=e)for(let r=i&&0===n?t.length-3*e:t.length-2*e;r>n+e;r-=e){const i=t[n],s=t[n+1],o=t[n+e],a=t[n+e+1],l=t[r],h=t[r+1],c=t[r+e],u=t[r+e+1],d=(u-h)*(o-i)-(c-l)*(a-s);if(0===d)continue;const f=((c-l)*(s-h)-(u-h)*(i-l))/d,g=((o-i)*(s-h)-(a-s)*(i-l))/d;if(f>0&&f<1&&g>0&&g<1){const l=i+f*(o-i),h=s+f*(a-s);t[n+e]=l,t[n+e+1]=h,t.splice(n+2*e,r-n-e);break}}return t}let Br;function Zr(t,e,i,n,r,s,o,a,l,h,c,u,d=!0){let f=t[e],g=t[e+1],p=0,_=0,m=0,y=0;function x(){p=f,_=g,f=t[e+=n],g=t[e+1],y+=m,m=Math.sqrt((f-p)*(f-p)+(g-_)*(g-_))}do{x()}while(e<i-n&&y+m<s);let v=0===m?0:(s-y)/m;const S=jt(p,f,v),w=jt(_,g,v),C=e-n,b=y,R=s+a*l(h,r,c);for(;e<i-n&&y+m<R;)x();v=0===m?0:(R-y)/m;const T=jt(p,f,v),E=jt(_,g,v);let I=!1;if(d)if(u){const t=[S,w,T,E];Ti(t,0,4,2,u,t,t),I=t[0]>t[2]}else I=S>T;const M=Math.PI,P=[],F=C+n===e;let O;if(m=0,y=b,f=t[e=C],g=t[e+1],F){x(),O=Math.atan2(g-_,f-p),I&&(O+=O>0?-M:M);const t=(T+S)/2,e=(E+w)/2;return P[0]=[t,e,(R-s)/2,O,r],P}r=r.replace(/\n/g," ");const k=Array.from((Br||(Br=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Br).segment(r),t=>t.segment);for(let t=0,r=k.length;t<r;){x();let u=Math.atan2(g-_,f-p);if(I&&(u+=u>0?-M:M),void 0!==O){let t=u-O;if(t+=t>M?-2*M:t<-M?2*M:0,Math.abs(t)>o)return null}O=u;const d=t;let S=0;for(;t<r;++t){const o=a*l(h,k[I?r-t-1:t],c);if(e+n<i&&y+m<s+S+o/2)break;S+=o}if(t===d)continue;const w=(I?k.slice(r-t,r-d):k.slice(d,t)).join("");v=0===m?0:(s+S/2-y)/m;const C=jt(p,f,v),b=jt(_,g,v);P.push([C,b,S/2,u,w]),s+=S}return P}var Vr=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(yn(),{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,n=e.length;i<n;++i){const n=e[i];if("function"==typeof n){n(t);continue}const r=e[++i];"function"==typeof t[n]?t[n](...r):t[n]="function"==typeof r?r(t):r}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}};const Ur=[1/0,1/0,-1/0,-1/0],Kr=[],$r=[],qr=[],Hr=[];function Jr(t){return t[3].declutterBox}const Qr=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 ts(t,e){return"start"===e?e=Qr.test(t)?"right":"left":"end"===e&&(e=Qr.test(t)?"left":"right"),jr[e]}function es(t,e,i){return i>0&&t.push("\n",""),t.push(e,""),t}function is(t,e,i){return i%2==0&&(t+=e),t}var ns=class{constructor(t,e,i,n,r){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=Mi(),this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=r?new Vr:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,n){const r=t+e+i+n;if(this.labels_[r])return this.labels_[r];const s=n?this.strokeStates[n]:null,o=i?this.fillStates[i]:null,a=this.textStates[e],l=this.pixelRatio,h=[a.scale[0]*l,a.scale[1]*l],c=a.justify?jr[a.justify]:ts(Array.isArray(t)?t[0]:t,a.textAlign||cr),u=n&&s.lineWidth?s.lineWidth:0,d=Array.isArray(t)?t:String(t).split("\n").reduce(es,[]),{width:f,height:g,widths:p,heights:_,lineWidths:m}=function(t,e){const i=[],n=[],r=[];let s=0,o=0,a=0,l=0;for(let h=0,c=e.length;h<=c;h+=2){const u=e[h];if("\n"===u||h===c){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}const d=e[h+1]||t.font,f=wr(d,u);i.push(f),o+=f;const g=vr(d);n.push(g),l=Math.max(l,g)}return{width:s,height:a,widths:i,heights:n,lineWidths:r}}(a,d),y=f+u,x=[],v=(y+2)*h[0],S=(g+u)*h[1],w={width:v<0?Math.floor(v):Math.ceil(v),height:S<0?Math.floor(S):Math.ceil(S),contextInstructions:x};1==h[0]&&1==h[1]||x.push("scale",h),n&&(x.push("strokeStyle",s.strokeStyle),x.push("lineWidth",u),x.push("lineCap",s.lineCap),x.push("lineJoin",s.lineJoin),x.push("miterLimit",s.miterLimit),x.push("setLineDash",[s.lineDash]),x.push("lineDashOffset",s.lineDashOffset)),i&&x.push("fillStyle",o.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const C=.5-c;let b=c*y+C*u;const R=[],T=[];let E,I=0,M=0,P=0,F=0;for(let t=0,e=d.length;t<e;t+=2){const e=d[t];if("\n"===e){M+=I,I=0,b=c*y+C*u,++F;continue}const r=d[t+1]||a.font;r!==E&&(n&&R.push("font",r),i&&T.push("font",r),E=r),I=Math.max(I,_[P]);const s=[e,b+C*p[P]+c*(p[P]-m[F]),.5*(u+I)+M];b+=p[P],n&&R.push("strokeText",s),i&&T.push("fillText",s),++P}return Array.prototype.push.apply(x,R),Array.prototype.push.apply(x,T),this.labels_[r]=w,w}replayTextBackground_(t,e,i,n,r,s,o){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,n),t.lineTo.apply(t,r),t.lineTo.apply(t,e),s&&(this.alignAndScaleFill_=s[2],t.fillStyle=s[1],this.fill_(t)),o&&(this.setStrokeStyle_(t,o),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,n,r,s,o,a,l,h,c,u,d,f,g,p){let _=i-(o*=u[0]),m=n-(a*=u[1]);const y=r+l>t?t-l:r,x=s+h>e?e-h:s,v=f[3]+y*u[0]+f[1],S=f[0]+x*u[1]+f[2],w=_-f[3],C=m-f[0];let b;return(g||0!==c)&&(Kr[0]=w,Hr[0]=w,Kr[1]=C,$r[1]=C,$r[0]=w+v,qr[0]=$r[0],qr[1]=C+S,Hr[1]=qr[1]),0!==c?(b=Li(Mi(),i,n,1,1,c,-i,-n),ki(b,Kr),ki(b,$r),ki(b,qr),ki(b,Hr),tt(Math.min(Kr[0],$r[0],qr[0],Hr[0]),Math.min(Kr[1],$r[1],qr[1],Hr[1]),Math.max(Kr[0],$r[0],qr[0],Hr[0]),Math.max(Kr[1],$r[1],qr[1],Hr[1]),Ur)):tt(Math.min(w,w+v),Math.min(C,C+S),Math.max(w,w+v),Math.max(C,C+S),Ur),d&&(_=Math.round(_),m=Math.round(m)),{drawImageX:_,drawImageY:m,drawImageW:y,drawImageH:x,originX:l,originY:h,declutterBox:{minX:Ur[0],minY:Ur[1],maxX:Ur[2],maxY:Ur[3],value:p},canvasTransform:b,scale:u}}replayImageOrLabel_(t,e,i,n,r,s,o){const a=!(!s&&!o),l=n.declutterBox,h=o?o[2]*n.scale[0]/2:0;return l.minX-h<=e[0]&&l.maxX+h>=0&&l.minY-h<=e[1]&&l.maxY+h>=0&&(a&&this.replayTextBackground_(t,Kr,$r,qr,Hr,s,o),function(t,e,i,n,r,s,o,a,l,h,c){t.save(),1!==i&&(void 0===t.globalAlpha?t.globalAlpha=t=>t.globalAlpha*=i:t.globalAlpha*=i),e&&t.transform.apply(t,e),n.contextInstructions?(t.translate(l,h),t.scale(c[0],c[1]),function(t,e){const i=t.contextInstructions;for(let t=0,n=i.length;t<n;t+=2)Array.isArray(i[t+1])?e[i[t]].apply(e,i[t+1]):e[i[t]]=i[t+1]}(n,t)):c[0]<0||c[1]<0?(t.translate(l,h),t.scale(c[0],c[1]),t.drawImage(n,r,s,o,a,0,0,o,a)):t.drawImage(n,r,s,o,a,l,h,o*c[0],a*c[1]),t.restore()}(t,n.canvasTransform,r,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=ki(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(i[0]%n,i[1]%n),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,n){const r=this.textStates[e],s=this.createLabel(t,e,n,i),o=this.strokeStates[i],a=this.pixelRatio,l=ts(Array.isArray(t)?t[0]:t,r.textAlign||cr),h=jr[r.textBaseline||ur],c=o&&o.lineWidth?o.lineWidth:0;return{label:s,anchorX:l*(s.width/a-2*r.scale[0])+2*(.5-l)*c,anchorY:h*s.height/a+2*(.5-h)*c}}execute_(t,e,i,n,r,s,o,a){const l=this.zIndexContext_;let h;var c,u;this.pixelCoordinates_&&P(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=Ri(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),u=i,(c=this.renderedTransform_)[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 f=n.length;let g,p=0;const _=[];let m,y,x,v,S,w,C,b,R,T,E,I,M,F=0,O=0;const k=this.coordinateCache_,A=this.viewRotation_,L=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,D={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:A},j=this.instructions!=n||this.overlaps?0:200;let G,W,X,z;for(;d<f;){const i=n[d];switch(i[0]){case Mr.BEGIN_GEOMETRY:G=i[1],z=i[3],G.getGeometry()?void 0===o||wt(o,z.getExtent())?++d:d=i[2]+1:d=i[2],l&&(l.zIndex=i[4]);break;case Mr.BEGIN_PATH:F>j&&(this.fill_(t),F=0),O>j&&(t.stroke(),O=0),F||O||(t.beginPath(),S=NaN,w=NaN),++d;break;case Mr.CIRCLE:p=i[1],x=i[2]??0;const n=h[p],c=h[p+1],u=h[p+2]-x-n,f=h[p+3]-x-c,P=Math.sqrt(u*u+f*f);t.moveTo(n+P,c),t.arc(n,c,P,0,2*Math.PI,!0),++d;break;case Mr.CLOSE_PATH:t.closePath(),++d;break;case Mr.CUSTOM:p=i[1],g=i[2];const Y=i[3],N=i[4],B=i[5];D.geometry=Y,D.feature=G,d in k||(k[d]=[]);const Z=k[d];B?B(h,p,g,2,Z):(Z[0]=h[p],Z[1]=h[p+1],Z.length=2),l&&(l.zIndex=i[6]),N(Z,D),++d;break;case Mr.DRAW_IMAGE:p=i[1],g=i[2],R=i[3],m=i[4],y=i[5];let V=i[6];const U=i[7],K=i[8],$=i[9],q=i[10];let H=i[11];const J=i[12];let Q=i[13];v=i[14]||"declutter";const tt=i[15];if(!R&&i.length>=20){T=i[19],E=i[20],I=i[21],M=i[22];const t=this.drawLabelWithPointPlacement_(T,E,I,M);R=t.label,i[3]=R;const e=i[23];m=(t.anchorX-e)*this.pixelRatio,i[4]=m;const n=i[24];y=(t.anchorY-n)*this.pixelRatio,i[5]=y,V=R.height,i[6]=V,Q=R.width,i[13]=Q}let et,it,nt,rt;i.length>25&&(et=i[25]),i.length>17?(it=i[16],nt=i[17],rt=i[18]):(it=dr,nt=null,rt=null),q&&L?H+=A:q||L||(H-=A);let st=0;for(;p<g;p+=2){if(et&&et[st++]<Q/this.pixelRatio)continue;const i=this.calculateImageOrLabelDimensions_(R.width,R.height,h[p],h[p+1],Q,V,m,y,K,$,H,J,r,it,!!nt||!!rt,G),n=[t,e,R,i,U,nt,rt];if(a){let t,e,r,s,o;if(tt){const i=g-p;if(!tt[i]){tt[i]={args:n,declutterMode:v};continue}const s=tt[i];t=s.args,e=s.declutterMode,delete tt[i],r=Jr(t)}if(!t||"declutter"===e&&a.collides(r)||(s=!0),"declutter"===v&&a.collides(i.declutterBox)||(o=!0),"declutter"===e&&"declutter"===v){const t=s&&o;s=t,o=t}s&&("none"!==e&&a.insert(r),this.replayImageOrLabel_.apply(this,t)),o&&("none"!==v&&a.insert(i.declutterBox),this.replayImageOrLabel_.apply(this,n))}else this.replayImageOrLabel_.apply(this,n)}++d;break;case Mr.DRAW_CHARS:const ot=i[1],at=i[2],lt=i[3],ht=i[4];M=i[5];const ct=i[6],ut=i[7],dt=i[8];I=i[9];const ft=i[10];T=i[11],Array.isArray(T)&&(T=T.reduce(is,"")),E=i[12];const gt=[i[13],i[13]];v=i[14]||"declutter";const pt=i[15],_t=i[16],mt=this.textStates[E],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 St=Xr(h,ot,at,2),Ct=Math.abs(xt[0])*Cr(yt,T,vt);if(ht||Ct<=St){const i=Zr(h,ot,at,2,T,(St-Ct)*ts(T,this.textStates[E].textAlign),ct,Math.abs(xt[0]),Cr,yt,vt,L?0:this.viewRotation_,pt);t:if(i){const n=[];let r,s,o,l,h;if(I)for(r=0,s=i.length;r<s;++r){h=i[r],o=h[4],l=this.createLabel(o,E,"",I),m=h[2]+(xt[0]<0?-ft:ft)-_t,y=lt*l.height+2*(.5-lt)*ft*xt[1]/xt[0]-dt;const s=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,m,y,0,0,h[3],gt,!1,dr,!1,G);if(a&&"declutter"===v&&a.collides(s.declutterBox))break t;n.push([t,e,l,s,1,null,null])}if(M)for(r=0,s=i.length;r<s;++r){h=i[r],o=h[4],l=this.createLabel(o,E,M,""),m=h[2]-_t,y=lt*l.height-dt;const s=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,m,y,0,0,h[3],gt,!1,dr,!1,G);if(a&&"declutter"===v&&a.collides(s.declutterBox))break t;n.push([t,e,l,s,1,null,null])}a&&"none"!==v&&a.load(n.map(Jr));for(let t=0,e=n.length;t<e;++t)this.replayImageOrLabel_.apply(this,n[t])}}++d;break;case Mr.END_GEOMETRY:if(void 0!==s){G=i[1];const t=s(G,z,v);if(t)return t}++d;break;case Mr.FILL:j?F++:this.fill_(t),++d;break;case Mr.MOVE_TO_LINE_TO:let bt,Rt,Tt;if(p=i[1],g=i[2],x=i[3],x){const t=(i[4]??!1)||Math.abs(h[p]-h[g-2])<1e-6&&Math.abs(h[p+1]-h[g-1])<1e-6;zr(h,p,g,2,x,t,_),Nr(_,2,t),bt=_,Rt=0,Tt=bt.length}else bt=h,Rt=p,Tt=g;W=bt[Rt],X=bt[Rt+1],t.moveTo(W,X),S=W+.5|0,w=X+.5|0;for(let e=Rt+2;e<Tt;e+=2)W=bt[e],X=bt[e+1],C=W+.5|0,b=X+.5|0,e!=Tt-2&&C===S&&b===w||(t.lineTo(W,X),S=C,w=b);++d;break;case Mr.SET_FILL_STYLE:this.alignAndScaleFill_=i[2],F?(this.fill_(t),F=0,O&&(t.stroke(),O=0)):O&&i[1]&&(t.stroke(),O=0),t.fillStyle=i[1],++d;break;case Mr.SET_STROKE_STYLE:F&&i[1]&&(this.fill_(t),F=0),O&&(t.stroke(),O=0),this.setStrokeStyle_(t,i),++d;break;case Mr.STROKE:j?O++:t.stroke(),++d;break;default:++d}}F&&this.fill_(t),O&&t.stroke()}execute(t,e,i,n,r,s){this.viewRotation_=n,this.execute_(t,e,i,this.instructions,r,void 0,void 0,s)}executeHitDetection(t,e,i,n,r){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,n,r)}};const rs=["Polygon","Circle","LineString","Image","Text","Default"],ss=["Image","Text"],os=rs.filter(t=>!ss.includes(t));let as=!1,ls=!1;const hs={};var cs=class{constructor(t,e,i,n,r,s,o){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=s,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=Mi(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,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 n=this.executorsByZIndex_[i];void 0===n&&(n={},this.executorsByZIndex_[i]=n);const r=t[i];for(const t in r){const i=r[t];n[t]=new ns(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,n=t.length;e<n;++e)if(t[e]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,n,r,s){!1===ls&&function(){let t=0;const e=e=>{const i=_n(1,1,null,{willReadFrequently:e});let n=0;const r=performance.now();for(;performance.now()-r<50;++n)i.fillStyle=`rgba(255,0,${n%256},1)`,i.fillRect(0,0,1,1),i.getImageData(0,0,1,1);return t=n>t?n:t,n},i={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0};as=i[t],ls=!0}();const o=2*(n=Math.round(n))+1,a=Li(this.hitDetectionTransform_,n+.5,n+.5,1/e,-1/e,-i,-t[0],-t[1]),l=!this.hitDetectionContext_;l&&(this.hitDetectionContext_=_n(o,o,null,{willReadFrequently:as}));const h=this.hitDetectionContext_;let c;h.canvas.width!==o||h.canvas.height!==o?(h.canvas.width=o,h.canvas.height=o):l||h.clearRect(0,0,o,o),void 0!==this.renderBuffer_&&(c=[1/0,1/0,-1/0,-1/0],ot(c,t),K(c,e*(this.renderBuffer_+n),c));const u=function(t){if(void 0!==hs[t])return hs[t];const e=2*t+1,i=t*t,n=new Array(i+1);for(let r=0;r<=t;++r)for(let s=0;s<=t;++s){const o=r*r+s*s;if(o>i)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+r)*e+(t+s))+3),r>0&&a.push(4*((t-r)*e+(t+s))+3),s>0&&(a.push(4*((t+r)*e+(t-s))+3),r>0&&a.push(4*((t-r)*e+(t-s))+3))}const r=[];for(let t=0,e=n.length;t<e;++t)n[t]&&r.push(...n[t]);return hs[t]=r,r}(n);let d;function f(t,e,i){const a=h.getImageData(0,0,o,o).data;for(let l=0,c=u.length;l<c;l++)if(a[u[l]]>0){if(!s||"none"===i||"Image"!==d&&"Text"!==d||s.includes(t)){const i=(u[l]-3)/4,s=n-i%o,a=n-(i/o|0),h=r(t,e,s*s+a*a);if(h)return h}h.clearRect(0,0,o,o);break}}const g=Object.keys(this.executorsByZIndex_).map(Number);let p,_,m,y,x;for(g.sort(R),p=g.length-1;p>=0;--p){const t=g[p].toString();for(m=this.executorsByZIndex_[t],_=rs.length-1;_>=0;--_)if(d=rs[_],y=m[d],void 0!==y&&(x=y.executeHitDetection(h,a,i,f,c),x))return x}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],r=e[2],s=e[3],o=[i,n,i,s,r,s,r,n];return Ri(o,0,8,2,t,o),o}isEmpty(){return x(this.executorsByZIndex_)}execute(t,e,i,n,r,s,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?T:R),s=s||rs;const l=rs.length;for(let h=0,c=a.length;h<c;++h){const c=a[h].toString(),u=this.executorsByZIndex_[c];for(let c=0,d=s.length;c<d;++c){const d=s[c],f=u[d];if(void 0!==f){const s=null===o?void 0:f.getZIndexContext(),c=s?s.getContext():t,u=this.maxExtent_&&"Image"!==d&&"Text"!==d;if(u&&(c.save(),this.clip(c,i)),s&&"Text"!==d&&"Image"!==d?s.pushFunction(t=>f.execute(t,e,i,n,r,o)):f.execute(c,e,i,n,r,o),u&&c.restore(),s){s.offset();const t=a[h]*l+rs.indexOf(d);this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(s)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(R);for(let i=0,n=e.length;i<n;++i)t[e[i]].forEach(t=>{t.draw(this.renderedContext_),t.clear()}),t[e[i]].length=0}};function us(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}class ds{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=us(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new ds({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 G()}getImage(t){return G()}getHitDetectionImage(){return G()}getPixelRatio(t){return 1}getImageState(){return G()}getImageSize(){return G()}getOrigin(){return G()}getSize(){return G()}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_=us(t)}listenImageChange(t){G()}load(){G()}unlistenImageChange(t){G()}ready(){return Promise.resolve()}}var fs=ds;function gs(t,e,i,n){return void 0!==i&&void 0!==n?[i/t,n/e]:void 0!==i?i/t:void 0!==n?n/e:1}class ps extends fs{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,n=void 0!==t.scale?t.scale:1,r=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:n,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:r,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 s=void 0!==t.img?t.img:null;let o,a=t.src;if(V(!(void 0!==a&&s),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!s||(a=s.src||X(s)),V(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),V(!((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=0:void 0!==s&&(o="complete"in s?s.complete?s.src?2:0:1:2),this.color_=void 0!==t.color?zn(t.color):null,this.iconImage_=Un(s,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 n=this.getImage(1);if(n.width&&n.height)e=n.width,i=n.height;else if(n instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(gs(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(gs(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 ps({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?zn(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(),n=void 0!==i?null:this.getHitDetectionImage(),r=void 0!==i?0:this.iconImage_.getImageState();this.iconImage_=Un(n,i,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},r,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_=Un(null,t,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},0,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();return this.size_?this.size_[0]*t[0]:2==this.iconImage_.getImageState()?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:2==this.iconImage_.getImageState()?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(C,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(C,t)}ready(){return this.iconImage_.ready()}}var _s=ps;const ms=Mi(),ys=[NaN,NaN];var xs=class extends Y{constructor(){super(),this.extent_=[1/0,1/0,-1/0,-1/0],this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=k((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return G()}closestPointXY(t,e,i,n){return G()}containsXY(t,e){return 0===this.closestPointXY(t,e,ys,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 G()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&et(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){G()}scale(t,e,i){G()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return G()}getType(){return G()}applyTransform(t){G()}intersectsExtent(t){return G()}translate(t,e){G()}transform(t,e){const i=Ge(t),n="tile-pixels"==i.getUnits()?function(t,n,r){const s=i.getExtent(),o=i.getWorldExtent(),a=_t(o)/_t(s);Li(ms,o[0],o[3],a,-a,0,0,0);const l=Ri(t,0,t.length,r,ms,n),h=Ze(i,e);return h?h(l,l,r):l}:Ze(i,e);return this.applyTransform(n),this}};function vs(t){let e;return 2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM"),e}function Ss(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}var ws=class extends xs{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return nt(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return G()}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=Ss(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){G()}setLayout(t,e,i){let n;if(t)n=Ss(t);else{for(let t=0;t<i;++t){if(0===e.length)return this.layout="XY",void(this.stride=2);e=e[0]}n=e.length,t=vs(n)}this.layout=t,this.stride=n}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 n=this.getStride();Ti(i,0,i.length,n,t,e,i),this.changed()}}scale(t,e,i){void 0===e&&(e=t),i||(i=ft(this.getExtent()));const n=this.getFlatCoordinates();if(n){const r=this.getStride();!function(t,e,i,n,r,s,o,a){a=a||[];const l=o[0],h=o[1];let c=0;for(let e=0;e<i;e+=n){const i=t[e]-l,o=t[e+1]-h;a[c++]=l+r*i,a[c++]=h+s*o;for(let i=e+2;i<e+n;++i)a[c++]=t[i]}a&&a.length!=c&&(a.length=c)}(n,0,n.length,r,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();!function(t,e,i,n,r,s,o){o=o||[];let a=0;for(let e=0;e<i;e+=n){o[a++]=t[e]+r,o[a++]=t[e+1]+s;for(let i=e+2;i<e+n;++i)o[a++]=t[i]}o&&o.length!=a&&(o.length=a)}(i,0,i.length,n,t,e,i),this.changed()}}},Cs=class extends Qn{constructor(t,e,i,n,r,s,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?Gt(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=r,this.squaredTolerance_=s,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_=Mi()}drawImages_(t,e,i,n){if(!this.image_)return;const r=Ri(t,e,i,n,this.transform_,this.pixelCoordinates_),s=this.context_,o=this.tmpLocalTransform_,a=s.globalAlpha;1!=this.imageOpacity_&&(s.globalAlpha=a*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let t=0,e=r.length;t<e;t+=2){const e=r[t]-this.imageAnchorX_,i=r[t+1]-this.imageAnchorY_;if(0!==l||1!=this.imageScale_[0]||1!=this.imageScale_[1]){const t=e+this.imageAnchorX_,n=i+this.imageAnchorY_;Li(o,t,n,1,1,l,-t,-n),s.save(),s.transform.apply(s,o),s.translate(t,n),s.scale(this.imageScale_[0],this.imageScale_[1]),s.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),s.restore()}else s.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,e,i,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(s.globalAlpha=a)}drawText_(t,e,i,n){if(!this.textState_||""===this.text_)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const r=Ri(t,e,i,n,this.transform_,this.pixelCoordinates_),s=this.context_;let o=this.textRotation_;for(0===this.transformRotation_&&(o-=this.viewRotation_),this.textRotateWithView_&&(o+=this.viewRotation_);e<i;e+=n){const t=r[e]+this.textOffsetX_,i=r[e+1]+this.textOffsetY_;0!==o||1!=this.textScale_[0]||1!=this.textScale_[1]?(s.save(),s.translate(t-this.textOffsetX_,i-this.textOffsetY_),s.rotate(o),s.translate(this.textOffsetX_,this.textOffsetY_),s.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&s.strokeText(this.text_,0,0),this.textFillState_&&s.fillText(this.text_,0,0),s.restore()):(this.textStrokeState_&&s.strokeText(this.text_,t,i),this.textFillState_&&s.fillText(this.text_,t,i))}}moveToLineTo_(t,e,i,n,r,s){const o=this.context_;let a=Ri(t,e,i,n,this.transform_,this.pixelCoordinates_);if(Math.abs(s)>0){const t=a.length,e=r||Math.abs(a[0]-a[t-2])<1e-6&&Math.abs(a[1]-a[t-1])<1e-6;a=zr(a,0,t,2,s,e,a),Nr(a,2,e)}o.moveTo(a[0],a[1]);let l=a.length;r&&(l-=2);for(let t=2;t<l;t+=2)o.lineTo(a[t],a[t+1]);return r&&o.closePath(),i}drawRings_(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s)e=this.moveToLineTo_(t,e,i[s],n,!0,r);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),wt(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 n=t.getFlatCoordinates();if(!n)return null;const r=t.getStride();return Ri(n,0,n.length,r,e,i)}(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],n=e[3]-e[1],r=Math.sqrt(i*i+n*n),s=this.context_;s.beginPath(),s.arc(e[0],e[1],r,0,2*Math.PI),this.fillState_&&s.fill(),this.strokeState_&&s.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_)),wt(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(wt(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();let n=0;const r=t.getEnds(),s=t.getStride();e.beginPath();for(let t=0,e=r.length;t<e;++t)n=this.moveToLineTo_(i,n,r[t],s,!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_)),wt(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_)),wt(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 n=0;const r=t.getEndss(),s=t.getStride();e.beginPath();for(let t=0,e=r.length;t<e;++t){const e=r[t];n=this.drawRings_(i,n,e,s,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),P(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_,n=t.textAlign?t.textAlign:cr;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=n&&(i.textAlign=n,e.textAlign=n),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=n,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:n,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(t){const e=t.getColor();this.fillState_={fillStyle:$n(e||sr)}}else this.fillState_=null;if(e){const t=e.getColor(),i=e.getLineCap(),n=e.getLineDash(),r=e.getLineDashOffset(),s=e.getLineJoin(),o=e.getWidth(),a=e.getMiterLimit(),l=n||ar,h=e.getOffset();this.strokeState_={lineCap:void 0!==i?i:or,lineDash:1===this.pixelRatio_?l:l.map(t=>t*this.pixelRatio_),lineDashOffset:(r||0)*this.pixelRatio_,lineJoin:void 0!==s?s:lr,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:$n(t||hr),strokeOffset:(h??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_),n=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const s=t.getScaleArray();this.imageScale_=[s[0]*this.pixelRatio_/i,s[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:$n(t||sr)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),r=i.getLineDashOffset(),s=i.getLineJoin(),o=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:or,lineDash:n||ar,lineDashOffset:r||0,lineJoin:void 0!==s?s:lr,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:$n(t||hr)}}else this.textStrokeState_=null;const n=t.getFont(),r=t.getOffsetX(),s=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),l=t.getScaleArray(),h=t.getText(),c=t.getTextAlign(),u=t.getTextBaseline();this.textState_={font:void 0!==n?n:rr,textAlign:void 0!==c?c:cr,textBaseline:void 0!==u?u:ur},this.text_=void 0!==h?Array.isArray(h)?h.reduce((t,e,i)=>t+(i%2?" ":e),""):h:"",this.textOffsetX_=void 0!==r?this.pixelRatio_*r:0,this.textOffsetY_=void 0!==s?this.pixelRatio_*s:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*l[0],this.pixelRatio_*l[1]]}else this.text_=""}};const bs=.5;function Rs(t,e,i,n,r,s,o,a,l){const h=l?Je(r):r,c=_n(t[0]*bs,t[1]*bs);c.imageSmoothingEnabled=!1;const u=c.canvas,d=new Cs(c,bs,r,null,o,a,l?Ne($e(),l):null),f=i.length,g=Math.floor(16777215/f),p={};for(let t=1;t<=f;++t){const e=i[t-1],r=e.getStyleFunction()||n;if(!r)continue;let o=r(e,s);if(!o)continue;Array.isArray(o)||(o=[o]);const a=(t*g).toString(16).padStart(7,"#00000");for(let t=0,i=o.length;t<i;++t){const i=o[t],n=i.getGeometryFunction()(e);if(!n||!wt(h,n.getExtent()))continue;const r=i.clone(),s=r.getFill();s&&s.setColor(a);const l=r.getStroke();l&&(l.setColor(a),l.setLineDash(null)),r.setText(void 0);const c=i.getImage();if(c){const t=c.getImageSize();if(!t)continue;const e=_n(t[0],t[1],void 0,{alpha:!1}),i=e.canvas;e.fillStyle=a,e.fillRect(0,0,i.width,i.height),r.setImage(new _s({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=r.getZIndex()||0;let d=p[u];d||(d={},p[u]=d,d.Polygon=[],d.Circle=[],d.LineString=[],d.Point=[]);const f=n.getType();if("GeometryCollection"===f){const t=n.getGeometriesArrayRecursive();for(let e=0,i=t.length;e<i;++e){const i=t[e];d[i.getType().replace("Multi","")].push(i,r)}}else d[f.replace("Multi","")].push(n,r)}}const _=Object.keys(p).map(Number).sort(R);for(let t=0,i=_.length;t<i;++t){const i=p[_[t]];for(const t in i){const n=i[t];for(let t=0,i=n.length;t<i;t+=2){d.setStyle(n[t+1]);for(let i=0,r=e.length;i<r;++i)d.setTransform(e[i]),d.drawGeometry(n[t])}}}return c.getImageData(0,0,u.width,u.height)}function Ts(t,e,i){const n=[];if(i){const r=Math.floor(Math.round(t[0])*bs),s=Math.floor(Math.round(t[1])*bs),o=4*(Ft(r,0,i.width-1)+Ft(s,0,i.height-1)*i.width),a=i.data[o],l=i.data[o+1],h=i.data[o+2]+256*(l+256*a),c=Math.floor(16777215/e.length);h&&h%c===0&&n.push(e[h/c-1])}return n}const Es={Point:function(t,e,i,n,r,s){const o=i.getImage(),a=i.getText(),l=a&&a.getText(),h=s&&o&&l?{}:void 0;if(o){if(2!=o.getImageState())return;const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(o,h),s.drawPoint(e,n,r)}if(l){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a,h),s.drawText(e,n,r)}},LineString:function(t,e,i,n,r){const s=i.getStroke();if(s){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawLineString(e,n,r)}const o=i.getText();if(o&&o.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,n,r)}},Polygon:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(s||o){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawPolygon(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}},MultiPoint:function(t,e,i,n,r,s){const o=i.getImage(),a=o&&0!==o.getOpacity(),l=i.getText(),h=l&&l.getText(),c=s&&a&&h?{}:void 0;if(a){if(2!=o.getImageState())return;const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(o,c),s.drawMultiPoint(e,n,r)}if(h){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(l,c),s.drawText(e,n,r)}},MultiLineString:function(t,e,i,n,r){const s=i.getStroke();if(s){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawMultiLineString(e,n,r)}const o=i.getText();if(o&&o.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,n,r)}},MultiPolygon:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(o||s){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawMultiPolygon(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}},GeometryCollection:function(t,e,i,n,r,s){const o=e.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a)(0,Es[o[a].getType()])(t,o[a],i,n,r,s)},Circle:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(s||o){const a=t.getBuilder(i.getZIndex(),"Circle");a.setFillStrokeStyle(s,o),a.drawCircle(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}}};function Is(t,e){return parseInt(X(t),10)-parseInt(X(e),10)}function Ms(t,e){const i=Ps(t,e);return i*i}function Ps(t,e){return.5*t/e}function Fs(t,e,i,n,r,s,o,a){const l=[],h=i.getImage();if(h){let t=!0;const e=h.getImageState();2==e||3==e?t=!1:0==e&&h.load(),t&&l.push(h.ready())}const c=i.getFill();c&&c.loading()&&l.push(c.ready());const u=l.length>0;return u&&Promise.all(l).then(()=>r(null)),function(t,e,i,n,r,s,o){const a=i.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(n,r);i.getRenderer()?Os(t,l,i,e,o):(0,Es[l.getType()])(t,l,i,e,o,s)}(t,e,i,n,s,o,a),u}function Os(t,e,i,n,r){if("GeometryCollection"==e.getType()){const s=e.getGeometries();for(let e=0,o=s.length;e<o;++e)Os(t,s[e],i,n,r);return}t.getBuilder(i.getZIndex(),"Default").drawCustom(e,n,i.getRenderer(),i.getHitDetectionRenderer(),r)}var ks=class extends A{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}},As=class extends j{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 G()}getData(t){return null}prepareFrame(t){return G()}renderFrame(t,e){return G()}forEachFeatureAtCoordinate(t,e,i,n,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;2!==e.getState()&&3!==e.getState()||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return 2!=e&&3!=e&&t.addEventListener(C,this.boundHandleImageChange_),0==e&&(t.load(),e=t.getState()),2==e}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}};const Ls=[];let Ds=null;var js=class extends As{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=Mi(),this.pixelTransform=Mi(),this.inversePixelTransform=Mi(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){let n;Ds||(Ds=_n(1,1,void 0,{willReadFrequently:!0})),Ds.clearRect(0,0,1,1);try{Ds.drawImage(t,e,i,1,1,0,0,1,1),n=Ds.getImageData(0,0,1,1).data}catch{return Ds=null,null}return n}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i,n,r){if(vn(t)&&0===this.pixelTransform[1]&&0===this.pixelTransform[2]&&0===this.pixelTransform[4]&&0===this.pixelTransform[5]&&t.width===n&&t.height===r){const e=t,n=e.getContext("2d");if(n)return this.container=t,this.context=n,this.containerReused=!0,void(i&&(n.fillStyle=i,n.fillRect(0,0,e.width,e.height)))}const s=this.getLayer().getClassName();let o,a;if(t&&t.className===s&&(!i||t&&t.style.backgroundColor&&P(zn(t.style.backgroundColor),zn(i)))){const e=t.firstElementChild;vn(e)&&(a=e.getContext("2d"))}if(a&&function(t,e){const i=ji(t),n=ji(e);for(let t=0;t<6;++t)if(0!==Math.round((i[t]-n[t])*Di[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=gn?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){return"firstElementChild"===e?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,i)}}):document.createElement("div"),o.className=s;let t=o.style;t.position="absolute",t.width="100%",t.height="100%",a=_n();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 n=xt(i),r=vt(i),s=dt(i),o=ut(i);ki(e.coordinateToPixelTransform,n),ki(e.coordinateToPixelTransform,r),ki(e.coordinateToPixelTransform,s),ki(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;ki(a,n),ki(a,r),ki(a,s),ki(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}prepareContainer(t,e){const i=t.extent,n=t.viewState.resolution,r=t.viewState.rotation,s=t.pixelRatio,o=Math.round(St(i)/n*s),a=Math.round(_t(i)/n*s);Li(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/s,1/s,r,-o/2,-a/2),function(t,e){const i=(n=e)[0]*n[3]-n[1]*n[2];var n;V(0!==i,"Transformation matrix cannot be inverted");const r=e[0],s=e[1],o=e[2],a=e[3],l=e[4],h=e[5];t[0]=a/i,t[1]=-s/i,t[2]=-o/i,t[3]=r/i,t[4]=(o*h-a*l)/i,t[5]=-(r*h-s*l)/i}(this.inversePixelTransform,this.pixelTransform);const l="matrix("+this.pixelTransform.join(", ")+")",h=this.getBackground(t);if(this.useContainer(e,l,h,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),l!==t.style.transform&&(t.style.transform=l)}}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const r=new ks(t,this.inversePixelTransform,i,e);n.dispatchEvent(r)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(Sn,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(wn,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new Vr),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(Sn,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(wn,this.context,t))}getRenderTransform(t,e,i,n,r,s,o){const a=r/2,l=s/2,h=n/e,c=-h,u=-t[0]+o,d=-t[1];return Li(this.tempTransform,a,l,h,c,-i,u,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}},Gs=class extends js{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 n=e.extent,r=e.viewState,s=r.center,o=r.resolution,a=r.projection,l=r.rotation,h=a.getExtent(),c=this.getLayer().getSource(),u=this.getLayer().getDeclutter(),d=e.pixelRatio,f=e.viewHints,g=!(f[0]||f[1]),p=this.context,_=Math.round(St(n)/o*d),m=Math.round(_t(n)/o*d),y=c.getWrapX()&&a.canWrapX(),x=y?St(h):null,v=y?Math.ceil((n[2]-h[2])/x)+(this.extendX_?2:1):1;let S=y?Math.floor((n[0]-h[0])/x)-(this.extendX_?1:0):0;do{let n=this.getRenderTransform(s,o,0,d,_,m,S*x);e.declutter&&(n=n.slice(0)),t.execute(p,[p.canvas.width,p.canvas.height],n,l,g,void 0===i?rs:i?ss:os,i?u&&e.declutter[u]:void 0)}while(++S<v)}setDrawContext_(){1!==this.opacity_&&(this.targetContext_=this.context,this.context=_n(this.context.canvas.width,this.context.canvas.height,Ls))}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,xn(this.context),Ls.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 n=t.viewState;this.prepareContainer(t,e);const r=this.context,s=this.replayGroup_;let o=s&&!s.isEmpty();if(!o&&!this.getLayer().hasListener(Sn)&&!this.getLayer().hasListener(wn))return this.container;this.setDrawContext_(),this.preRender(r,t);n.projection;this.clipExtent_=null;let a=!1;if(o&&i.extent&&this.clipping){const e=Qe(i.extent);o=wt(e,t.extent),o&&!H(e,t.extent)&&(t.declutter?this.clipExtent_=e:(this.clipUnrotated(r,t,e),a=!0))}return o&&this.renderWorlds(s,t,!this.getLayer().getDeclutter()&&void 0),a&&r.restore(),this.postRender(r,t),this.renderedRotation_!==n.rotation&&(this.renderedRotation_=n.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_,n=this.renderedRotation_,r=this.renderedProjection_,s=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],l=t[0]*bs,h=t[1]*bs;a.push(this.getRenderTransform(e,i,n,bs,l,h,0).slice());const c=o.getSource(),u=r.getExtent();if(c.getWrapX()&&r.canWrapX()&&!H(u,s)){let t=s[0];const r=St(u);let o,c=0;for(;t<u[0];)--c,o=r*c,a.push(this.getRenderTransform(e,i,n,bs,l,h,o).slice()),t+=r;for(c=0,t=s[2];t>u[2];)++c,o=r*c,a.push(this.getRenderTransform(e,i,n,bs,l,h,o).slice()),t-=r}const d=$e();this.hitDetectionImageData_=Rs(t,a,this.renderedFeatures_,o.getStyleFunction(),s,i,n,Ms(i,this.renderedPixelRatio_),d?r:null)}e(Ts(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,n,r){if(!this.replayGroup_)return;const s=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),l={},h=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,s,o,i,function(t,e,i){const s=X(t),o=l[s];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return l[s]=!0,r.splice(r.lastIndexOf(o),1),n(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return l[s]=!0,n(t,a,e);r.push(l[s]={feature:t,layer:a,geometry:e,distanceSq:i,callback:n})}},h?e.declutter?.[h]?.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 n=t.viewHints[0],r=t.viewHints[1],s=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!s&&n||!o&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,l=t.viewState,h=l.projection,c=l.resolution,u=t.pixelRatio,d=e.getRevision(),f=e.getRenderBuffer();let g=e.getRenderOrder();void 0===g&&(g=Is);const p=l.center.slice(),_=K(a,f*c),m=_.slice(),y=[_.slice()],x=h.getExtent(),v=i.getWrapX()&&h.canWrapX();if(this.extendX_=!1,v){const t=i.getExtent();t&&!Ct(t)&&(this.extendX_=t[0]<x[0]||t[2]>x[2])}if(v&&(!H(x,t.extent)||this.extendX_)){const t=St(x),e=Math.max(St(_)/2,t);let i=x[0],n=x[2];this.extendX_&&(i-=t,n+=t),_[0]=i-e,_[2]=n+e,Nt(p,h);const r=bt(y[0],h);r[0]<x[0]&&r[2]<x[2]?y.push([r[0]+t,r[1],r[2]+t,r[3]]):r[0]>x[0]&&r[2]>x[2]&&y.push([r[0]-t,r[1],r[2]-t,r[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedPixelRatio_===u&&this.renderedRevision_==d&&this.renderedRenderOrder_==g&&this.renderedFrameDeclutter_===!!t.declutter&&H(this.wrappedRenderedExtent_,_))return P(this.renderedExtent_,m)||(this.hitDetectionImageData_=null,this.renderedExtent_=m),this.renderedCenter_=p,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const S=new Wr(Ps(c,u),_,c,u),w=$e();let C;if(w){for(let t=0,e=y.length;t<e;++t){const e=Je(y[t]);i.loadFeatures(e,ti(c),w)}C=Ne(w,h)}else for(let t=0,e=y.length;t<e;++t)i.loadFeatures(y[t],c,h);const b=Ms(c,u);let R=!0;const T=(t,i)=>{let n;const r=t.getStyleFunction()||e.getStyleFunction();if(r&&(n=r(t,c)),n){const e=this.renderFeature(t,b,n,S,C,this.getLayer().getDeclutter(),i);R=R&&!e}},E=Je(_),I=i.getFeaturesInExtent(E);g&&I.sort(g);for(let t=0,e=I.length;t<e;++t)T(I[t],t);this.renderedFeatures_=I,this.ready=R;const M=S.finish(),F=new cs(_,c,u,i.getOverlaps(),M,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=c,this.renderedRevision_=d,this.renderedRenderOrder_=g,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=m,this.wrappedRenderedExtent_=_,this.renderedCenter_=p,this.renderedProjection_=h,this.renderedPixelRatio_=u,this.replayGroup_=F,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,n,r,s,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let l=0,h=i.length;l<h;++l)a=Fs(n,t,i[l],e,this.boundHandleStyleImageChange_,r,s,o)||a;else a=Fs(n,t,i,e,this.boundHandleStyleImageChange_,r,s,o);return a}};let Ws=0;const Xs=1<<Ws++,zs=1<<Ws++,Ys=1<<Ws++,Ns=1<<Ws++,Bs=1<<Ws++,Zs=1<<Ws++,Vs=Math.pow(2,6)-1,Us={[Xs]:"boolean",[zs]:"number",[Ys]:"string",[Ns]:"color",[Bs]:"number[]",[Zs]:"size"},Ks=Object.keys(Us).map(Number).sort(R);function $s(t){const e=[];for(const i of Ks)qs(t,i)&&e.push(Us[i]);return 0===e.length?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function qs(t,e){return(t&e)===e}function Hs(t,e){return!!(t&e)}function Js(t,e){return t===e}class Qs{constructor(t,e){if(!function(t){return t in Us}(t))throw new Error(`literal expressions must have a specific type, got ${$s(t)}`);this.type=t,this.value=e}}class to{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function eo(t){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:t}}function io(t,e,i){switch(typeof t){case"boolean":if(Js(e,Ys))return new Qs(Ys,t?"true":"false");if(!qs(e,Xs))throw new Error(`got a boolean, but expected ${$s(e)}`);return new Qs(Xs,t);case"number":if(Js(e,Zs))return new Qs(Zs,us(t));if(Js(e,Xs))return new Qs(Xs,!!t);if(Js(e,Ys))return new Qs(Ys,t.toString());if(!qs(e,zs))throw new Error(`got a number, but expected ${$s(e)}`);return new Qs(zs,t);case"string":if(Js(e,Ns))return new Qs(Ns,Xn(t));if(Js(e,Xs))return new Qs(Xs,!!t);if(!qs(e,Ys))throw new Error(`got a string, but expected ${$s(e)}`);return new Qs(Ys,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 n=t[0],r=Ho[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(t,e,i)}(t,e,i);for(const e of t)if("number"!=typeof e)throw new Error("expected an array of numbers");if(Js(e,Zs)){if(2!==t.length)throw new Error(`expected an array of two values for a size, got ${t.length}`);return new Qs(Zs,t)}if(Js(e,Ns)){if(3===t.length)return new Qs(Ns,[...t,1]);if(4===t.length)return new Qs(Ns,t);throw new Error(`expected an array of 3 or 4 values for a color, got ${t.length}`)}if(!qs(e,Bs))throw new Error(`got an array of numbers, but expected ${$s(e)}`);return new Qs(Bs,t)}const no="get",ro="var",so="concat",oo="geometry-type",ao="line-metric",lo="any",ho="all",co="!",uo="resolution",fo="zoom",go="time",po="==",_o="!=",mo=">",yo=">=",xo="<",vo="<=",So="*",wo="/",Co="+",bo="-",Ro="clamp",To="%",Eo="^",Io="abs",Mo="floor",Po="ceil",Fo="round",Oo="sin",ko="cos",Ao="atan",Lo="sqrt",Do="match",jo="between",Go="interpolate",Wo="coalesce",Xo="case",zo="in",Yo="number",No="string",Bo="array",Zo="color",Vo="id",Uo="band",Ko="palette",$o="to-string",qo="has",Ho={[no]:oa(ea(1,1/0),Jo),[ro]:function(t,e,i){const n=t[1];if("string"!=typeof n)throw new Error("expected a string argument for var operation");let r=e;const s=i.inputVariables?.[n];if(void 0!==s){const t=io(s,Vs,i);if(!(t instanceof Qs))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let o=t.type;if("string"==typeof s&&Hs(r,Ns)&&!Hs(r,Ys)?o=Ns:Array.isArray(s)&&2===s.length&&Hs(r,Zs)&&!Hs(r,Bs)&&(o=Zs),r&=o,0===r)throw new Error(`the type expected from the var operator (${$s(e)}) did not have any overlap with the type of the corresponding style variables (${$s(o)}), variable name: ${n}`)}if(i.variables.has(n)){const t=i.variables.get(n);if(r&=t,0===r)throw new Error(`a new type expected from the var operator (${$s(e)}) did not have any overlap with the previous type expected for it (${$s(t)}), variable name: ${n}`)}return i.variables.set(n,r),new to(r,"var",new Qs(Ys,n))},[qo]:oa(ea(1,1/0),Jo),[Vo]:oa(function(t,e,i){i.featureId=!0},ta),[so]:oa(ea(2,1/0),na(Ys)),[oo]:oa(function(t,e,i){i.geometryType=!0},ta),[ao]:oa(function(t,e,i){i.mCoordinate=!0},ta),[uo]:oa(Qo,ta),[fo]:oa(Qo,ta),[go]:oa(Qo,ta),[lo]:oa(ea(2,1/0),na(Xs)),[ho]:oa(ea(2,1/0),na(Xs)),[co]:oa(ea(1,1),na(Xs)),[po]:oa(ea(2,2),ra()),[_o]:oa(ea(2,2),ra()),[mo]:oa(ea(2,2),na(zs)),[yo]:oa(ea(2,2),na(zs)),[xo]:oa(ea(2,2),na(zs)),[vo]:oa(ea(2,2),na(zs)),[So]:oa(ea(2,1/0),ia),[Wo]:oa(ea(2,1/0),ia),[wo]:oa(ea(2,2),na(zs)),[Co]:oa(ea(2,1/0),na(zs)),[bo]:oa(ea(2,2),na(zs)),[Ro]:oa(ea(3,3),na(zs)),[To]:oa(ea(2,2),na(zs)),[Eo]:oa(ea(2,2),na(zs)),[Io]:oa(ea(1,1),na(zs)),[Mo]:oa(ea(1,1),na(zs)),[Po]:oa(ea(1,1),na(zs)),[Fo]:oa(ea(1,1),na(zs)),[Oo]:oa(ea(1,1),na(zs)),[ko]:oa(ea(1,1),na(zs)),[Ao]:oa(ea(1,2),na(zs)),[Lo]:oa(ea(1,1),na(zs)),[Do]:oa(ea(4,1/0),sa,function(t,e,i){const n=t.length-1,r=io(t[t.length-1],e,i);let s=Ys|zs|Xs;const o=new Array(n-2);for(let e=0;e<n-2;e+=2){try{s&=io(t[e+2],s,i).type}catch(t){throw new Error(`failed to parse argument ${e+1} of match expression: ${t.message}`)}if(0===s)throw new Error("no common type was found among the arguments of match expression")}for(let e=0;e<n-2;e+=2){try{const n=io(t[e+2],s,i);o[e]=n}catch(t){throw new Error(`failed to parse argument ${e+1} of match expression: ${t.message}`)}try{const n=io(t[e+3],r.type,i);o[e+1]=n}catch(t){throw new Error(`failed to parse argument ${e+2} of match expression: ${t.message}`)}}return[io(t[1],s,i),...o,r]}),[jo]:oa(ea(3,3),na(zs)),[Go]:oa(ea(6,1/0),sa,function(t,e,i){const n=t[1];let r;switch(n[0]){case"linear":r=1;break;case"exponential":const t=n[1];if("number"!=typeof t||t<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(t)} instead`);r=t;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}const s=new Qs(zs,r);let o;try{o=io(t[2],zs,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 n=0;n<a.length;n+=2){try{const e=io(t[n+3],zs,i);a[n]=e}catch(t){throw new Error(`failed to parse argument ${n+2} for interpolate expression: ${t.message}`)}try{const r=io(t[n+4],e,i);a[n+1]=r}catch(t){throw new Error(`failed to parse argument ${n+3} for interpolate expression: ${t.message}`)}}return[s,o,...a]}),[Xo]:oa(ea(3,1/0),function(t,e,i){const n=t[0],r=t.length-1;if(r%2==0)throw new Error(`expected an odd number of arguments for ${n}, got ${r} instead`)},function(t,e,i){const n=io(t[t.length-1],e,i),r=new Array(t.length-1);for(let e=0;e<r.length-1;e+=2){try{const n=io(t[e+1],Xs,i);r[e]=n}catch(t){throw new Error(`failed to parse argument ${e} of case expression: ${t.message}`)}try{const s=io(t[e+2],n.type,i);r[e+1]=s}catch(t){throw new Error(`failed to parse argument ${e+1} of case expression: ${t.message}`)}}return r[r.length-1]=n,r}),[zo]:oa(ea(2,2),function(t,e,i){let n,r=t[2];if(!Array.isArray(r))throw new Error('the second argument for the "in" operator must be an array');if("literal"===r[0]){if(r=r[1],!Array.isArray(r))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if("string"==typeof r[0])throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');n="string"==typeof r[0]?Ys:zs;const s=new Array(r.length);for(let t=0;t<s.length;t++)try{const e=io(r[t],n,i);s[t]=e}catch(e){throw new Error(`failed to parse haystack item ${t} for "in" expression: ${e.message}`)}return[io(t[1],n,i),...s]}),[Yo]:oa(ea(1,1/0),na(Vs)),[No]:oa(ea(1,1/0),na(Vs)),[Bo]:oa(ea(1,1/0),na(zs)),[Zo]:oa(ea(1,4),na(zs)),[Uo]:oa(ea(1,3),na(zs)),[Ko]:oa(ea(2,2),function(t,e,i){let n;try{n=io(t[1],zs,i)}catch(t){throw new Error(`failed to parse first argument in palette expression: ${t.message}`)}const r=t[2];if(!Array.isArray(r))throw new Error("the second argument of palette must be an array");const s=new Array(r.length);for(let t=0;t<s.length;t++){let e;try{e=io(r[t],Ns,i)}catch(e){throw new Error(`failed to parse color at index ${t} in palette expression: ${e.message}`)}if(!(e instanceof Qs))throw new Error(`the palette color at index ${t} must be a literal value`);s[t]=e}return[n,...s]}),[$o]:oa(ea(1,1),na(Xs|zs|Ys|Ns))};function Jo(t,e,i){const n=t.length-1,r=new Array(n);for(let s=0;s<n;++s){const n=t[s+1];switch(typeof n){case"number":r[s]=new Qs(zs,n);break;case"string":r[s]=new Qs(Ys,n);break;default:throw new Error(`expected a string key or numeric array index for a get operation, got ${n}`)}0===s&&i.properties.set(String(n),e)}return r}function Qo(t,e,i){i.mapState=!0}function ta(t,e,i){const n=t[0];if(1!==t.length)throw new Error(`expected no arguments for ${n} operation`);return[]}function ea(t,e){return function(i,n,r){const s=i[0],o=i.length-1;if(t===e){if(o!==t)throw new Error(`expected ${t} argument${1===t?"":"s"} for ${s}, got ${o}`)}else if(o<t||o>e)throw new Error(`expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${s}, got ${o}`)}}function ia(t,e,i){const n=t.length-1,r=new Array(n);for(let s=0;s<n;++s){const n=io(t[s+1],e,i);r[s]=n}return r}function na(t){return function(e,i,n){const r=e.length-1,s=new Array(r);for(let i=0;i<r;++i){const r=io(e[i+1],t,n);s[i]=r}return s}}function ra(){return function(t,e,i){const n=t[0],r=t.length-1,s=new Array(r);let o=Vs;for(let e=0;e<r;++e)o&=io(t[e+1],o,i).type;if(0===o)throw new Error(`no common type was found among the arguments of ${n}`);for(let e=0;e<r;++e){const n=io(t[e+1],o,i);s[e]=n}return s}}function sa(t,e,i){const n=t[0],r=t.length-1;if(r%2==1)throw new Error(`expected an even number of arguments for operation ${n}, got ${r} instead`)}function oa(...t){return function(e,i,n){const r=e[0];let s;for(let r=0;r<t.length;r++){const o=t[r](e,i,n);if(r==t.length-1){if(!o)throw new Error("expected last argument validator to return the parsed args");s=o}}return new to(i,r,...s)}}function aa(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 aa(t.getGeometries()[0]);default:return""}}function la(t,e,i){return ha(io(t,e,i),i)}function ha(t,e){if(t instanceof Qs){if(t.type===Ns&&"string"==typeof t.value){const e=Xn(t.value);return function(){return e}}return function(){return t.value}}const i=t.operator;switch(i){case Yo:case No:case Wo:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=ha(t.args[i],e);switch(i){case Wo:return t=>{for(let e=0;e<n;++e){const i=r[e](t);if(null!=i)return i}throw new Error("Expected one of the values to be non-null")};case Yo:case No:return t=>{for(let e=0;e<n;++e){const n=r[e](t);if(typeof n===i)return n}throw new Error(`Expected one of the values to be a ${i}`)};default:throw new Error(`Unsupported assertion operator ${i}`)}}(t,e);case no:case ro:case qo:return function(t){const e=t.args[0].value;switch(t.operator){case no:return i=>{const n=t.args;let r=i.properties[e];for(let t=1,e=n.length;t<e;++t)r=r[n[t].value];return r};case ro:return t=>t.variables[e];case qo:return i=>{const n=t.args;if(!(e in i.properties))return!1;let r=i.properties[e];for(let t=1,e=n.length;t<e;++t){const e=n[t].value;if(!r||!Object.hasOwn(r,e))return!1;r=r[e]}return!0};default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}(t);case"id":return t=>t.featureId;case oo:return t=>t.geometryType;case so:{const i=t.args.map(t=>ha(t,e));return t=>"".concat(...i.map(e=>e(t).toString()))}case uo:return t=>t.resolution;case lo:case ho:case jo:case zo:case"!":return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=ha(t.args[i],e);switch(i){case lo:return t=>{for(let e=0;e<n;++e)if(r[e](t))return!0;return!1};case ho:return t=>{for(let e=0;e<n;++e)if(!r[e](t))return!1;return!0};case jo:return t=>{const e=r[0](t),i=r[1](t),n=r[2](t);return e>=i&&e<=n};case zo:return t=>{const e=r[0](t);for(let i=1;i<n;++i)if(e===r[i](t))return!0;return!1};case"!":return t=>!r[0](t);default:throw new Error(`Unsupported logical operator ${i}`)}}(t,e);case po:case _o:case"<":case vo:case">":case yo:return function(t,e){const i=t.operator,n=ha(t.args[0],e),r=ha(t.args[1],e);switch(i){case po:return t=>n(t)===r(t);case _o:return t=>n(t)!==r(t);case"<":return t=>n(t)<r(t);case vo:return t=>n(t)<=r(t);case">":return t=>n(t)>r(t);case yo:return t=>n(t)>=r(t);default:throw new Error(`Unsupported comparison operator ${i}`)}}(t,e);case"*":case"/":case"+":case"-":case Ro:case"%":case"^":case Io:case Mo:case Po:case Fo:case Oo:case ko:case Ao:case Lo:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=ha(t.args[i],e);switch(i){case"*":return t=>{let e=1;for(let i=0;i<n;++i)e*=r[i](t);return e};case"/":return t=>r[0](t)/r[1](t);case"+":return t=>{let e=0;for(let i=0;i<n;++i)e+=r[i](t);return e};case"-":return t=>r[0](t)-r[1](t);case Ro:return t=>{const e=r[0](t),i=r[1](t);if(e<i)return i;const n=r[2](t);return e>n?n:e};case"%":return t=>r[0](t)%r[1](t);case"^":return t=>Math.pow(r[0](t),r[1](t));case Io:return t=>Math.abs(r[0](t));case Mo:return t=>Math.floor(r[0](t));case Po:return t=>Math.ceil(r[0](t));case Fo:return t=>Math.round(r[0](t));case Oo:return t=>Math.sin(r[0](t));case ko:return t=>Math.cos(r[0](t));case Ao:return 2===n?t=>Math.atan2(r[0](t),r[1](t)):t=>Math.atan(r[0](t));case Lo:return t=>Math.sqrt(r[0](t));default:throw new Error(`Unsupported numeric operator ${i}`)}}(t,e);case Xo:return function(t,e){const i=t.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=ha(t.args[r],e);return t=>{for(let e=0;e<i-1;e+=2)if(n[e](t))return n[e+1](t);return n[i-1](t)}}(t,e);case Do:return function(t,e){const i=t.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=ha(t.args[r],e);return t=>{const e=n[0](t);for(let r=1;r<i-1;r+=2)if(e===n[r](t))return n[r+1](t);return n[i-1](t)}}(t,e);case Go:return function(t,e){const i=t.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=ha(t.args[r],e);return t=>{const e=n[0](t),r=n[1](t);let s,o;for(let a=2;a<i;a+=2){const i=n[a](t);let l=n[a+1](t);const h=Array.isArray(l);if(h&&(l=An(l)),i>=r)return 2===a?l:h?ua(e,r,s,o,i,l):ca(e,r,s,o,i,l);s=i,o=l}return o}}(t,e);case $o:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=ha(t.args[i],e);if(i===$o)return e=>{const i=r[0](e);return t.args[0].type===Ns?Yn(i):i.toString()};throw new Error(`Unsupported convert operator ${i}`)}(t,e);default:throw new Error(`Unsupported operator ${i}`)}}function ca(t,e,i,n,r,s){const o=r-i;if(0===o)return n;const a=e-i;return n+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(s-n)}function ua(t,e,i,n,r,s){if(0===r-i)return n;const o=Wn(n),a=Wn(s);let l=a[2]-o[2];return l>180?l-=360:l<-180&&(l+=360),function(t){const e=(t[0]+16)/116,i=t[1],n=t[2]*Math.PI/180,r=Dn(e),s=Dn(e+i/500*Math.cos(n)),o=Dn(e-i/200*Math.sin(n)),a=Ln(3.021973625*s-1.617392459*r-.404875592*o),l=Ln(-.943766287*s+1.916279586*r+.027607165*o),h=Ln(.069407491*s-.22898585*r+1.159737864*o);return[Ft(a+.5|0,0,255),Ft(l+.5|0,0,255),Ft(h+.5|0,0,255),t[3]]}([ca(t,e,i,o[0],r,a[0]),ca(t,e,i,o[1],r,a[1]),o[2]+ca(t,e,i,0,r,l),ca(t,e,i,n[3],r,s[3])])}class da extends fs{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()?1:2,1===this.imageState_&&this.ready().then(()=>this.imageState_=2),this.render()}clone(){const t=this.getScale(),e=new da({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 n=Bn.get(i,null)?.getImage(1);if(!n){const e=this.renderOptions_,r=Math.ceil(e.size*t),s=_n(r,r);this.draw_(e,s,t),n=s.canvas;const o=new Kn(n,void 0,null,2,null);Bn.set(i,null,o),createImageBitmap(n).then(t=>{o.setImage(t)})}return n}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 n=this.radius,r=void 0===this.radius2_?n:this.radius2_;if(n<r){const t=n;n=r,r=t}const s=void 0===this.radius2_?this.points_:2*this.points_,o=2*Math.PI/s,a=r*Math.sin(o),l=n-Math.sqrt(r*r-a*a),h=Math.sqrt(a*a+l*l),c=h/a;if("miter"===t&&c<=i)return c*e;const u=e/2/c,d=e/2*(l/h),f=Math.sqrt((n+u)*(n+u)+d*d)-n;if(void 0===this.radius2_||"bevel"===t)return 2*f;const g=n*Math.sin(o),p=r-Math.sqrt(n*n-g*g),_=Math.sqrt(g*g+p*p)/g;if(_<=i){const t=_*e/2-r-n;return 2*Math.max(f,t)}return 2*f}createRenderOptions(){let t,e=or,i=lr,n=0,r=null,s=0,o=0;this.stroke_&&(t=$n(this.stroke_.getColor()??hr),o=this.stroke_.getWidth()??1,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,i=this.stroke_.getLineJoin()??lr,e=this.stroke_.getLineCap()??or,n=this.stroke_.getMiterLimit()??10);const a=this.calculateLineJoinSize_(i,o,n),l=Math.max(this.radius,this.radius2_||0);return{strokeStyle:t,strokeWidth:o,size:Math.ceil(2*l+a),lineCap:e,lineDash:r,lineDashOffset:s,lineJoin:i,miterLimit:n}}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=sr),e.fillStyle=$n(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(),n=0;"string"==typeof i&&(i=zn(i)),null===i?n=1:Array.isArray(i)&&(n=4===i.length?i[3]:1),0===n&&(e=_n(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 n=void 0===this.radius2_?i:this.radius2_;void 0!==this.radius2_&&(e*=2);const r=this.angle_-Math.PI/2,s=2*Math.PI/e;for(let o=0;o<e;o++){const e=r+o*s,a=o%2==0?i:n;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=sr,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()}}var fa=da;class ga extends fa{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 ga({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}}var pa=ga;class _a{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 _a({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=Un(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}),0===e.getImageState()&&e.load(),1===e.getImageState()&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?X(t):"object"==typeof t&&"src"in t?t.src+":"+t.offset:zn(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}var ma=_a;class ya{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 ya({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}}var xa=ya;class va{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=Ca,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 va({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_=Ca,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let Sa=null;function wa(t,e){if(!Sa){const t=new ma({color:"rgba(255,255,255,0.4)"}),e=new xa({color:"#3399CC",width:1.25});Sa=[new va({image:new pa({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return Sa}function Ca(t){return t.getGeometry()}var ba=va;class Ra{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_=us(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 ma({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 Ra({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 ma?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_=us(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}}var Ta=Ra;function Ea(t){return!0}function Ia(t,e){e=e??eo();const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=Ma(t[r],e);const r={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""},s=new Array(i);return function(t,o){if(r.properties=t.getPropertiesInternal(),r.resolution=o,e.featureId){const e=t.getId();r.featureId=void 0!==e?e:null}e.geometryType&&(r.geometryType=aa(t.getGeometry()));let a=0;for(let t=0;t<i;++t){const e=n[t](r);e&&(s[a]=e,a+=1)}return s.length=a,s}}function Ma(t,e){const i=Pa(t,"",e),n=Fa(t,"",e),r=function(t,e){const i="text-",n=Aa(t,i+"value",e);if(!n)return null;const r=Pa(t,i,e),s=Pa(t,i+"background-",e),o=Fa(t,i,e),a=Fa(t,i+"background-",e),l=Aa(t,i+"font",e),h=ka(t,i+"max-angle",e),c=ka(t,i+"offset-x",e),u=ka(t,i+"offset-y",e),d=La(t,i+"overflow",e),f=Aa(t,i+"placement",e),g=ka(t,i+"repeat",e),p=Xa(t,i+"scale",e),_=La(t,i+"rotate-with-view",e),m=ka(t,i+"rotation",e),y=Aa(t,i+"align",e),x=Aa(t,i+"justify",e),v=Aa(t,i+"baseline",e),S=La(t,i+"keep-upright",e),w=ja(t,i+"padding",e),C=Ba(t,i+"declutter-mode"),b=new Ta({declutterMode:C});return function(t){if(b.setText(n(t)),r&&b.setFill(r(t)),s&&b.setBackgroundFill(s(t)),o&&b.setStroke(o(t)),a&&b.setBackgroundStroke(a(t)),l&&b.setFont(l(t)),h&&b.setMaxAngle(h(t)),c&&b.setOffsetX(c(t)),u&&b.setOffsetY(u(t)),d&&b.setOverflow(d(t)),f){const e=f(t);if("point"!==e&&"line"!==e)throw new Error("Expected point or line for text-placement");b.setPlacement(e)}if(g&&b.setRepeat(g(t)),p&&b.setScale(p(t)),_&&b.setRotateWithView(_(t)),m&&b.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");b.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");b.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");b.setTextBaseline(e)}return w&&b.setPadding(w(t)),S&&b.setKeepUpright(S(t)),b}}(t,e),s=function(t,e){return"icon-src"in t?function(t,e){const i="icon-",n=i+"src",r=Va(t[n],n),s=Ga(t,i+"anchor",e),o=Xa(t,i+"scale",e),a=ka(t,i+"opacity",e),l=Ga(t,i+"displacement",e),h=ka(t,i+"rotation",e),c=La(t,i+"rotate-with-view",e),u=Ya(t,i+"anchor-origin"),d=Na(t,i+"anchor-x-units"),f=Na(t,i+"anchor-y-units"),g=Oa(t,i+"color");let p,_=null;void 0!==g&&(Array.isArray(g)&&g.length>0&&"string"==typeof g[0]?_=Da(t,i+"color",e):p=Ka(g,i+"color"));const m=function(t,e){const i=t[e];if(void 0!==i){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 Za(i,e)}(t,i+"offset"),x=Ya(t,i+"offset-origin"),v=za(t,i+"width"),S=za(t,i+"height"),w=function(t,e){const i=t[e];if(void 0!==i){if("number"==typeof i)return us(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"),C={src:r,anchorOrigin:u,anchorXUnits:d,anchorYUnits:f,crossOrigin:m,offset:y,offsetOrigin:x,height:S,width:v,size:w,declutterMode:Ba(t,i+"declutter-mode")};let b=null;return function(t){if(b)_&&b.setColor(_(t));else{const e=_?_(t):p;b=new _s(void 0!==e?Object.assign({},C,{color:e}):Object.assign({},C))}return a&&b.setOpacity(a(t)),l&&b.setDisplacement(l(t)),h&&b.setRotation(h(t)),c&&b.setRotateWithView(c(t)),o&&b.setScale(o(t)),s&&b.setAnchor(s(t)),b}}(t,e):"shape-points"in t?function(t,e){const i="shape-",n=i+"points",r=i+"radius",s=Ua(t[n],n);if(!(r in t))throw new Error(`Expected a number for ${r}`);const o=ka(t,r,e),a="number"==typeof t[r]?t[r]:5,l=i+"radius2",h=ka(t,l,e),c="number"==typeof t[l]?t[l]:void 0,u=Pa(t,i,e),d=Fa(t,i,e),f=Xa(t,i+"scale",e),g=Ga(t,i+"displacement",e),p=ka(t,i+"rotation",e),_=La(t,i+"rotate-with-view",e),m=za(t,i+"angle"),y=Ba(t,i+"declutter-mode"),x=new fa({points:s,radius:a,radius2:c,angle:m,declutterMode:y});return function(t){return o&&x.setRadius(o(t)),h&&x.setRadius2(h(t)),u&&x.setFill(u(t)),d&&x.setStroke(d(t)),g&&x.setDisplacement(g(t)),p&&x.setRotation(p(t)),_&&x.setRotateWithView(_(t)),f&&x.setScale(f(t)),x}}(t,e):"circle-radius"in t?function(t,e){const i="circle-",n=Pa(t,i,e),r=Fa(t,i,e),s=ka(t,i+"radius",e),o=Xa(t,i+"scale",e),a=Ga(t,i+"displacement",e),l=ka(t,i+"rotation",e),h=La(t,i+"rotate-with-view",e),c=Ba(t,i+"declutter-mode"),u=new pa({radius:5,declutterMode:c});return function(t){return s&&u.setRadius(s(t)),n&&u.setFill(n(t)),r&&u.setStroke(r(t)),a&&u.setDisplacement(a(t)),l&&u.setRotation(l(t)),h&&u.setRotateWithView(h(t)),o&&u.setScale(o(t)),u}}(t,e):null}(t,e),o=ka(t,"z-index",e);if(!(i||n||r||s||x(t)))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(t));const a=new ba;return function(t){let e=!0;if(i){const n=i(t);n&&(e=!1),a.setFill(n)}if(n){const i=n(t);i&&(e=!1),a.setStroke(i)}if(r){const i=r(t);i&&(e=!1),a.setText(i)}if(s){const i=s(t);i&&(e=!1),a.setImage(i)}return o&&a.setZIndex(o(t)),e?null:a}}function Pa(t,e,i){let n;if(e+"fill-pattern-src"in t)n=function(t,e,i){const n=Aa(t,e+"pattern-src",i),r=Wa(t,e+"pattern-offset",i),s=Wa(t,e+"pattern-size",i),o=Da(t,e+"color",i);return function(t){return{src:n(t),offset:r&&r(t),size:s&&s(t),color:o&&o(t)}}}(t,e+"fill-",i);else{if("none"===t[e+"fill-color"])return t=>null;n=Da(t,e+"fill-color",i)}if(!n)return null;const r=new ma;return function(t){const e=n(t);return e===Cn?null:(r.setColor(e),r)}}function Fa(t,e,i){const n=ka(t,e+"stroke-width",i),r=Da(t,e+"stroke-color",i);if(!n&&!r)return null;const s=Aa(t,e+"stroke-line-cap",i),o=Aa(t,e+"stroke-line-join",i),a=ja(t,e+"stroke-line-dash",i),l=ka(t,e+"stroke-line-dash-offset",i),h=ka(t,e+"stroke-miter-limit",i),c=ka(t,e+"stroke-offset",i),u=new xa;return function(t){if(r){const e=r(t);if(e===Cn)return null;u.setColor(e)}if(n&&u.setWidth(n(t)),s){const e=s(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)),l&&u.setLineDashOffset(l(t)),h&&u.setMiterLimit(h(t)),c&&u.setOffset(c(t)),u}}function Oa(t,e){if(!(e in t))return;const i=t[e];return void 0===i?void 0:i}function ka(t,e,i){const n=Oa(t,e);if(void 0===n)return;const r=la(n,zs,i);return function(t){return Ua(r(t),e)}}function Aa(t,e,i){const n=Oa(t,e);if(void 0===n)return null;const r=la(n,Ys,i);return function(t){return Va(r(t),e)}}function La(t,e,i){const n=Oa(t,e);if(void 0===n)return null;const r=la(n,Xs,i);return function(t){const i=r(t);if("boolean"!=typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function Da(t,e,i){const n=Oa(t,e);if(void 0===n)return null;const r=la(n,Ns,i);return function(t){return Ka(r(t),e)}}function ja(t,e,i){const n=Oa(t,e);if(void 0===n)return null;if(Array.isArray(n)&&(0===n.length||"string"!=typeof n[0])){const t=n.map((t,n)=>{if("number"==typeof t)return()=>t;const r=la(t,zs,i);return function(t){return Ua(r(t),`${e}[${n}]`)}});return function(e){const i=new Array(t.length);for(let n=0;n<t.length;++n)i[n]=t[n](e);return i}}const r=la(n,Bs,i);return function(t){return Za(r(t),e)}}function Ga(t,e,i){const n=Oa(t,e);if(void 0===n)return null;const r=la(n,Bs,i);return function(t){const i=Za(r(t),e);if(2!==i.length)throw new Error(`Expected two numbers for ${e}`);return i}}function Wa(t,e,i){const n=Oa(t,e);if(void 0===n)return null;const r=la(n,Bs,i);return function(t){return $a(r(t),e)}}function Xa(t,e,i){const n=Oa(t,e);if(void 0===n)return null;const r=la(n,Bs|zs,i);return function(t){return i=r(t),n=e,"number"==typeof i?i:$a(i,n);var i,n}}function za(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 Ya(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 Na(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 Ba(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 Za(t,e){if(!Array.isArray(t))throw new Error(`Expected an array for ${e}`);const i=t.length;for(let n=0;n<i;++n)if("number"!=typeof t[n])throw new Error(`Expected an array of numbers for ${e}`);return t}function Va(t,e){if("string"!=typeof t)throw new Error(`Expected a string for ${e}`);return t}function Ua(t,e){if("number"!=typeof t)throw new Error(`Expected a number for ${e}`);return t}function Ka(t,e){if("string"==typeof t)return t;const i=Za(t,e),n=i.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function $a(t,e){const i=Za(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}var qa={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function Ha(t,e,i){return function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;const l=e?0:s[0]*r,h=e?0:s[1]*r,c=a?a[0]:0,u=a?a[1]:0;let d=t[0]+l/2+c,f=t[2]-l/2+c,g=t[1]+h/2+u,p=t[3]-h/2+u;d>f&&(d=(f+d)/2,f=d),g>p&&(g=(p+g)/2,p=g);let _=Ft(n[0],d,f),m=Ft(n[1],g,p);if(o&&i&&r){const t=30*r;_+=-t*Math.log(1+Math.max(0,d-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-f)/t),m+=-t*Math.log(1+Math.max(0,g-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-p)/t)}return[_,m]}}function Ja(t){return t}function Qa(t){return Math.pow(t,3)}function tl(t){return 1-Qa(1-t)}function el(t){return 3*t*t-2*t*t*t}function il(t,e,i,n){let r=0;const s=t[i-n],o=t[i-n+1];let a=0,l=0;for(;e<i;e+=n){const i=t[e]-s,n=t[e+1]-o;r+=l*i-a*n,a=i,l=n}return r/2}function nl(t,e,i,n){let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s];r+=il(t,e,o,n),e=o}return r}function rl(t,e,i,n,r,s,o){const a=t[e],l=t[e+1],h=t[i]-a,c=t[i+1]-l;let u;if(0===h&&0===c)u=e;else{const d=((r-a)*h+(s-l)*c)/(h*h+c*c);if(d>1)u=i;else{if(d>0){for(let r=0;r<n;++r)o[r]=jt(t[e+r],t[i+r],d);return void(o.length=n)}u=e}}for(let e=0;e<n;++e)o[e]=t[u+e];o.length=n}function sl(t,e,i,n,r){let s=t[e],o=t[e+1];for(e+=n;e<i;e+=n){const i=t[e],n=t[e+1],a=kt(s,o,i,n);a>r&&(r=a),s=i,o=n}return r}function ol(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];r=sl(t,e,o,n,r),e=o}return r}function al(t,e,i,n,r,s,o,a,l,h,c){if(e==i)return h;let u,d;if(0===r){if(d=kt(o,a,t[e],t[e+1]),d<h){for(u=0;u<n;++u)l[u]=t[e+u];return l.length=n,d}return h}c=c||[NaN,NaN];let f=e+n;for(;f<i;)if(rl(t,f-n,f,n,o,a,c),d=kt(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<n;++u)l[u]=c[u];l.length=n,f+=n}else f+=n*Math.max((Math.sqrt(d)-Math.sqrt(h))/r|0,1);if(s&&(rl(t,i-n,e,n,o,a,c),d=kt(o,a,c[0],c[1]),d<h)){for(h=d,u=0;u<n;++u)l[u]=c[u];l.length=n}return h}function ll(t,e,i,n,r,s,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=i.length;u<d;++u){const d=i[u];h=al(t,e,d,n,r,s,o,a,l,h,c),e=d}return h}function hl(t,e,i,n){for(let r=0,s=i.length;r<s;++r){const s=i[r];for(let i=0;i<n;++i)t[e++]=s[i]}return e}function cl(t,e,i,n,r){r=r||[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=hl(t,e,i[o],n);r[s++]=a,e=a}return r.length=s,r}function ul(t,e,i,n,r){r=r||[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=cl(t,e,i[o],n,r[s]);0===a.length&&(a[0]=e),r[s++]=a,e=a[a.length-1]}return r.length=s,r}function dl(t,e,i,n,r){let s;for(e+=n;e<i;e+=n)if(s=r(t.slice(e-n,e),t.slice(e,e+n)),s)return s;return!1}function fl(t,e,i,n,r,s){return s=s??at([1/0,1/0,-1/0,-1/0],t,e,i,n),!!wt(r,s)&&(s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]||dl(t,e,i,n,function(t,e){return function(t,e,i){let n=!1;const r=Q(t,e),s=Q(t,i);if(1===r||1===s)n=!0;else{const o=t[0],a=t[1],l=t[2],h=t[3],c=e[0],u=e[1],d=i[0],f=i[1],g=(f-u)/(d-c);let p,_;2&s&&!(2&r)&&(p=d-(f-h)/g,n=p>=o&&p<=l),n||!(4&s)||4&r||(_=f-(d-l)*g,n=_>=a&&_<=h),n||!(8&s)||8&r||(p=d-(f-a)/g,n=p>=o&&p<=l),n||!(16&s)||16&r||(_=f-(d-o)*g,n=_>=a&&_<=h)}return n}(r,t,e)}))}function gl(t,e,i,n,r){return!!(fl(t,e,i,n,r)||ai(t,e,i,n,r[0],r[1])||ai(t,e,i,n,r[0],r[3])||ai(t,e,i,n,r[2],r[1])||ai(t,e,i,n,r[2],r[3]))}function pl(t,e,i,n,r){if(!gl(t,e,i[0],n,r))return!1;if(1===i.length)return!0;for(let e=1,s=i.length;e<s;++e)if(oi(t,i[e-1],i[e],n,r)&&!fl(t,i[e-1],i[e],n,r))return!1;return!0}class _l extends ws{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 _l(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<$(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(sl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),al(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return il(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return qn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=vi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new _l(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return fl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=hl(this.flatCoordinates,0,t,this.stride),this.changed()}}var ml=_l;class yl extends ws{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new yl(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const r=this.flatCoordinates,s=kt(t,e,r[0],r[1]);if(s<n){const t=this.stride;for(let e=0;e<t;++e)i[e]=r[e];return i.length=t,s}return n}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return it(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return J(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 n=0,r=i.length;n<r;++n)t[e++]=i[n];return e}(this.flatCoordinates,0,t,this.stride),this.changed()}}var xl=yl;class vl extends ws{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?M(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new vl(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<$(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ol(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ll(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return li(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return nl(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),mi(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,Hn(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=ft(this.getExtent());this.flatInteriorPoint_=hi(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new xl(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new ml(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,n=[];let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=new ml(e.slice(r,o),t);n.push(a),r=o}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;pi(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=mi(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=bi(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new vl(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return pl(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=cl(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}var Sl=vl;function wl(t){if(Ct(t))throw new Error("Cannot create polygon from empty extent");const e=t[0],i=t[1],n=t[2],r=t[3],s=[e,i,e,r,n,r,n,i,e,i];return new vl(s,"XY",[s.length])}function Cl(t,e,i,n){const r=St(e)/i[0],s=_t(e)/i[1];return n?Math.min(t,Math.max(r,s)):Math.min(t,Math.min(r,s))}function bl(t,e,i){let n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(n=Math.max(n,i),n/=Math.log(1+50*Math.max(0,i/t-1))/50+1),Ft(n,i/2,2*e)}function Rl(t,e,i,n,r){return i=void 0===i||i,function(s,o,a,l){if(void 0!==s){const o=n?Cl(t,n,a,r):t;return i&&l?bl(s,o,e):Ft(s,e,o)}}}function Tl(t){if(void 0!==t)return 0}function El(t){if(void 0!==t)return t}function Il(t,e){setTimeout(function(){t(e)},0)}function Ml(t){return!(t.sourceCenter&&t.targetCenter&&!Yt(t.sourceCenter,t.targetCenter))&&t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation}function Pl(t,e,i,n,r){const s=Math.cos(-r);let o=Math.sin(-r),a=t[0]*s-t[1]*o,l=t[1]*s+t[0]*o;return a+=(e[0]/2-i[0])*n,l+=(i[1]-e[1]/2)*n,o=-o,[a*s-l*o,l*s+a*o]}var Fl=class extends Y{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=ze(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&&function(t){Le=!(void 0===t||t)}(),t.center&&(t.center=He(t.center,this.projection_)),t.extent&&(t.extent=Qe(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const t in qa)delete e[t];this.setProperties(e,!0);const i=function(t){let e,i,n;let r=void 0!==t.minZoom?t.minZoom:0,s=void 0!==t.maxZoom?t.maxZoom:28;const o=void 0!==t.zoomFactor?t.zoomFactor:2,a=void 0!==t.multiWorld&&t.multiWorld,l=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,h=void 0!==t.showFullExtent&&t.showFullExtent,c=ze(t.projection,"EPSG:3857"),u=c.getExtent();let d=t.constrainOnlyCenter,f=t.extent;if(a||f||!c.isGlobal()||(d=!1,f=u),void 0!==t.resolutions){const o=t.resolutions;i=o[r],n=void 0!==o[s]?o[s]:o[o.length-1],e=t.constrainResolution?function(t,e,i,n){return e=void 0===e||e,function(r,s,o,a){if(void 0!==r){const l=t[0],h=t[t.length-1],c=i?Cl(l,i,o,n):l;if(a)return e?bl(r,c,h):Ft(r,h,c);const u=Math.min(c,r),d=Math.floor(E(t,u,s));return t[d]>c&&d<t.length-1?t[d+1]:t[d]}}}(o,l,!d&&f,h):Rl(i,n,l,!d&&f,h)}else{const a=(u?Math.max(St(u),_t(u)):360*Bt.degrees/c.getMetersPerUnit())/256/Math.pow(2,0),g=a/Math.pow(2,28);i=t.maxResolution,void 0!==i?r=0:i=a/Math.pow(o,r),n=t.minResolution,void 0===n&&(n=void 0!==t.maxZoom?void 0!==t.maxResolution?i/Math.pow(o,s):a/Math.pow(o,s):g),s=r+Math.floor(Math.log(i/n)/Math.log(o)),n=i/Math.pow(o,s-r),e=t.constrainResolution?function(t,e,i,n,r,s){return n=void 0===n||n,i=void 0!==i?i:0,function(o,a,l,h){if(void 0!==o){const c=r?Cl(e,r,l,s):e;if(h)return n?bl(o,c,i):Ft(o,i,c);const u=1e-9,d=Math.ceil(Math.log(e/c)/Math.log(t)-u),f=-a*(.5-u)+.5,g=Math.min(c,o),p=Math.floor(Math.log(e/g)/Math.log(t)+f),_=Math.max(d,p);return Ft(e/Math.pow(t,_),i,c)}}}(o,i,n,l,!d&&f,h):Rl(i,n,l,!d&&f,h)}return{constraint:e,maxResolution:i,minResolution:n,minZoom:r,zoomFactor:o}}(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 n=function(t){if(void 0!==t.extent){const e=void 0===t.smoothExtentConstraint||t.smoothExtentConstraint;return Ha(t.extent,t.constrainOnlyCenter,e)}const e=ze(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,Ha(t,!1,!1)}return Ja}(t),r=i.constraint,s=function(t){if(void 0===t.enableRotation||t.enableRotation){const e=t.constrainRotation;return void 0===e||!0===e?function(){const t=Lt(5);return function(e,i){return i||void 0===e?e:Math.abs(e)<=t?0:e}}():!1===e?El:"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):El}return Tl}(t);this.constraints_={center:n,resolution:r,rotation:s},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 n=t||[0,0,0,0];e=e||[0,0,0,0];const r=this.getResolution(),s=r/2*(n[3]-e[3]+e[1]-n[1]),o=r/2*(n[0]-e[0]+e[2]-n[2]);this.setCenterInternal([i[0]+s,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=He(i.center,this.getProjection())),i.anchor&&(i=Object.assign({},i),i.anchor=He(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 n=0;for(;n<i&&!this.isDef();++n){const t=arguments[n];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(n===i)return void(e&&Il(e,!0));let r=Date.now(),s=this.targetCenter_.slice(),o=this.targetResolution_,a=this.targetRotation_;const l=[];for(;n<i;++n){const t=arguments[n],i={start:r,complete:!1,anchor:t.anchor,duration:void 0!==t.duration?t.duration:1e3,easing:t.easing||el,callback:e};if(t.center&&(i.sourceCenter=s,i.targetCenter=t.center.slice(),s=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=Dt(t.rotation-a+Math.PI,2*Math.PI)-Math.PI;i.targetRotation=a+e,a=i.targetRotation}Ml(i)?i.complete=!0:r+=i.duration,l.push(i)}this.animations_.push(l),this.setHint(0,1),this.updateAnimations_()}getAnimating(){return this.hints_[0]>0}getInteracting(){return this.hints_[1]>0}cancelAnimations(){let t;this.setHint(0,-this.hints_[0]);for(let e=0,i=this.animations_.length;e<i;++e){const i=this.animations_[e];if(i[0].callback&&Il(i[0].callback,!1),!t)for(let e=0,n=i.length;e<n;++e){const n=i[e];if(!n.complete){t=n.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 n=this.animations_[i];let r=!0;for(let i=0,s=n.length;i<s;++i){const s=n[i];if(s.complete)continue;const o=t-s.start;let a=s.duration>0?o/s.duration:1;a>=1?(s.complete=!0,a=1):r=!1;const l=s.easing(a);if(s.sourceCenter){const t=s.sourceCenter[0],e=s.sourceCenter[1],i=s.targetCenter[0],n=s.targetCenter[1];this.nextCenter_=s.targetCenter;const r=t+l*(i-t),o=e+l*(n-e);this.targetCenter_=[r,o]}if(s.sourceResolution&&s.targetResolution){const t=1===l?s.targetResolution:s.sourceResolution+l*(s.targetResolution-s.sourceResolution);if(s.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,s.anchor)}this.nextResolution_=s.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==s.sourceRotation&&void 0!==s.targetRotation){const t=1===l?Dt(s.targetRotation+Math.PI,2*Math.PI)-Math.PI:s.sourceRotation+l*(s.targetRotation-s.sourceRotation);if(s.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,s.anchor)}this.nextRotation_=s.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!s.complete)break}if(r){this.animations_[i]=null,this.setHint(0,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&Il(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();var r,s;return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],function(t,e){const i=Math.cos(e),n=Math.sin(e),r=t[0]*i-t[1]*n,s=t[1]*i+t[0]*n;t[0]=r,t[1]=s}(i,t-this.getRotation()),s=e,(r=i)[0]+=+s[0],r[1]+=+s[1]),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),r=this.getResolution();return void 0!==n&&void 0!==r&&(i=[e[0]-t*(e[0]-n[0])/r,e[1]-t*(e[1]-n[1])/r]),i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?qe(t,this.getProjection()):t}getCenterInternal(){return this.get(qa.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 Je(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();V(e,"The view center is not defined");const i=this.getResolution();V(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return V(void 0!==n,"The view rotation is not defined"),function(t,e,i,n){const[r,s,o,a,l,h,c,u]=pt(t,e,i,n);return tt(Math.min(r,o,l,c),Math.min(s,a,h,u),Math.max(r,o,l,c),Math.max(s,a,h,u),void 0)}(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(qa.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(Qe(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=St(t)/e[0],n=_t(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return function(i){return e/Math.pow(t,i*n)}}getRotation(){return this.get(qa.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/r}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const r=this.padding_;if(r){const t=this.getViewportSizeMinusPadding_();n=Pl(n,this.getViewportSize_(),[t[0]/2+r[3],t[1]/2+r[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const r=E(this.resolutions_,t,1);n=r,e=this.resolutions_[r],i=r==this.resolutions_.length-1?2:e/this.resolutions_[r+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=Ft(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,Ft(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(V(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t))V(!Ct(t),"Cannot fit empty extent provided as `geometry`"),i=wl(Qe(t,this.getProjection()));else if("Circle"===t.getType()){const e=Qe(t.getExtent(),this.getProjection());i=wl(e),i.rotate(this.getRotation(),ft(e))}else{const e=$e();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),r=t.getFlatCoordinates(),s=t.getStride();let o=1/0,a=1/0,l=-1/0,h=-1/0;for(let t=0,e=r.length;t<e;t+=s){const e=r[t]*i-r[t+1]*n,s=r[t]*n+r[t+1]*i;o=Math.min(o,e),a=Math.min(a,s),l=Math.max(l,e),h=Math.max(h,s)}return[o,a,l,h]}fitInternal(t,e){let i=(e=e||{}).size;i||(i=this.getViewportSizeMinusPadding_());const n=void 0!==e.padding?e.padding:[0,0,0,0],r=void 0!==e.nearest&&e.nearest;let s;s=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]-n[1]-n[3],i[1]-n[0]-n[2]]);a=isNaN(a)?s:Math.max(a,s),a=this.getConstrainedResolution(a,r?0:1);const l=this.getRotation(),h=Math.sin(l),c=Math.cos(l),u=ft(o);u[0]+=(n[1]-n[3])/2*a,u[1]+=(n[0]-n[2])/2*a;const d=u[0]*c-u[1]*h,f=u[1]*c+u[0]*h,g=this.getConstrainedCenter([d,f],a),p=e.callback?e.callback:O;void 0!==e.duration?this.animateInternal({resolution:a,center:g,duration:e.duration,easing:e.easing},p):(this.targetResolution_=a,this.targetCenter_=g,this.applyTargetState_(!1,!0),Il(p,!0))}centerOn(t,e,i){this.centerOnInternal(He(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(Pl(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,n){let r;const s=this.padding_;if(s&&t){const o=this.getViewportSizeMinusPadding_(-i),a=Pl(t,n,[o[0]/2+s[3],o[1]/2+s[0]],e,i);r=[t[0]-a[0],t[1]-a[1]]}return r}isDef(){return!!this.getCenterInternal()&&void 0!==this.getResolution()}adjustCenter(t){const e=qe(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&&He(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.getViewportSize_(this.getRotation()),r=this.constraints_.resolution(this.targetResolution_*t,0,n,i);e&&(this.targetCenter_=this.calculateCenterZoom(r,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=He(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(n,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t?He(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,n=this.constraints_.rotation(this.targetRotation_,i),r=this.getViewportSize_(n),s=this.constraints_.resolution(this.targetResolution_,0,r,i),o=this.constraints_.center(this.targetCenter_,s,r,i,this.calculateCenterShift(this.targetCenter_,s,n,r));this.get(qa.ROTATION)!==n&&this.set(qa.ROTATION,n),this.get(qa.RESOLUTION)!==s&&(this.set(qa.RESOLUTION,s),this.set("zoom",this.getZoom(),!0)),o&&this.get(qa.CENTER)&&Yt(this.get(qa.CENTER),o)||this.set(qa.CENTER,o),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=void 0!==t?t:200;const n=e||0,r=this.constraints_.rotation(this.targetRotation_),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,n,s),a=this.constraints_.center(this.targetCenter_,o,s,!1,this.calculateCenterShift(this.targetCenter_,o,r,s));if(0===t&&!this.cancelAnchor_)return this.targetResolution_=o,this.targetRotation_=r,this.targetCenter_=a,void this.applyTargetState_();i=i||(0===t?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,this.getResolution()===o&&this.getRotation()===r&&this.getCenterInternal()&&Yt(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:a,resolution:o,duration:t,easing:tl,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(1,1)}endInteraction(t,e,i){i=i&&He(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(1,-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)}},Ol="opacity",kl="visible",Al="extent",Ll="zIndex",Dl="maxResolution",jl="minResolution",Gl="maxZoom",Wl="minZoom",Xl="source",zl=class extends Y{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[Ol]=void 0!==t.opacity?t.opacity:1,V("number"==typeof e[Ol],"Layer opacity must be a number"),e[kl]=void 0===t.visible||t.visible,e[Ll]=t.zIndex,e[Dl]=void 0!==t.maxResolution?t.maxResolution:1/0,e[jl]=void 0!==t.minResolution?t.minResolution:0,e[Wl]=void 0!==t.minZoom?t.minZoom:-1/0,e[Gl]=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=Ft(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 G()}getLayerStatesArray(t){return G()}getExtent(){return this.get(Al)}getMaxResolution(){return this.get(Dl)}getMinResolution(){return this.get(jl)}getMinZoom(){return this.get(Wl)}getMaxZoom(){return this.get(Gl)}getOpacity(){return this.get(Ol)}getSourceState(){return G()}getVisible(){return this.get(kl)}getZIndex(){return this.get(Ll)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Al,t)}setMaxResolution(t){this.set(Dl,t)}setMinResolution(t){this.set(jl,t)}setMaxZoom(t){this.set(Gl,t)}setMinZoom(t){this.set(Wl,t)}setOpacity(t){V("number"==typeof t,"Layer opacity must be a number"),this.set(Ol,t)}setVisible(t){this.set(kl,t)}setZIndex(t){this.set(Ll,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},Yl=class extends zl{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(Xl,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(Xl)||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_&&(w(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=v(t,C,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 n;if(!t&&i&&(t=i.getView()),e=t instanceof Fl?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),e.layerStatesArray){if(n=e.layerStatesArray.find(t=>t.layer===this),!n)return!1}else n=this.getLayerState();const r=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 n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}(n,e.viewState)&&(!r||wt(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];let i=e(t instanceof Fl?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("map",t)}getMapInternal(){return this.get("map")}setMap(t){this.mapPrecomposeKey_&&(w(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(w(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=v(t,"precompose",this.handlePrecompose_,this),this.mapRenderKey_=v(this,C,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);V(!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(Xl,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 Nl="renderOrder";var Bl=class extends Yl{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(Nl)}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==0&&(t.declutter[i]=new Bi(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Nl,t)}setStyle(t){this.style_=void 0===t?wa:t;const e=function(t){if(void 0===t)return wa;if(!t)return null;if("function"==typeof t)return t;if(t instanceof ba)return t;if(Array.isArray(t)&&0===t.length)return[];if(Array.isArray(t)&&t[0]instanceof ba){const e=t.length,i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!(e instanceof ba))throw new Error("Expected a list of style instances");i[n]=e}return i}return function(t,e){if(e=e??eo(),!Array.isArray(t))return Ia([t],e);const i=t.length;if("style"in t[0]){const n=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");n[e]=i}return function(t,e){const i=function(t,e){const i=t.length,n=new Array(i);for(let r=0;r<i;++r){const i=t[r],s="filter"in i?la(i.filter,Xs,e):Ea;let o;if(Array.isArray(i.style)){const t=i.style.length;o=new Array(t);for(let n=0;n<t;++n)o[n]=Ma(i.style[n],e)}else o=[Ma(i.style,e)];n[r]={filter:s,styles:o}}return function(e){const r=[];let s=!1;for(let o=0;o<i;++o)if((0,n[o].filter)(e)&&(!t[o].else||!s)){s=!0;for(const t of n[o].styles){const i=t(e);i&&r.push(i)}}return r}}(t,e=e??eo()),n={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""};return function(t,r){if(n.properties=t.getPropertiesInternal(),n.resolution=r,e.featureId){const e=t.getId();n.featureId=void 0!==e?e:null}return e.geometryType&&(n.geometryType=aa(t.getGeometry())),i(n)}}(n,e)}return Ia(t,e)}(t)}(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:(V("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()}},Zl=class extends Bl{constructor(t){super(t)}createRenderer(){return new Gs(this)}},Vl=class extends L{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(C)}release(){this.setState(4)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(4!==this.state){if(3!==this.state&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){G()}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 n=e-i+1e3/60;return n>=this.transition_?1:Qa(n/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 Ul=[];var Kl=class extends Vl{constructor(t,e,i,n,r){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=n.bind(void 0,this),this.removeSourceTiles_=r,this.wrappedTileCoord=i}getContext(){return this.context_||(this.context_=_n(1,1,Ul)),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(t){const e=X(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_&&(xn(this.context_),Ul.push(this.context_.canvas),this.context_=null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}},$l=class extends Vl{constructor(t,e,i,n,r,s){super(t,e,s),this.extent=null,this.format_=n,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=r,this.url_=i,this.key=i}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){0==this.state&&(this.setState(1),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(t,e){this.setFeatures(t)}onError(){this.setState(3)}setFeatures(t){this.features_=t,this.setState(2)}setLoader(t){this.loader_=t}};class ql{constructor(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}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 Hl(t,e,i,n,r){return void 0!==r?(r.minX=t,r.maxX=e,r.minY=i,r.maxY=n,r):new ql(t,e,i,n)}var Jl=ql;function Ql(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function th(t,e,i,n,r){return`${X(t)},${e},${function(t,e,i){return t+"/"+e+"/"+i}(i,n,r)}`}const eh=[0,0,0];var ih=class{constructor(t){let e=t.minZoom;const i=t.resolutions;let n;if(void 0===e&&i&&(e=i.findIndex(t=>void 0!==t)),this.minZoom=void 0!==e?e:0,this.resolutions_=i,V(function(t){const e=((t,e)=>e-t)||R;return t.every(function(i,n){if(0===n)return!0;const r=e(t[n-1],i);return!(r>0||0===r)})}(this.resolutions_),"`resolutions` must be sorted in descending order"),!t.origins)for(let t=0,e=this.resolutions_.length-1;t<e;++t)if(n){if(this.resolutions_[t]/this.resolutions_[t+1]!==n){n=void 0;break}}else n=this.resolutions_[t]/this.resolutions_[t+1];this.zoomFactor_=n,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,V(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const r=t.extent;void 0===r||this.origin_||this.origins_||(this.origin_=xt(r)),V(!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,V(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:256,V(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=void 0!==r?r: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 Jl(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(r){const t=this.getTileRangeForExtentAndZ(r,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}):r&&this.calculateTileRanges_(r)}forEachTileCoord(t,e,i){const n=this.getTileRangeForExtentAndZ(t,e);for(let t=n.minX,r=n.maxX;t<=r;++t)for(let r=n.minY,s=n.maxY;r<=s;++r)i([e,t,r])}forEachTileCoordParentTileRange(t,e,i,n){let r,s,o,a=null,l=t[0]-1;for(2===this.zoomFactor_?(s=t[1],o=t[2]):a=this.getTileCoordExtent(t,n);l>=this.minZoom;){if(void 0!==s&&void 0!==o?(s=Math.floor(s/2),o=Math.floor(o/2),r=Hl(s,s,o,o,i)):r=this.getTileRangeForExtentAndZ(a,l,i),e(l,r))return!0;--l}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],n=2*t[2];return Hl(i,i+1,n,n+1,e)}const n=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(n,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const n=t[0],r=t[1],s=t[2];if(e===n)return Hl(r,s,r,s,i);if(this.zoomFactor_){const t=Math.pow(this.zoomFactor_,e-n),o=Math.floor(r*t),a=Math.floor(s*t);return e<n?Hl(o,o,a,a,i):Hl(o,Math.floor(t*(r+1))-1,a,Math.floor(t*(s+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,eh);const n=eh[1],r=eh[2];return this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,eh),Hl(n,eh[1],r,eh[2],i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),n=us(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*n[0]*i,e[1]-(t[2]+.5)*n[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),n=this.getResolution(t[0]),r=us(this.getTileSize(t[0]),this.tmpSize_),s=i[0]+t[1]*r[0]*n,o=i[1]-(t[2]+1)*r[1]*n;return tt(s,o,s+r[0]*n,o+r[1]*n,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,n,r){const s=this.getZForResolution(i),o=i/this.getResolution(s),a=this.getOrigin(s),l=us(this.getTileSize(s),this.tmpSize_);let h=o*(t-a[0])/i/l[0],c=o*(a[1]-e)/i/l[1];return n?(h=Xt(h,5)-1,c=Xt(c,5)-1):(h=Wt(h,5),c=Wt(c,5)),Ql(s,h,c,r)}getTileCoordForXYAndZ_(t,e,i,n,r){const s=this.getOrigin(i),o=this.getResolution(i),a=us(this.getTileSize(i),this.tmpSize_);let l=(t-s[0])/o/a[0],h=(s[1]-e)/o/a[1];return n?(l=Xt(l,5)-1,h=Xt(h,5)-1):(l=Wt(l,5),h=Wt(h,5)),Ql(i,l,h,r)}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 Ft(E(this.resolutions_,t,e||0),this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return gl(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,i=new Array(e);for(let n=this.minZoom;n<e;++n)i[n]=this.getTileRangeForExtentAndZ(t,n);this.fullTileRanges_=i}};function nh(t){let e=t.getDefaultTileGrid();return e||(e=function(t){return function(t,e,i,n){n=void 0!==n?n:"top-left";const r=rh(t,e,i);return new ih({extent:t,origin:gt(t,n),resolutions:r,tileSize:i})}(sh(t),void 0,void 0,void 0)}(t),t.setDefaultTileGrid(e)),e}function rh(t,e,i,n){e=void 0!==e?e:42,i=us(void 0!==i?i:256);const r=_t(t),s=St(t);n=n>0?n:Math.max(s/i[0],r/i[1]);const o=e+1,a=new Array(o);for(let t=0;t<o;++t)a[t]=n/Math.pow(2,t);return a}function sh(t){let e=(t=Ge(t)).getExtent();if(!e){const i=180*Bt.degrees/t.getMetersPerUnit();e=tt(-i,-i,i,i)}return e}const oh=/\{z\}/g,ah=/\{x\}/g,lh=/\{y\}/g,hh=/\{-y\}/g;function ch(t,e){return function(i,n,r){if(!i)return;let s;const o=i[0];if(e){const t=e.getFullTileRange(o);t&&(s=t.getHeight()-1)}return function(t,e,i,n,r){return t.replace(oh,e.toString()).replace(ah,i.toString()).replace(lh,n.toString()).replace(hh,function(){if(void 0===r)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(r-n).toString()})}(t,o,i[1],i[2],s)}}class uh extends A{constructor(t,e){super(t),this.tile=e}}var dh=class extends ln{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;this.tileGrid&&us(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),[256,256]),this.tmpSize=[0,0],this.key_=t.key||X(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,n,r,s){return G()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:nh(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const n=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),s=us(n.getTileSize(t),this.tmpSize);return 1==r?s:(o=s,a=r,void 0===(l=this.tmpSize)&&(l=[0,0]),l[0]=o[0]*a+.5|0,l[1]=o[1]*a+.5|0,l);var o,a,l}getTileCoordForTileUrlFunction(t,e){const i=void 0!==e?e:this.getProjection(),n=void 0!==e?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=function(t,e,i){const n=e[0],r=t.getTileCoordCenter(e),s=sh(i);if(!q(s,r)){const e=St(s),i=Math.ceil((s[0]-r[0])/e);return r[0]+=e*i,t.getTileCoordForCoordAndZ(r,n)}return e}(n,t,i)),function(t,e){const i=t[0],n=t[1],r=t[2];if(e.getMinZoom()>i||i>e.getMaxZoom())return!1;const s=e.getFullTileRange(i);return!s||s.containsXY(n,r)}(t,n)?t:null}clear(){}refresh(){this.clear(),super.refresh()}};class fh extends dh{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===fh.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=X(e),n=e.getState();let r;1==n?(this.tileLoadingKeys_[i]=!0,r="tileloadstart"):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=3==n?"tileloaderror":2==n?"tileloadend":void 0),null!=r&&this.dispatchEvent(new uh(r,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 n=i[1].charCodeAt(0),r=i[2].charCodeAt(0);let s;for(s=n;s<=r;++s)e.push(t.replace(i[0],String.fromCharCode(s)));return e}if(i=/\{(\d+)-(\d+)\}/.exec(t),i){const n=parseInt(i[2],10);for(let r=parseInt(i[1],10);r<=n;r++)e.push(t.replace(i[0],r.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(function(t,e){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=ch(t[r],e);return function(t){return 1===t.length?t[0]:function(e,i,n){if(!e)return;const r=function(t){return e=t[0],(t[1]<<e)+t[2];var e}(e),s=Dt(r,t.length);return t[s](e,i,n)}}(n)}(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}var gh=fh,ph=class extends gh{constructor(t){const e=t.projection||"EPSG:3857",i=t.extent||sh(e),n=t.tileGrid||function(t){const e=t||{},i=e.extent||Ge("EPSG:3857").getExtent(),n={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:rh(i,e.maxZoom,e.tileSize,e.maxResolution)};return new ih(n)}({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:n,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:_h,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:$l,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceZ_(t,e,i){const n=this.projection,r=e&&n&&!Ye(e,n)?t/n.getMetersPerUnit()*e.getMetersPerUnit():t;return this.tileGrid.getZForResolution(r,i)}getSourceTiles(t,e,i,n){if(0===i.getState()){i.setState(1);const r=i.wrappedTileCoord,s=this.getTileGridForProjection(e);let o=s.getTileCoordExtent(r);const a=r[0],l=s.getResolution(a);K(o,-l,o);const h=this.projection;e&&this.projection&&!Ye(e,h)&&(o=Ue(o,e,h));const c=this.tileGrid,u=c.getExtent();u&&mt(o,u,o);const d=this.getSourceZ_(l,e,this.zDirection),f=n||this.tileUrlFunction;c.forEachTileCoord(o,d,n=>{const r=f(n,t,e);this.sourceTiles_[r]||(this.sourceTiles_[r]=new this.tileClass(n,r?0:4,r,this.format_,this.tileLoadFunction));const s=this.sourceTiles_[r];i.sourceTiles.push(s),this.tileKeysBySourceTileUrl_[r]||(this.tileKeysBySourceTileUrl_[r]=[]),this.tileKeysBySourceTileUrl_[r].push(i.getKey());const o=s.getState();if(o<2){const t=e=>{this.handleTileChange(e);const n=s.getState();if(2===n||3===n){const e=s.getKey();e in i.errorTileKeys?2===s.getState()&&delete i.errorTileKeys[e]:i.loadingSourceTiles--,3===n?i.errorTileKeys[e]=!0:s.removeEventListener(C,t),0===i.loadingSourceTiles&&i.setState(x(i.errorTileKeys)?2:3)}};s.addEventListener(C,t),i.loadingSourceTiles++}0===o&&(s.extent=c.getTileCoordExtent(n),s.projection=this.projection,s.resolution=c.getResolution(n[0]),s.load())}),i.loadingSourceTiles||i.setState(i.sourceTiles.some(t=>3===t.getState())?3:2)}return i.sourceTiles}removeSourceTiles(t){const e=t.getKey(),i=t.sourceTiles;for(let t=0,n=i.length;t<n;++t){const n=i[t].getTileUrl();if(!this.tileKeysBySourceTileUrl_[n])return;const r=this.tileKeysBySourceTileUrl_[n].indexOf(e);-1!==r&&(this.tileKeysBySourceTileUrl_[n].splice(r,1),0===this.tileKeysBySourceTileUrl_[n].length&&(delete this.tileKeysBySourceTileUrl_[n],delete this.sourceTiles_[n]))}}getTile(t,e,i,n,r){const s=[t,e,i];let o=this.getTileCoordForTileUrlFunction(s,r);const a=this.getTileGrid().getExtent(),l=this.projection,h=this.getTileGridForProjection(r);if(o&&a){const e=h.getTileCoordExtent(o);K(e,-h.getResolution(t),e),wt(a,r&&l&&!Ye(r,l)?Ue(e,r,l):e)||(o=null)}let c=!0;if(null!==o){const e=this.tileGrid,i=h.getResolution(t),s=this.getSourceZ_(i,r,1),a=h.getTileCoordExtent(o);K(a,-i,a),e.forEachTileCoord(r&&l&&!Ye(r,l)?Ue(a,r,l):a,s,t=>{c=c&&!this.tileUrlFunction(t,n,l)})}const u=this.tileUrlFunction,d=new Kl(s,c?4:0,o,t=>this.getSourceTiles(n,r,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 n=this.projection;if(null!==n&&!Ye(n,t))return nh(t);const r=this.tileGrid,s=r.getResolutions().slice(),o=s.map(function(t,e){return r.getOrigin(e)}),a=s.map(function(t,e){return r.getTileSize(e)}),l=43;for(let t=s.length;t<l;++t)s.push(s[t-1]/2),o.push(o[t-1]),a.push(a[t-1]);i=new ih({extent:r.getExtent(),origins:o,resolutions:s,tileSizes:a}),this.tileGrids_[e]=i}return i}getTilePixelRatio(t){return t}getTilePixelSize(t,e,i){const n=us(this.getTileGridForProjection(i).getTileSize(t),this.tmpSize);return[Math.round(n[0]*e),Math.round(n[1]*e)]}setOverlaps(t){this.overlaps_=t,this.changed()}};function _h(t,e){t.setLoader(function(i,n,r){Et(e,t.getFormat(),i,n,r,t.onLoad.bind(t),t.onError.bind(t))})}function mh(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageBitmap?t:null}const yh=new Error("disposed"),xh=[256,256];var vh=class extends Vl{constructor(t){super(t.tileCoord,0,{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=mh(this.data_);return t?[t.width,t.height]:xh}getData(){return this.data_}getError(){return this.error_}load(){if(0!==this.state&&3!==this.state)return;this.state=1,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=2,t.changed()}).catch(function(e){t.error_=e,t.state=3,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(yh),this.controller_=null),super.disposeInternal()}},Sh=class extends Vl{constructor(t,e,i,n,r,s){super(t,e,s),this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.src_=i,this.key=i,this.image_,gn?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_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=2,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=3,this.unlistenImage_(),this.image_=function(){const t=_n(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}handleImageLoad_(){if(gn)this.state=2;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=2:this.state=4}this.unlistenImage_(),this.changed()}load(){3==this.state&&(this.state=0,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),0==this.state&&(this.state=1,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=function(t,e,i){const n=t;let r=!0,s=!1,o=!1;const a=[S(n,"load",function(){o=!0,s||e()})];return n.src&&pn?(s=!0,n.decode().then(function(){r&&e()}).catch(function(t){r&&(o?e():i())})):a.push(S(n,"error",i)),function(){r=!1,a.forEach(w)}}(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 wh;const Ch=[];function bh(t,e,i,n,r){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(n,r),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(i,r)),t.restore()}function Rh(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function Th(t,e,i,n){const r=Ve(i,e,t);let s=We(e,n,i);const o=e.getMetersPerUnit();void 0!==o&&(s*=o);const a=t.getMetersPerUnit();void 0!==a&&(s/=a);const l=t.getExtent();if(!l||q(l,r)){const e=We(t,s,r)/s;isFinite(e)&&e>0&&(s/=e)}return s}var Eh=class{constructor(t,e,i,n,r,s,o){this.sourceProj_=t,this.targetProj_=e;let a={};const l=o?(h=t=>ki(o,Ve(t,this.targetProj_,this.sourceProj_)),function(t,e,i,n){const r=t.length;i=void 0!==i?i:2,n=n??i,e=void 0!==e?e:new Array(r);for(let s=0;s<r;s+=n){const r=h(t.slice(s,s+i)),o=r.length;for(let i=0,a=n;i<a;++i)e[s+i]=i>=o?t[s+i]:r[i]}return e}):Ze(this.targetProj_,this.sourceProj_);var h;this.transformInv_=function(t){const e=t[0]+"/"+t[1];return a[e]||(a[e]=l(t)),a[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&St(n)>=St(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?St(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?St(this.targetProj_.getExtent()):null;const c=xt(i),u=vt(i),d=dt(i),f=ut(i),g=this.transformInv_(c),p=this.transformInv_(u),_=this.transformInv_(d),m=this.transformInv_(f),y=10+(s?Math.max(0,Math.ceil(Math.log2(ct(i)/(s*s*256*256)))):0);if(this.addQuad_(c,u,d,f,g,p,_,m,y),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach(function(e,i,n){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 n=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-n<this.sourceWorldWidth_/2&&(e.source=i)}})}a={}}addTriangle_(t,e,i,n,r,s){this.triangles_.push({source:[n,r,s],target:[t,e,i]})}addQuad_(t,e,i,n,r,s,o,a,l){const h=U([r,s,o,a]),c=this.sourceWorldWidth_?St(h)/this.sourceWorldWidth_:null,u=this.sourceWorldWidth_,d=this.sourceProj_.canWrapX()&&c>.5&&c<1;let f=!1;if(l>0&&(this.targetProj_.isGlobal()&&this.targetWorldWidth_&&(f=St(U([t,e,i,n]))/this.targetWorldWidth_>.25||f),!d&&this.sourceProj_.isGlobal()&&c&&(f=c>.25||f)),!f&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!wt(h,this.maxSourceExtent_))return;let g=0;if(!(f||isFinite(r[0])&&isFinite(r[1])&&isFinite(s[0])&&isFinite(s[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)f=!0;else if(g=(isFinite(r[0])&&isFinite(r[1])?0:8)+(isFinite(s[0])&&isFinite(s[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=g&&2!=g&&4!=g&&8!=g)return;if(l>0){if(!f){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],n=this.transformInv_(e);let s;s=d?(Dt(r[0],u)+Dt(o[0],u))/2-Dt(n[0],u):(r[0]+o[0])/2-n[0];const a=(r[1]+o[1])/2-n[1];f=s*s+a*a>this.errorThresholdSquared_}if(f){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const h=[(e[0]+i[0])/2,(e[1]+i[1])/2],c=this.transformInv_(h),u=[(n[0]+t[0])/2,(n[1]+t[1])/2],d=this.transformInv_(u);this.addQuad_(t,e,h,u,r,s,c,d,l-1),this.addQuad_(u,h,i,n,d,c,o,a,l-1)}else{const h=[(t[0]+e[0])/2,(t[1]+e[1])/2],c=this.transformInv_(h),u=[(i[0]+n[0])/2,(i[1]+n[1])/2],d=this.transformInv_(u);this.addQuad_(t,h,u,n,r,c,d,a,l-1),this.addQuad_(h,e,i,u,c,s,o,d,l-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}11&g||this.addTriangle_(t,i,n,r,o,a),14&g||this.addTriangle_(t,i,e,r,o,s),g&&(13&g||this.addTriangle_(e,n,t,s,a,r),7&g||this.addTriangle_(e,n,i,s,a,o))}calculateSourceExtent(){const t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach(function(e,i,n){const r=e.source;ot(t,r[0]),ot(t,r[1]),ot(t,r[2])}),t}getTriangles(){return this.triangles_}},Ih=class extends Vl{constructor(t,e,i,n,r,s,o,a,l,h,c,u){super(r,0,u),this.renderEdges_=void 0!==c&&c,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=n,this.wrappedTileCoord_=s||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const d=n.getTileCoordExtent(this.wrappedTileCoord_),f=this.targetTileGrid_.getExtent();let g=this.sourceTileGrid_.getExtent();const p=f?mt(d,f):d;if(0===ct(p))return void(this.state=4);const _=t.getExtent();_&&(g=g?mt(g,_):_);const m=n.getResolution(this.wrappedTileCoord_[0]),y=function(t,e,i,n){const r=ft(i);let s=Th(t,e,r,n);return(!isFinite(s)||s<=0)&&ht(i,function(i){return s=Th(t,e,i,n),isFinite(s)&&s>0}),s}(t,i,p,m);if(!isFinite(y)||y<=0)return void(this.state=4);const x=void 0!==h?h:.5;if(this.triangulation_=new Eh(t,i,p,g,y*x,m),0===this.triangulation_.getTriangles().length)return void(this.state=4);this.sourceZ_=e.getZForResolution(y);let v=this.triangulation_.calculateSourceExtent();if(g&&(t.canWrapX()?(v[1]=Ft(v[1],g[1],g[3]),v[3]=Ft(v[3],g[1],g[3])):v=mt(v,g)),ct(v)){let i=0,n=0;t.canWrapX()&&(i=St(_),n=Math.floor((v[0]-_[0])/i)),Rt(v.slice(),t,!0).forEach(t=>{const r=e.getTileRangeForExtentAndZ(t,this.sourceZ_);for(let t=r.minX;t<=r.maxX;t++)for(let e=r.minY;e<=r.maxY;e++){const r=n*i;this.sourceTiles_.push({getTile:()=>l(this.sourceZ_,t,e,o),offset:r})}++n}),0===this.sourceTiles_.length&&(this.state=4)}else this.state=4}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{const i=e.tile;if(i&&2==i.getState()){const n=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);n[0]+=e.offset,n[2]+=e.offset;const r=this.clipExtent_?.slice();r&&(r[0]+=e.offset,r[2]+=e.offset),t.push({extent:n,clipExtent:r,image:i.getImage()})}}),this.sourceTiles_.length=0,0===t.length)this.state=3;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],r="number"==typeof i?i:i[1],s=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=function(t,e,i,n,r,s,o,a,l,h,c,u,d,f){const g=_n(Math.round(i*t),Math.round(i*e),Ch);if(u||(g.imageSmoothingEnabled=!1),0===l.length)return g.canvas;function p(t){return Math.round(t*i)/i}g.scale(i,i),g.globalCompositeOperation="lighter";const _=[1/0,1/0,-1/0,-1/0];let m;l.forEach(function(t,e,i){st(_,t.extent)});const y=i/n,x=(u?1:1+Math.pow(2,-24))/y;if(!d||1!==l.length||0!==h){if(m=_n(Math.round(St(_)*y),Math.round(_t(_)*y),Ch),u||(m.imageSmoothingEnabled=!1),r&&f){const t=(r[0]-_[0])*y,e=-(r[3]-_[3])*y,i=St(r)*y,n=_t(r)*y;m.rect(t,e,i,n),m.clip()}l.forEach(function(t,e,i){if(t.image.width>0&&t.image.height>0){if(t.clipExtent){m.save();const e=(t.clipExtent[0]-_[0])*y,i=-(t.clipExtent[3]-_[3])*y,n=St(t.clipExtent)*y,r=_t(t.clipExtent)*y;m.rect(u?e:Math.round(e),u?i:Math.round(i),u?n:Math.round(e+n)-Math.round(e),u?r:Math.round(i+r)-Math.round(i)),m.clip()}const e=(t.extent[0]-_[0])*y,i=-(t.extent[3]-_[3])*y,n=St(t.extent)*y,r=_t(t.extent)*y;m.drawImage(t.image,h,h,t.image.width-2*h,t.image.height-2*h,u?e:Math.round(e),u?i:Math.round(i),u?n:Math.round(e+n)-Math.round(e),u?r:Math.round(i+r)-Math.round(i)),t.clipExtent&&m.restore()}})}const v=xt(o);return a.getTriangles().forEach(function(t,e,i){const n=t.source,r=t.target;let o=n[0][0],a=n[0][1],h=n[1][0],c=n[1][1],d=n[2][0],f=n[2][1];const y=p((r[0][0]-v[0])/s),S=p(-(r[0][1]-v[1])/s),w=p((r[1][0]-v[0])/s),C=p(-(r[1][1]-v[1])/s),b=p((r[2][0]-v[0])/s),R=p(-(r[2][1]-v[1])/s),T=o,E=a;o=0,a=0,h-=T,c-=E,d-=T,f-=E;const I=function(t){const e=t.length;for(let i=0;i<e;i++){let n=i,r=Math.abs(t[i][i]);for(let s=i+1;s<e;s++){const e=Math.abs(t[s][i]);e>r&&(r=e,n=s)}if(0===r)return null;const s=t[n];t[n]=t[i],t[i]=s;for(let n=i+1;n<e;n++){const r=-t[n][i]/t[i][i];for(let s=i;s<e+1;s++)i==s?t[n][s]=0:t[n][s]+=r*t[i][s]}}const i=new Array(e);for(let n=e-1;n>=0;n--){i[n]=t[n][e]/t[n][n];for(let r=n-1;r>=0;r--)t[r][e]-=t[r][n]*i[n]}return i}([[h,c,0,0,w-y],[d,f,0,0,b-y],[0,0,h,c,C-S],[0,0,d,f,R-S]]);if(!I)return;if(g.save(),g.beginPath(),function(){if(void 0===wh){const t=_n(6,6,Ch);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",bh(t,4,5,4,0),bh(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;wh=Rh(e,0)||Rh(e,4)||Rh(e,8),xn(t),Ch.push(t.canvas)}return wh}()||!u){g.moveTo(w,C);const t=4,e=y-w,i=S-C;for(let n=0;n<t;n++)g.lineTo(w+p((n+1)*e/t),C+p(n*i/(t-1))),n!=t-1&&g.lineTo(w+p((n+1)*e/t),C+p((n+1)*i/(t-1)));g.lineTo(b,R)}else g.moveTo(w,C),g.lineTo(y,S),g.lineTo(b,R);let M;if(g.clip(),g.transform(I[0],I[2],I[1],I[3],y,S),g.translate(_[0]-T,_[3]-E),m)M=m.canvas,g.scale(x,-x);else{const t=l[0],e=t.extent;M=t.image,g.scale(St(e)/M.width,-_t(e)/M.height)}g.drawImage(M,0,0),g.restore()}),m&&(xn(m),Ch.push(m.canvas)),c&&(g.save(),g.globalCompositeOperation="source-over",g.strokeStyle="black",g.lineWidth=1,a.getTriangles().forEach(function(t,e,i){const n=t.target,r=(n[0][0]-v[0])/s,o=-(n[0][1]-v[1])/s,a=(n[1][0]-v[0])/s,l=-(n[1][1]-v[1])/s,h=(n[2][0]-v[0])/s,c=-(n[2][1]-v[1])/s;g.beginPath(),g.moveTo(a,l),g.lineTo(r,o),g.lineTo(h,c),g.closePath(),g.stroke()}),g.restore()),g.canvas}(n,r,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),s,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=2}this.changed()}load(){for(const t of this.sourceTiles_)t.tile=t.getTile();if(0==this.state){this.state=1,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const i=e.getState();if(0==i||1==i){t++;const i=v(e,C,n=>{const r=e.getState();2!=r&&3!=r&&4!=r||(w(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){0==t.getState()&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(w),this.sourcesListenerKeys_=null}release(){this.canvas_&&(xn(this.canvas_.getContext("2d")),Ch.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},Mh=class{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 b&&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 V(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 V(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){V(!(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 Ph(t,e,i){if(!(i in t))return t[i]=new Set([e]),!0;const n=t[i],r=n.has(e);return r||n.add(e),!r}function Fh(t,e,i){const n=t[i];return!!n&&n.delete(e)}function Oh(t,e){const i=t.layerStatesArray[t.layerIndex];i.extent&&(e=mt(e,Qe(i.extent,t.viewState.projection)));const n=i.layer.getRenderSource();if(!n.getWrapX()){const i=n.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=mt(e,i))}return e}var kh=class extends js{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 Jl(0,0,0,0),this.tempTileCoord_=Ql(0,0,0);const i=void 0!==e.cacheSize?e.cacheSize:512;this.tileCache_=new Mh(i),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=.5*i}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Mh(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,n){const r=this.tileCache_,s=this.getLayer().getSource(),o=th(s,s.getKey(),t,e,i);let a;if(r.containsKey(o))a=r.get(o);else{const l=n.viewState.projection,h=s.getProjection();if(a=s.getTile(t,e,i,n.pixelRatio,l,!h||Ye(h,l)?void 0:this.getSourceTileCache()),!a)return null;r.set(o,a)}return a}getTile(t,e,i,n){return this.getOrCreateTile(t,e,i,n)||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=ki(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!q(r,n))return null;const s=e.viewState,o=i.getRenderSource(),a=o.getTileGridForProjection(s.projection),l=o.getTilePixelRatio(e.pixelRatio);for(let t=a.getZForResolution(s.resolution);t>=a.getMinZoom();--t){const i=a.getTileCoordForCoordAndZ(n,t),r=this.getTile(t,i[1],i[2],e);if(!r||2!==r.getState())continue;const h=a.getOrigin(t),c=us(a.getTileSize(t)),u=a.getResolution(t);let d;if(r instanceof Sh||r instanceof Ih)d=r.getImage();else{if(!(r instanceof vh))continue;if(d=mh(r.getData()),!d)continue}const f=Math.floor(l*((n[0]-h[0])/u-i[1]*c[0])),g=Math.floor(l*((h[1]-n[1])/u-i[2]*c[1])),p=Math.round(l*o.getGutterForProjection(s.projection));return this.getImageData(d,f+p,g+p)}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,n,r){const s=t.viewState,o=this.getLayer(),a=o.getRenderSource(),l=a.getTileGridForProjection(s.projection),h=X(a);h in t.wantedTiles||(t.wantedTiles[h]={});const c=t.wantedTiles[h],u=o.getMapInternal(),d=Math.max(i-r,l.getMinZoom(),l.getZForResolution(Math.min(o.getMaxResolution(),u?u.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):l.getResolution(0)),a.zDirection)),f=s.rotation,g=f?pt(s.center,s.resolution,f,t.size):void 0;for(let r=i;r>=d;--r){const i=l.getTileRangeForExtentAndZ(e,r,this.tempTileRange_),s=l.getResolution(r);for(let e=i.minX;e<=i.maxX;++e)for(let o=i.minY;o<=i.maxY;++o){if(f&&!l.tileCoordIntersectsViewport([r,e,o],g))continue;const i=this.getTile(r,e,o,t);if(!i)continue;if(!Ph(n,i,r))continue;const a=i.getKey();if(c[a]=!0,0===i.getState()&&!t.tileQueue.isKeyQueued(a)){const n=Ql(r,e,o,this.tempTileCoord_);t.tileQueue.enqueue([i,h,l.getTileCoordCenter(n),s])}}}}findStaleTile_(t,e){const i=this.tileCache_,n=t[0],r=t[1],s=t[2],o=this.getStaleKeys();for(let t=0;t<o.length;++t){const a=th(this.getLayer().getSource(),o[t],n,r,s);if(i.containsKey(a)){const t=i.peek(a);if(2===t.getState())return t.endTransition(X(this)),Ph(e,t,n),!0}}return!1}findAltTiles_(t,e,i,n){const r=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!r)return!1;let s=!0;const o=this.tileCache_,a=this.getLayer().getRenderSource(),l=a.getKey();for(let t=r.minX;t<=r.maxX;++t)for(let e=r.minY;e<=r.maxY;++e){const r=th(a,l,i,t,e);let h=!1;if(o.containsKey(r)){const t=o.peek(r);2===t.getState()&&(Ph(n,t,i),h=!0)}h||(s=!1)}return s}renderFrame(t,e){this.renderComplete=!0;const i=t.layerStatesArray[t.layerIndex],n=t.viewState,r=n.projection,s=n.resolution,o=n.center,a=t.pixelRatio,l=this.getLayer(),h=l.getSource(),c=h.getTileGridForProjection(r),u=c.getZForResolution(s,h.zDirection),d=c.getResolution(u);this.updateStaleKeys(h.getKey());let f=t.extent;const g=h.getTilePixelRatio(a);this.prepareContainer(t,e);const p=this.context.canvas.width,_=this.context.canvas.height;this.layerExtent=i.extent?Qe(i.extent):null,this.layerExtent&&(f=mt(f,this.layerExtent));const m=d*p/2/g,y=d*_/2/g,x=[o[0]-m,o[1]-y,o[0]+m,o[1]+y],v={};this.renderedTiles.length=0;const S=l.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const e=c.getZForResolution(n.nextResolution,h.zDirection),i=Oh(t,t.nextExtent);this.enqueueTiles(t,i,e,v,S)}const w=Oh(t,f);if(this.enqueueTiles(t,w,u,v,0),S>0&&setTimeout(()=>{this.enqueueTiles(t,w,u-1,v,S-1)},0),!(u in v))return this.container;const C=X(this),b=t.time;for(const e of v[u]){const i=e.getState();if(4===i)continue;const n=e.tileCoord;if(2===i&&1===e.getAlpha(C,b)){e.endTransition(C);continue}if(3!==i&&(this.renderComplete=!1),this.findStaleTile_(n,v)){Fh(v,e,u),t.animate=!0;continue}if(this.findAltTiles_(c,n,u+1,v))continue;const r=c.getMinZoom();for(let t=u-1;t>=r&&!this.findAltTiles_(c,n,t,v);--t);}const T=d/s*a/g,E=this.getRenderContext(t);Li(this.tempTransform,p/2,_/2,T,T,0,-p/2,-_/2),this.layerExtent&&this.clipUnrotated(E,t,this.layerExtent),h.getInterpolate()||(E.imageSmoothingEnabled=!1),this.preRender(E,t);const I=Object.keys(v).map(Number);I.sort(R);const M=[],P=[],F=[];for(let e=I.length-1;e>=0;--e){const i=I[e],n=h.getTilePixelSize(i,a,r),s=c.getResolution(i)/d,o=n[0]*s*T,l=n[1]*s*T,f=c.getTileCoordForCoordAndZ(xt(x),i),p=c.getTileCoordExtent(f),_=ki(this.tempTransform,[g*(p[0]-x[0])/d,g*(x[3]-p[3])/d]),m=g*h.getGutterForProjection(r);for(const e of v[i]){if(2!==e.getState())continue;const n=e.tileCoord,r=f[1]-n[1],s=Math.round(_[0]-(r-1)*o),a=f[2]-n[2],c=Math.round(_[1]-(a-1)*l),d=Math.round(_[0]-r*o),g=Math.round(_[1]-a*l),p=s-d,y=c-g,x=i===u;if(x&&e.inTransition(C)){F.push({tile:e,x:d,y:g,w:p,h:y,gutter:m}),this.renderedTiles.unshift(e),this.updateUsedTiles(t.usedTiles,h,e);continue}const v=[d,g,d+p,g+y],S=[];for(let t=0,e=M.length;t<e;++t)i<P[t]&&wt(v,M[t])&&S.push(M[t]);let w;S.length>0&&(w=Tt(v,S)),M.push(v),P.push(i),this.drawTile(e,t,d,g,p,y,m,x,w),this.renderedTiles.unshift(e),this.updateUsedTiles(t.usedTiles,h,e)}}for(let e=0,i=F.length;e<i;++e){const{tile:i,x:n,y:r,w:s,h:o,gutter:a}=F[e];this.drawTile(i,t,n,r,s,o,a,!0,void 0)}if(this.renderedResolution=d,this.extentChanged=!this.renderedExtent_||!rt(this.renderedExtent_,x),this.renderedExtent_=x,this.renderedPixelRatio=a,this.postRender(this.context,t),this.layerExtent&&E.restore(),E.imageSmoothingEnabled=!0,this.renderComplete){const e=(t,e)=>{const i=X(h),n=e.wantedTiles[i],r=n?Object.keys(n).length:0;this.updateCacheSize(r),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,n,r,s,o,a,l){let h;if(t instanceof vh){if(h=mh(t.getData()),!h)throw new Error("Rendering array data is not yet supported")}else h=this.getTileImage(t);if(!h)return;const c=this.getRenderContext(e),u=X(this),d=e.layerStatesArray[e.layerIndex],f=d.opacity*(a?t.getAlpha(u,e.time):1),g=f!==c.globalAlpha;g&&(c.save(),c.globalAlpha=f);const p=h.width-2*o,_=h.height-2*o;if(l){const t=p/r,e=_/s;for(let r=0,s=l.length;r<s;++r){const s=l[r],a=s[0],u=s[1],d=s[2]-s[0],f=s[3]-s[1];c.drawImage(h,o+(a-i)*t,o+(u-n)*e,d*t,f*e,a,u,d,f)}}else c.drawImage(h,o,o,p,_,i,n,r,s);g&&c.restore(),f!==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 n=X(e);n in t||(t[n]={}),t[n][i.getKey()]=!0}};const Ah={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},Lh={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};var Dh=class extends kh{constructor(t,e){super(t,e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=Mi(),this.tileClipContexts_=null}enqueueTilesForNextExtent(){return"vector"!==this.getLayer().getRenderMode()}drawTile(t,e,i,n,r,s,o,a,l){this.updateExecutorGroup_(t,e.pixelRatio,e.viewState.projection),this.tileImageNeedsRender_(t)&&this.renderTileImage_(t,e),super.drawTile(t,e,i,n,r,s,o,a,l)}getTile(t,e,i,n){const r=this.getOrCreateTile(t,e,i,n);if(!r)return null;const s=n.viewState,o=s.resolution,a=n.viewHints,l=this.getLayer().getSource(),h=l.getTileGridForProjection(s.projection),c=!(a[0]||a[1]),u=h.getZForResolution(o,l.zDirection)===t;return c&&u?r.wantedResolution=o:r.wantedResolution||(r.wantedResolution=h.getResolution(t)),r}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 n=this.getLayer(),r=n.getRevision(),s=n.getRenderOrder()||null,o=t.wantedResolution,a=t.getReplayState(n);if(!a.dirty&&a.renderedResolution===o&&a.renderedRevision==r&&a.renderedPixelRatio===e&&a.renderedRenderOrder==s)return;const l=n.getSource(),h=!!n.getDeclutter(),c=l.getTileGrid(),u=l.getTileGridForProjection(i).getTileCoordExtent(t.wrappedTileCoord),d=l.getSourceTiles(e,i,t),f=X(n);delete t.hitDetectionImageData[f],t.executorGroups[f]=[],a.dirty=!1;for(let r=0,g=d.length;r<g;++r){const g=d[r];if(2!=g.getState())continue;const p=l.getProjection(),_=g.tileCoord;let m=c.getTileCoordExtent(_);i&&p&&!Ye(i,p)&&(m=Ue(m,p,i,32));const y=mt(u,m),x=K(y,n.getRenderBuffer()*o,this.tempExtent),v=rt(m,y)?null:x,S=new Wr(0,y,o,e),w=Ms(o,e),C=function(t,e){let i;const r=t.getStyleFunction()||n.getStyleFunction();if(r&&(i=r(t,o)),i){const n=this.renderFeature(t,w,i,S,h,e);a.dirty=a.dirty||n}},b=g.getFeatures();s&&s!==a.renderedRenderOrder&&b.sort(s);for(let t=0,e=b.length;t<e;++t){let e=b[t];i&&g.projection&&!Ye(i,g.projection)&&(e=e.clone(),e.getGeometry().applyTransform(Ze(g.projection,i))),v&&!wt(v,e.getGeometry().getExtent())||C.call(this,e,t)}const R=S.finish(),T="vector"!==n.getRenderMode()&&h&&1===d.length?null:y,E=new cs(T,o,e,l.getOverlaps(),R,n.getRenderBuffer(),!0);t.executorGroups[f].push(E)}a.renderedRevision=r,a.renderedPixelRatio=e,a.renderedRenderOrder=s,a.renderedResolution=o}forEachFeatureAtCoordinate(t,e,i,n,r){const s=e.viewState.resolution,o=e.viewState.rotation;i=null==i?0:i;const a=this.getLayer(),l=a.getSource().getTileGridForProjection(e.viewState.projection),h=a.getRenderBuffer(),c=U([t]);K(c,s*(h+i),c);const u={},d=function(t,e,i){let s=t.getId();void 0===s&&(s=X(t));const o=u[s];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return u[s]=!0,r.splice(r.lastIndexOf(o),1),n(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return u[s]=!0,n(t,a,e);r.push(u[s]={feature:t,layer:a,geometry:e,distanceSq:i,callback:n})}},f=this.renderedTiles,g=X(a),p=a.getDeclutter(),_=p?e.declutter?.[p]?.all().map(t=>t.value):null;let m;t:for(let e=f.length-1;e>=0;--e){const n=f[e];if(!wt(l.getTileCoordExtent(n.wrappedTileCoord),c))continue;const r=n.executorGroups[g];for(let e=0,n=r.length;e<n;++e)if(m=r[e].forEachFeatureAtCoordinate(t,s,o,i,d,_),m)break t}return m}getFeatures(t){return 0===this.renderedTiles.length?Promise.resolve([]):new Promise((e,i)=>{const n=this.getLayer(),r=n.getSource(),s=this.renderedProjection,o=s.getExtent(),a=this.renderedResolution,l=r.getTileGridForProjection(s),h=ki(this.renderedPixelToCoordinateTransform_,t.slice()),c=l.getTileCoordForCoordAndResolution(h,a).toString(),u=this.renderedTiles.find(t=>t.tileCoord.toString()===c&&2===t.getState());if(!u||u.loadingSourceTiles>0)return void e([]);r.getWrapX()&&s.canWrapX()&&!H(o,l.getTileCoordExtent(u.tileCoord))&&Nt(h,s);const d=X(n),f=xt(l.getTileCoordExtent(u.wrappedTileCoord)),g=[(h[0]-f[0])/a,(f[1]-h[1])/a],p=u.getSourceTiles().reduce((t,e)=>t.concat(e.getFeatures()),[]);let _=u.hitDetectionImageData[d];if(!_){const t=us(l.getTileSize(l.getZForResolution(a,r.zDirection))),e=this.renderedRotation_;_=Rs(t,[this.getRenderTransform(l.getTileCoordCenter(u.wrappedTileCoord),a,0,bs,t[0]*bs,t[1]*bs,0)],p,n.getStyleFunction(),l.getTileCoordExtent(u.wrappedTileCoord),u.getReplayState(n).renderedResolution,e),u.hitDetectionImageData[d]=_}e(Ts(g,p,_))})}getFeaturesInExtent(t){const e=[],i=this.getTileCache();if(0===i.getCount())return e;const n=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),r=n.getZForResolution(this.renderedResolution),s={};return i.forEach(i=>{if(i.tileCoord[0]!==r||2!==i.getState())return;const o=i.getSourceTiles();for(let i=0,r=o.length;i<r;++i){const r=o[i],a=r.getKey();if(a in s)continue;s[a]=!0;const l=r.tileCoord;if(wt(t,n.getTileCoordExtent(l))){const i=r.getFeatures();if(i)for(let n=0,r=i.length;n<r;++n){const r=i[n],s=r.getGeometry();wt(t,s.getExtent())&&e.push(r)}}}}),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,n=i.globalAlpha;i.globalAlpha=e.opacity;const r=t.viewHints,s=!(r[0]||r[1]),o=[this.context.canvas.width,this.context.canvas.height],a=this.getLayer().getDeclutter(),l=a?t.declutter?.[a]:void 0,h=X(this.getLayer()),c=this.renderedTiles;for(let e=0,i=c.length;e<i;++e){const i=c[e],n=i.executorGroups[h];if(n)for(let e=n.length-1;e>=0;--e)n[e].execute(this.context,o,this.getTileRenderTransform(i,t),t.viewState.rotation,s,ss,l)}i.globalAlpha=n}renderDeferredInternal(t){const e=this.renderedTiles,i=X(this.getLayer()),n=e.reduce((t,e,n)=>(e.executorGroups[i].forEach(e=>t.push({executorGroup:e,index:n})),t),[]),r=n.map(({executorGroup:t})=>t.getDeferredZIndexContexts()),s={};for(let t=0,e=n.length;t<e;++t){const e=n[t].executorGroup.getDeferredZIndexContexts();for(const t in e)s[t]=!0}const o=Object.keys(s).map(Number).sort(R);this.layerExtent&&this.clipUnrotated(this.context,t,this.layerExtent),o.forEach(t=>{r.forEach((e,i)=>{e[t]&&(e[t].forEach(t=>{const{executorGroup:e,index:r}=n[i],s=e.getRenderedContext(),o=s.globalAlpha;s.globalAlpha=this.renderedOpacity_;const a=this.tileClipContexts_[r];a&&a.draw(s),t.draw(s),a&&s.restore(),s.globalAlpha=o,t.clear()}),e[t].length=0)})}),this.layerExtent&&this.context.restore()}getTileRenderTransform(t,e){const i=e.pixelRatio,n=e.viewState,r=n.center,s=n.resolution,o=n.rotation,a=e.size,l=Math.round(a[0]*i),h=Math.round(a[1]*i),c=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),u=t.tileCoord,d=c.getTileCoordExtent(t.wrappedTileCoord),f=c.getTileCoordExtent(u,this.tempExtent)[0]-d[0];return Fi(Ai(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(r,s,o,i,l,h,f))}clipTileContext_(t,e,i,n,r,s){const o=[];for(let t=0,s=i.length;t<s;++t)r<n[t]&&wt(e,i[t])&&o.push(i[t]);if(0===o.length)return!1;const a=Tt(e,o);t.save(),t.beginPath();for(let e=0,i=a.length;e<i;++e){const i=a[e],n=ki(s,[i[0],i[1]]),r=ki(s,[i[0],i[3]]),o=ki(s,[i[2],i[3]]),l=ki(s,[i[2],i[1]]);t.moveTo(n[0],n[1]),t.lineTo(r[0],r[1]),t.lineTo(o[0],o[1]),t.lineTo(l[0],l[1]),t.closePath()}return t.clip(),!0}postRender(t,e){const i=e.viewHints,n=!(i[0]||i[1]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation,this.renderedOpacity_=e.layerStatesArray[e.layerIndex].opacity;const r=this.getLayer(),s=r.getRenderMode(),o=t.globalAlpha;t.globalAlpha=this.renderedOpacity_;const a=r.getDeclutter(),l=a?Lh[s].filter(t=>!ss.includes(t)):Lh[s],h=e.viewState,c=h.rotation;this.layerExtent&&this.clipUnrotated(t,e,this.layerExtent);const u=r.getSource(),d=u.getTileGridForProjection(h.projection).getZForResolution(h.resolution,u.zDirection),f=this.renderedTiles,g=[],p=[],_=[],m=X(r);let y=!0;for(let i=f.length-1;i>=0;--i){const s=f[i];y=y&&!s.getReplayState(r).dirty;const o=s.executorGroups[m].filter(t=>t.hasExecutors(l));if(0===o.length)continue;const h=this.getTileRenderTransform(s,e),u=s.tileCoord[0];let x=!1;const v=o[0].getClipCoords(Ei);let S,w=t;if(v){const t=[v[0],v[1],v[4],v[5]];S=new Vr,w=S.getContext(),d!==u&&(x=this.clipTileContext_(w,t,g,p,u,h)),g.push(t),p.push(u)}for(let i=0,r=o.length;i<r;++i)o[i].execute(t,[t.canvas.width,t.canvas.height],h,c,n,l,e.declutter?.[a]);x&&(w===t?w.restore():_[i]=S)}this.layerExtent&&t.restore(),t.globalAlpha=o,this.ready=y,this.tileClipContexts_=_,e.declutter||this.renderDeferredInternal(e),super.postRender(t,e)}renderFeature(t,e,i,n,r,s){if(!i)return!1;let o=!1;if(Array.isArray(i))for(let a=0,l=i.length;a<l;++a)o=Fs(n,t,i[a],e,this.boundHandleStyleImageChange_,void 0,r,s)||o;else o=Fs(n,t,i,e,this.boundHandleStyleImageChange_,void 0,r,s);return o}tileImageNeedsRender_(t){const e=this.getLayer();if("vector"===e.getRenderMode())return!1;const i=t.getReplayState(e),n=e.getRevision(),r=t.wantedResolution;return i.renderedTileResolution!==r||i.renderedTileRevision!==n}renderTileImage_(t,e){const i=this.getLayer(),n=t.getReplayState(i),r=i.getRevision(),s=t.executorGroups[X(i)];n.renderedTileRevision=r;const o=t.wrappedTileCoord,a=o[0],l=i.getSource();let h=e.pixelRatio;const c=e.viewState.projection,u=l.getTileGridForProjection(c),d=u.getResolution(t.tileCoord[0]),f=e.pixelRatio/t.wantedResolution*d,g=u.getResolution(a),p=t.getContext();h=Math.round(Math.max(h,f/h));const _=l.getTilePixelSize(a,h,c);p.canvas.width=_[0],p.canvas.height=_[1];const m=h/f;if(1!==m){const t=Pi(this.tmpTransform_);Ai(t,m,m),p.setTransform.apply(p,t)}const y=u.getTileCoordExtent(o,this.tempExtent),x=f/g,v=Pi(this.tmpTransform_);Ai(v,x,-x),function(t,e,i){Fi(t,Oi(Ii,1,0,0,1,e,i))}(v,-y[0],-y[3]);for(let t=0,e=s.length;t<e;++t)s[t].execute(p,[p.canvas.width*m,p.canvas.height*m],v,0,!0,Ah[i.getRenderMode()],null);n.renderedTileResolution=t.wantedResolution}},jh="preload",Gh="useInterimTilesOnError",Wh=class extends Bl{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 n=t.renderMode||"hybrid";V("hybrid"==n||"vector"==n,"`renderMode` must be `'hybrid'` or `'vector'`"),this.renderMode_=n,this.setPreload(t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError),this.getBackground,this.setBackground}createRenderer(){return new Dh(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(jh)}getUseInterimTilesOnError(){return this.get(Gh)}setPreload(t){this.set(jh,t)}setUseInterimTilesOnError(t){this.set(Gh,t)}};class Xh extends Y{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 Xh,e=this.geometryName_;t.setGeometryName(e);const i=this.getPropertiesInternal();if(i){const n=this.getGeometry();for(const r in i)r===e&&n?t.set(r,n.clone()):t.set(r,i[r],!0)}const n=this.getStyle();return n&&t.setStyle(n),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_&&(w(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=v(t,C,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;return Array.isArray(t)?e=t:(V("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[t]),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_())}}var zh=Xh;class Yh extends xs{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(w),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,i=t.length;e<i;++e)this.changeEventsKeys_.push(v(t[e],C,this.changed,this))}clone(){const t=new Yh(Nh(this.geometries_));return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<$(this.getExtent(),t,e))return n;const r=this.geometries_;for(let s=0,o=r.length;s<o;++s)n=r[s].closestPointXY(t,e,i,n);return n}containsXY(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)if(i[n].containsXY(t,e))return!0;return!1}computeExtent(t){et(t);const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)st(t,e[i].getExtent());return t}getGeometries(){return Nh(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const e=this.geometries_;for(let i=0,n=e.length;i<n;++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 n=!1;for(let r=0,s=i.length;r<s;++r){const s=i[r],o=s.getSimplifiedGeometry(t);e.push(o),o!==s&&(n=!0)}return n?new Yh(e):(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getType(){return"GeometryCollection"}intersectsExtent(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++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 n=0,r=i.length;n<r;++n)i[n].rotate(t,e);this.changed()}scale(t,e,i){i||(i=ft(this.getExtent()));const n=this.geometries_;for(let r=0,s=n.length;r<s;++r)n[r].scale(t,e,i);this.changed()}setGeometries(t){this.setGeometriesArray(Nh(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].applyTransform(t);this.changed()}translate(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)i[n].translate(t,e);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function Nh(t){return t.map(t=>t.clone())}var Bh=Yh;class Zh extends ws{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){M(this.flatCoordinates,t),this.changed()}clone(){const t=new Zh(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<$(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(sl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),al(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,n))}forEachSegment(t){return dl(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,di(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return qn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return ui(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return Xr(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=vi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Zh(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return fl(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=hl(this.flatCoordinates,0,t,this.stride),this.changed()}}var Vh=Zh;class Uh extends ws{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=[],n=[];for(let t=0,r=e.length;t<r;++t)M(i,e[t].getFlatCoordinates()),n.push(i.length);const r=0===e.length?this.getLayout():e[0].getLayout();this.setFlatCoordinates(r,i),this.ends_=n}}appendLineString(t){M(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Uh(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<$(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ol(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ll(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,i,n))}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,n,r,s,o){if(o)return di(t,e,i[i.length-1],n,r,s);let a;if(r<t[n-1])return s?(a=t.slice(0,n),a[n-1]=r,a):null;if(t[t.length-1]<r)return s?(a=t.slice(t.length-n),a[n-1]=r,a):null;for(let s=0,o=i.length;s<o;++s){const o=i[s];if(e!=o){if(r<t[e+n-1])return null;if(r<=t[o-1])return di(t,e,o,n,r,!1);e=o}}return null}(this.flatCoordinates,0,this.ends_,this.stride,t,e,i))}getCoordinates(){return Hn(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new Vh(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,n=[];let r=0;for(let s=0,o=e.length;s<o;++s){const o=e[s],a=new Vh(t.slice(r,o),i);n.push(a),r=o}return n}getLength(){const t=this.ends_;let e=0,i=0;for(let n=0,r=t.length;n<r;++n)i+=Xr(this.flatCoordinates,e,t[n],this.stride),e=t[n];return i}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let i=0;const n=this.ends_,r=this.stride;for(let s=0,o=n.length;s<o;++s){const o=n[s];M(t,ui(e,i,o,r,.5)),i=o}return t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Si(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,i),new Uh(e,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(t){return function(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){if(fl(t,e,i[s],n,r))return!0;e=i[s]}return!1}(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=cl(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}var Kh=Uh;class $h extends ws{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){M(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new $h(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<$(this.getExtent(),t,e))return n;const r=this.flatCoordinates,s=this.stride;for(let o=0,a=r.length;o<a;o+=s){const a=kt(t,e,r[o],r[o+1]);if(a<n){n=a;for(let t=0;t<s;++t)i[t]=r[o+t];i.length=s}}return n}getCoordinates(){return qn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new xl(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,i=this.stride,n=[];for(let r=0,s=t.length;r<s;r+=i){const s=new xl(t.slice(r,r+i),e);n.push(s)}return n}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,i=this.stride;for(let n=0,r=e.length;n<r;n+=i)if(J(t,e[n],e[n+1]))return!0;return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=hl(this.flatCoordinates,0,t,this.stride),this.changed()}}var qh=$h;class Hh extends ws{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 n=t,r=[],s=[];for(let t=0,e=n.length;t<e;++t){const e=n[t],i=r.length,o=e.getEnds();for(let t=0,e=o.length;t<e;++t)o[t]+=i;M(r,e.getFlatCoordinates()),s.push(o)}e=0===n.length?this.getLayout():n[0].getLayout(),t=r,i=s}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;M(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let t=0,n=e.length;t<n;++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 Hh(this.flatCoordinates.slice(),this.layout,e);return i.applyProperties(this),i}closestPointXY(t,e,i,n){return n<$(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(function(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];r=ol(t,e,o,n,r),e=o[o.length-1]}return r}(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),function(t,e,i,n,r,s,o,a,l,h,c){c=c||[NaN,NaN];for(let s=0,u=i.length;s<u;++s){const u=i[s];h=ll(t,e,u,n,r,true,o,a,l,h,c),e=u[u.length-1]}return h}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,0,t,e,i,n))}containsXY(t,e){return function(t,e,i,n,r,s){if(0===i.length)return!1;for(let o=0,a=i.length;o<a;++o){const a=i[o];if(li(t,e,a,n,r,s))return!0;e=a[a.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return function(t,e,i,n){let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s];r+=nl(t,e,o,n),e=o[o.length-1]}return r}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),yi(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,Jn(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=si(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=ci(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new qh(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;_i(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=yi(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,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l],c=[];o=bi(t,e,h,n,r,s,o,c),a.push(c),e=h[h.length-1]}return o}(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new Hh(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(),n=i[i.length-1];if(0!==e)for(let t=0,n=i.length;t<n;++t)i[t]-=e;return new Sl(this.flatCoordinates.slice(e,n),this.layout,i)}getPolygons(){const t=this.layout,e=this.flatCoordinates,i=this.endss_,n=[];let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s].slice(),a=o[o.length-1];if(0!==r)for(let t=0,e=o.length;t<e;++t)o[t]-=r;const l=new Sl(e.slice(r,a),t,o);n.push(l),r=a}return n}getType(){return"MultiPolygon"}intersectsExtent(t){return function(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];if(pl(t,e,o,n,r))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=ul(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()}}var Jh=Hh,Qh=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=zh,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let i=e.dataProjection?Ge(e.dataProjection):this.readProjection(t);e.extent&&i&&"tile-pixels"===i.getUnits()&&(i=Ge(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 G()}readFeature(t,e){return G()}readFeatures(t,e){return G()}readGeometry(t,e){return G()}readProjection(t){return G()}writeFeature(t,e){return G()}writeFeatures(t,e){return G()}writeGeometry(t,e){return G()}};function tc(t,e,i){const n=i?Ge(i.featureProjection):null,r=i?Ge(i.dataProjection):null;let s=t;if(n&&r&&!Ye(n,r)){e&&(s=t.clone());const i=e?n:r,o=e?r:n;"tile-pixels"===i.getUnits()?s.transform(i,o):s.applyTransform(Ze(i,o))}if(e&&i&&void 0!==i.decimals){const e=Math.pow(10,i.decimals),n=function(t){for(let i=0,n=t.length;i<n;++i)t[i]=Math.round(t[i]*e)/e;return t};s===t&&(s=t.clone()),s.applyTransform(n)}return s}const ec={Point:xl,LineString:Vh,Polygon:Sl,MultiPoint:qh,MultiLineString:Kh,MultiPolygon:Jh};function ic(t,e){const i=t.geometry;if(!i)return[];if(Array.isArray(i))return i.map(e=>ic({...t,geometry:e})).flat();const n="MultiPolygon"===i.type?"Polygon":i.type;if("GeometryCollection"===n||"Circle"===n)throw new Error("Unsupported geometry type: "+n);const r=i.layout.length;return tc(new Xi(n,"Polygon"===n?function(t,e,i){return Array.isArray(e[0])?(_i(t,0,e,i)||yi(t=t.slice(),0,e,i),t):(pi(t,0,e,i)||mi(t=t.slice(),0,e,i),t)}(i.flatCoordinates,i.ends,r):i.flatCoordinates,i.ends?.flat(),r,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function nc(t,e){if(!t)return null;if(Array.isArray(t)){const i=t.map(t=>nc(t,e));return new Bh(i)}return tc(new(0,ec[t.type])(t.flatCoordinates,t.layout||"XY",t.ends),!1,e)}function rc(t){if("string"==typeof t){return JSON.parse(t)||null}return null!==t?t:null}var sc=class extends Qh{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(rc(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(rc(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return G()}readFeaturesFromObject(t,e){return G()}readGeometry(t,e){return this.readGeometryFromObject(rc(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return G()}readProjection(t){return this.readProjectionFromObject(rc(t))}readProjectionFromObject(t){return G()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return G()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return G()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return G()}};function oc(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:vs(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:vs(e[0]?.length||2)}}(t);break;case"Polygon":i=function(t){const e=t.coordinates,i=[],n=e[0]?.[0]?.length;return{type:"Polygon",flatCoordinates:i,ends:cl(i,0,e,n),layout:vs(n)}}(t);break;case"MultiPoint":i=function(t){const e=t.coordinates;return{type:"MultiPoint",flatCoordinates:e.flat(),layout:vs(e[0]?.length||2)}}(t);break;case"MultiLineString":i=function(t){const e=t.coordinates,i=e[0]?.[0]?.length||2,n=[];return{type:"MultiLineString",flatCoordinates:n,ends:cl(n,0,e,i),layout:vs(i)}}(t);break;case"MultiPolygon":i=function(t){const e=t.coordinates,i=[],n=e[0]?.[0]?.[0].length||2;return{type:"MultiPolygon",flatCoordinates:i,ends:ul(i,0,e,n),layout:vs(n)}}(t);break;case"GeometryCollection":i=function(t){const e=t.geometries.map(function(t){return oc(t)});return e}(t);break;default:throw new Error("Unsupported GeoJSON type: "+t.type)}return i}function ac(t,e){const i=(t=tc(t,!0,e)).getType();let n;switch(i){case"Point":n=function(t){return{type:"Point",coordinates:t.getCoordinates()}}(t);break;case"LineString":n=function(t){return{type:"LineString",coordinates:t.getCoordinates()}}(t);break;case"Polygon":n=function(t,e){let i;return e&&(i=e.rightHanded),{type:"Polygon",coordinates:t.getCoordinates(i)}}(t,e);break;case"MultiPoint":n=function(t){return{type:"MultiPoint",coordinates:t.getCoordinates()}}(t);break;case"MultiLineString":n=function(t){return{type:"MultiLineString",coordinates:t.getCoordinates()}}(t);break;case"MultiPolygon":n=function(t,e){let i;return e&&(i=e.rightHanded),{type:"MultiPolygon",coordinates:t.getCoordinates(i)}}(t,e);break;case"GeometryCollection":n=function(t,e){delete(e=Object.assign({},e)).featureProjection;return{type:"GeometryCollection",geometries:t.getGeometriesArray().map(function(t){return ac(t,e)})}}(t,e);break;case"Circle":n={type:"GeometryCollection",geometries:[]};break;default:throw new Error("Unsupported geometry type: "+i)}return n}const lc=4294967296,hc="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class cc{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 n;for(;n=this.nextField(i);)t(n,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)*lc;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*lc;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 n,r=127&i;return n=e[this.pos++],r|=(127&n)<<7,n<128?r:(n=e[this.pos++],r|=(127&n)<<14,n<128?r:(n=e[this.pos++],r|=(127&n)<<21,n<128?r:(n=e[this.pos],r|=(15&n)<<28,function(t,e,i){const n=i.buf;let r,s;if(s=n[i.pos++],r=(112&s)>>4,s<128)return uc(t,r,e);if(s=n[i.pos++],r|=(127&s)<<3,s<128)return uc(t,r,e);if(s=n[i.pos++],r|=(127&s)<<10,s<128)return uc(t,r,e);if(s=n[i.pos++],r|=(127&s)<<17,s<128)return uc(t,r,e);if(s=n[i.pos++],r|=(127&s)<<24,s<128)return uc(t,r,e);if(s=n[i.pos++],r|=(1&s)<<31,s<128)return uc(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(r,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&&hc?hc.decode(this.buf.subarray(e,t)):function(t,e,i){let n="",r=e;for(;r<i;){const e=t[r];let s,o,a,l=null,h=e>239?4:e>223?3:e>191?2:1;if(r+h>i)break;1===h?e<128&&(l=e):2===h?(s=t[r+1],128==(192&s)&&(l=(31&e)<<6|63&s,l<=127&&(l=null))):3===h?(s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&(l=(15&e)<<12|(63&s)<<6|63&o,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===h&&(s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&e)<<18|(63&s)<<12|(63&o)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,h=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),r+=h}return n}(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 uc(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function dc(t,e,i){if(3===t){const t={keys:[],values:[],features:[]},n=i.readVarint()+i.pos;i.readFields(fc,t,n),t.length=t.features.length,t.length&&(e[t.name]=t)}}function fc(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 n=null;const r=i.readVarint()+i.pos;for(;i.pos<r;)n=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(n)}}function gc(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()],n=e.layer.values[i.readVarint()];e.properties[t]=n}}else 3==t?e.type=i.readVarint():4==t&&(e.geometry=i.pos)}function pc(t,e,i){t.pos=e.features[i];const n=t.readVarint()+t.pos,r={layer:e,type:0,properties:{}};return t.readFields(gc,r,n),r}var _c=class extends Qh{constructor(t){super(),t=t||{},this.dataProjection=new Zt({code:"",units:"tile-pixels"}),this.featureClass=t.featureClass?t.featureClass:Xi,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,n){t.pos=e.geometry;const r=t.readVarint()+t.pos;let s=1,o=0,a=0,l=0,h=0,c=0;for(;t.pos<r;){if(!o){const e=t.readVarint();s=7&e,o=e>>3}if(o--,1===s||2===s)a+=t.readSVarint(),l+=t.readSVarint(),1===s&&h>c&&(n.push(h),c=h),i.push(a,l),h+=2;else{if(7!==s)throw new Error("Invalid command found in the PBF");h>c&&(i.push(i[c],i[c+1]),h+=2)}}h>c&&(n.push(h),c=h)}createFeature_(t,e,i){const n=e.type;if(0===n)return null;let r;const s=e.properties;let o;this.idProperty_?(o=s[this.idProperty_],delete s[this.idProperty_]):o=e.id,s[this.layerName_]=e.layer.name;const a=[],l=[];this.readRawGeometry_(t,e,a,l);const h=function(t,e){let i;return 1===t?i=1===e?"Point":"MultiPoint":2===t?i=1===e?"LineString":"MultiLineString":3===t&&(i="Polygon"),i}(n,l.length);if(this.featureClass===Xi)r=new this.featureClass(h,a,l,2,s,o),r.transform(i.dataProjection);else{let t;if("Polygon"==h){const e=xi(a,l);t=e.length>1?new Jh(a,"XY",e):new Sl(a,"XY",l)}else t="Point"===h?new xl(a,"XY"):"LineString"===h?new Vh(a,"XY"):"MultiPoint"===h?new qh(a,"XY"):"MultiLineString"===h?new Kh(a,"XY",l):null;r=new(0,this.featureClass),this.geometryName_&&r.setGeometryName(this.geometryName_);const e=tc(t,!1,i);r.setGeometry(e),void 0!==o&&r.setId(o),r.setProperties(s,!0)}return r}getType(){return"arraybuffer"}readFeatures(t,e){const i=this.layers_,n=Ge((e=this.adaptOptions(e)).dataProjection);n.setWorldExtent(e.extent),e.dataProjection=n;const r=new cc(t),s=r.readFields(dc,{}),o=[];for(const t in s){if(i&&!i.includes(t))continue;const a=s[t],l=a?[0,0,a.extent,a.extent]:null;n.setExtent(l);for(let t=0,i=a.length;t<i;++t){const i=pc(r,a,t),n=this.createFeature_(r,i,e);null!==n&&o.push(n)}}return o}readProjection(t){return this.dataProjection}setLayers(t){this.layers_=t}},mc=i(619),yc=function(t,e){if(t.hasStroke)return new xa({color:(0,r.o)(t.style.stroke,e),width:t.style.strokeWidth,lineDash:t.style.strokeDashArray})};function xc(t){return xc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xc(t)}function vc(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function Sc(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?vc(Object(i),!0).forEach(function(e){wc(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):vc(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function wc(t,e,i){return(e=function(t){var e=function(t){if("object"!=xc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=xc(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==xc(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var Cc="EPSG:27700",bc=new class extends sc{constructor(t){t=t||{},super(),this.dataProjection=Ge(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=Ge(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 n=oc(i.geometry);if(this.featureClass===Xi)return ic({geometry:n,id:i.id,properties:i.properties},e);const r=new(0,this.featureClass);return this.geometryName_?r.setGeometryName(this.geometryName_):this.extractGeometryName_&&i.geometry_name&&r.setGeometryName(i.geometry_name),r.setGeometry(nc(n,e)),"id"in i&&r.setId(i.id),i.properties&&r.setProperties(i.properties,!0),r}readFeaturesFromObject(t,e){let i=null;if("FeatureCollection"===t.type){i=[];const n=t.features;for(let t=0,r=n.length;t<r;++t){const r=this.readFeatureFromObject(n[t],e);r&&i.push(r)}}else i=[this.readFeatureFromObject(t,e)];return i.flat()}readGeometryFromObject(t,e){return function(t,e){return nc(oc(t),e)}(t,e)}readProjectionFromObject(t){const e=t.crs;let i;if(e)if("name"==e.type)i=Ge(e.properties.name);else{if("EPSG"!==e.type)throw new Error("Unknown SRS type");i=Ge("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},n=t.getId();if(void 0!==n&&(i.id=n),!t.hasProperties())return i;const r=t.getProperties(),s=t.getGeometry();return s&&(i.geometry=ac(s,e),delete r[t.getGeometryName()]),x(r)||(i.properties=r),i}writeFeaturesObject(t,e){e=this.adaptOptions(e);const i=[];for(let n=0,r=t.length;n<r;++n)i.push(this.writeFeatureObject(t[n],e));return{type:"FeatureCollection",features:i}}writeGeometryObject(t,e){return ac(t,this.adaptOptions(e))}}({dataProjection:Cc,featureProjection:Cc}),Rc=1e-6,Tc=13e5,Ec=[0,0,Tc,Tc],Ic=new ih({extent:Ec,origin:[Ec[0],Ec[3]],resolutions:Array.from({length:25},function(t,e){return(Ec[2]-Ec[0])/(256*Math.pow(2,e))}),tileSize:256}),Mc=function(t,e){if(!e)return bc.readFeatures(t);var i=Sc(Sc({},t),{},{features:t.features.map(function(t){var i,n;return Sc(Sc({},t),{},{id:null!==(i=null===(n=t.properties)||void 0===n?void 0:n[e])&&void 0!==i?i:t.id})})});return bc.readFeatures(i)},Pc=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.hasPattern?function(t,e){var i=e.mapStyleId,n=e.pixelRatio,r=e.patternRegistry,s=e.getPatternFill,o=e.buildFilterEvaluator,a=r.getPatternImageId(t.style,i,n),l=a&&s(a),h=l?new ba({fill:l,stroke:yc(t,i)}):void 0,c=o(t.filter);return function(t){if(h&&(!c||c(t)))return h}}(t,e):t.getFlatStyle(e)};function Fc(t){return Fc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fc(t)}function Oc(){var t,e,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",r=i.toStringTag||"@@toStringTag";function s(i,n,r,s){var l=n&&n.prototype instanceof a?n:a,h=Object.create(l.prototype);return kc(h,"_invoke",function(i,n,r){var s,a,l,h=0,c=r||[],u=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return s=e,a=0,l=t,d.n=i,o}};function f(i,n){for(a=i,l=n,e=0;!u&&h&&!r&&e<c.length;e++){var r,s=c[e],f=d.p,g=s[2];i>3?(r=g===n)&&(l=s[(a=s[4])?5:(a=3,3)],s[4]=s[5]=t):s[0]<=f&&((r=i<2&&f<s[1])?(a=0,d.v=n,d.n=s[1]):f<g&&(r=i<3||s[0]>n||n>g)&&(s[4]=i,s[5]=n,d.n=g,a=0))}if(r||i>1)return o;throw u=!0,n}return function(r,c,g){if(h>1)throw TypeError("Generator is already running");for(u&&1===c&&f(c,g),a=c,l=g;(e=a<2?t:l)||!u;){s||(a?a<3?(a>1&&(d.n=-1),f(a,l)):d.n=l:d.v=l);try{if(h=2,s){if(a||(r="next"),e=s[r]){if(!(e=e.call(s,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,a<2&&(a=0)}else 1===a&&(e=s.return)&&e.call(s),a<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),a=1);s=t}else if((e=(u=d.n<0)?l:i.call(n,d))!==o)break}catch(e){s=t,a=1,l=e}finally{h=1}}return{value:e,done:u}}}(i,r,s),!0),h}var o={};function a(){}function l(){}function h(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(kc(e={},n,function(){return this}),e),u=h.prototype=a.prototype=Object.create(c);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,kc(t,r,"GeneratorFunction")),t.prototype=Object.create(u),t}return l.prototype=h,kc(u,"constructor",h),kc(h,"constructor",l),l.displayName="GeneratorFunction",kc(h,r,"GeneratorFunction"),kc(u),kc(u,r,"Generator"),kc(u,n,function(){return this}),kc(u,"toString",function(){return"[object Generator]"}),(Oc=function(){return{w:s,m:d}})()}function kc(t,e,i,n){var r=Object.defineProperty;try{r({},"",{})}catch(t){r=0}kc=function(t,e,i,n){function s(e,i){kc(t,e,function(t){return this._invoke(e,i,t)})}e?r?r(t,e,{value:i,enumerable:!n,configurable:!n,writable:!n}):t[e]=i:(s("next",0),s("throw",1),s("return",2))},kc(t,e,i,n)}function Ac(t,e,i,n,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,r)}function Lc(t){return function(){var e=this,i=arguments;return new Promise(function(n,r){var s=t.apply(e,i);function o(t){Ac(s,n,r,o,a,"next",t)}function a(t){Ac(s,n,r,o,a,"throw",t)}o(void 0)})}}function Dc(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,jc(n.key),n)}}function jc(t){var e=function(t){if("object"!=Fc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=Fc(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Fc(e)?e:e+""}function Gc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Gc=function(){return!!t})()}function Wc(t){return Wc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wc(t)}function Xc(t,e){return Xc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Xc(t,e)}var zc=function(t){function e(t,i,n,r){var s;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(s=function(t,e,i){return e=Wc(e),function(t,e){if(e&&("object"==Fc(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Gc()?Reflect.construct(e,i||[],Wc(t).constructor):e.apply(t,i))}(this,e,[t,i,n,r]))._sourcesById=new Map,s._layersById=new Map,s.createDataset=s.createDataset.bind(s),s}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Xc(t,e)}(e,t),i=e,n=[{key:"createDataset",value:function(t,e){return new f(t,e)}},{key:"_styleContext",get:function(){var t,e=this;return{mapStyleId:null===(t=this._datasetRegistry.mapStyle)||void 0===t?void 0:t.id,pixelRatio:this._pixelRatio,patternRegistry:this._patternRegistry,symbolRegistry:this._symbolRegistry,getSymbolDataUri:function(t){return e._mapProvider.getSymbolDataUri(t)},getPatternFill:function(t){return e._mapProvider.getPatternFill(t)},buildFilterEvaluator:function(t){return e._mapProvider.buildFilterEvaluator(t)}}}},{key:"init",value:(h=Lc(Oc().m(function t(){var e=this;return Oc().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,Promise.all([this._registerPatterns(),this._registerSymbols()]);case 1:this._datasetRegistry.forEachDataset(function(t){return e._addLayers(t)});case 2:return t.a(2)}},t,this)})),function(){return h.apply(this,arguments)})},{key:"destroy",value:function(){var t=this;this._layersById.forEach(function(e){return t._map.removeLayer(e)}),this._layersById.clear(),this._sourcesById.clear()}},{key:"onMapStyleChange",value:(l=Lc(Oc().m(function t(){var e=this;return Oc().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,Promise.all([this._registerPatterns(),this._registerSymbols()]);case 1:this._datasetRegistry.forEachDataset(function(t){return e._forEachLeafDataset(t,function(t){e._setLayerStyle(t)})}),this._reapplyHighlights();case 2:return t.a(2)}},t,this)})),function(){return l.apply(this,arguments)})},{key:"onMapSizeChange",value:(a=Lc(Oc().m(function t(){var e,i=this;return Oc().w(function(t){for(;;)switch(t.n){case 0:return e=this._pixelRatio,t.n=1,Promise.all([this._registerPatterns(),this._registerSymbols()]);case 1:if(this._pixelRatio===e){t.n=2;break}return t.a(2);case 2:this._datasetRegistry.forEachDataset(function(t){return i._forEachLeafDataset(t,function(t){(t.hasPattern||t.hasSymbol)&&i._setLayerStyle(t)})}),this._reapplyHighlights();case 3:return t.a(2)}},t,this)})),function(){return a.apply(this,arguments)})},{key:"_reapplyHighlights",value:function(){this._mapProvider.reapplyHighlights()}},{key:"_registerPatternsAndSymbols",value:function(t){return Promise.all([this._registerPatterns([t]),this._registerSymbols([t])])}},{key:"removeDataset",value:function(t){var e=this,i=this._datasetRegistry.getDataset(t);if(i){i.layerIds.forEach(function(t){var i=e._layersById.get(t);i&&(e._map.removeLayer(i),e._layersById.delete(t))});var n=i.sourceId;this._datasetRegistry.topLevelDatasets().some(function(e){return e.id!==t&&e.sourceId===n})||this._sourcesById.delete(n)}}},{key:"applyStyle",value:(o=Lc(Oc().m(function t(e){var i,n=this;return Oc().w(function(t){for(;;)switch(t.n){case 0:if(i=this._datasetRegistry.getDataset(e)){t.n=1;break}return t.a(2);case 1:return t.n=2,this._registerPatternsAndSymbols(i);case 2:this._forEachLeafDataset(i,function(t){n._layersById.has(t.id)?n._setLayerStyle(t):n._addLayers(t)});case 3:return t.a(2)}},t,this)})),function(t){return o.apply(this,arguments)})},{key:"_setLayerOpacity",value:function(t,e){var i;null===(i=this._layersById.get(t))||void 0===i||i.setOpacity(e)}},{key:"_setLayerVisibility",value:function(t,e){var i;null===(i=this._layersById.get(t))||void 0===i||i.setVisible("visible"===e)}},{key:"applyFeatureFilter",value:function(t){var e=this,i=this._datasetRegistry.getDataset(t);i&&this._forEachLeafDataset(i,function(t){e._setLayerStyle(t)})}},{key:"setData",value:function(t,e){var i,n=this._datasetRegistry.getDataset(t),r=n&&this._sourcesById.get(n.sourceId);r&&(r.clear(),null!=e&&null!==(i=e.features)&&void 0!==i&&i.length&&r.addFeatures(Mc(e,n.idStrategy)))}},{key:"_registerPatterns",value:(s=Lc(Oc().m(function t(){var e,i,n,r=this,s=arguments;return Oc().w(function(t){for(;;)switch(t.n){case 0:if(e=s.length>0&&void 0!==s[0]?s[0]:this._datasetRegistry.topLevelDatasets(),i=[],e.forEach(function(t){return r._forEachLeafDataset(t,function(t){t.hasPattern&&i.push(t.style)})}),!i.length){t.n=1;break}return t.n=1,this._mapProvider.addPatternsToMap(i,null===(n=this._datasetRegistry.mapStyle)||void 0===n?void 0:n.id,this._patternRegistry,this._pixelRatio);case 1:return t.a(2)}},t,this)})),function(){return s.apply(this,arguments)})},{key:"_registerSymbols",value:(r=Lc(Oc().m(function t(){var e,i,n=this,r=arguments;return Oc().w(function(t){for(;;)switch(t.n){case 0:if(e=r.length>0&&void 0!==r[0]?r[0]:this._datasetRegistry.topLevelDatasets(),i=[],e.forEach(function(t){return n._forEachLeafDataset(t,function(t){t.hasSymbol&&i.push(t.style)})}),!i.length){t.n=1;break}return t.n=1,this._mapProvider.addSymbolsToMap(i,this._datasetRegistry.mapStyle,this._symbolRegistry,this._pixelRatio);case 1:return t.a(2)}},t,this)})),function(){return r.apply(this,arguments)})},{key:"_setLayerStyle",value:function(t){var e=this._layersById.get(t.id);if(e)try{e.setStyle(Pc(t,this._styleContext)),t.hasSymbol&&e.set("symbolMeta",t.getSymbolMeta(this._styleContext))}catch(e){mc.v.warn('OpenLayers datasets adapter: failed to build a style for dataset "'.concat(t.id,'" — ').concat(e.message))}}},{key:"_forEachLeafDataset",value:function(t,e){var i=this;t.hasSublayers?t.sublayers.forEach(function(t){return i._forEachLeafDataset(t,e)}):e(t)}},{key:"_getOrCreateSource",value:function(t){var e,i=t.sourceId;if(this._sourcesById.has(i))return this._sourcesById.get(i);try{e=function(t){var e=t.source,i=t.id,n=t.idStrategy;if(!e)return null;if("geojson"===e.type){var r,s=new dn;return"string"==typeof e.data?function(t,e,i,n){fetch(e).then(function(t){if(!t.ok)throw new Error("".concat(t.status," ").concat(t.statusText));return t.json()}).then(function(e){return t.addFeatures(Mc(e,i))}).catch(function(t){return mc.v.warn('OpenLayers datasets adapter: failed to fetch geojson for dataset "'.concat(n,'" — ').concat(t.message))})}(s,e.data,n,i):null!==(r=e.data)&&void 0!==r&&null!==(r=r.features)&&void 0!==r&&r.length&&s.addFeatures(Mc(e.data,n)),s}if("vector"===e.type){var o=Array.isArray(e.tiles)?e.tiles:[e.tiles];return new ph({format:new _c({featureClass:zh,idProperty:n||void 0}),urls:o,projection:Cc,tileGrid:Ic})}return mc.v.warn('OpenLayers datasets adapter: unsupported source type "'.concat(e.type,'" (dataset "').concat(i,'")')),null}(t)}catch(e){return mc.v.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}},{key:"_addLayers",value:function(t){var e=this;if(t.hasSublayers)return this._getOrCreateSource(t),void t.sublayers.forEach(function(t){return e._addLayers(t)});if(t.leafLayerIds.length){var i=this._getOrCreateSource(t);if(i){var n;try{n=function(t,e,i){var n,r,s=e instanceof ph,o=new(s?Wh:Zl)(Sc({source:e,style:Pc(t,i),opacity:t.opacity,visible:"visible"===t.visibility,minZoom:(r=t.minZoom,void 0===r?void 0:r-Rc),maxZoom:(n=t.maxZoom,void 0===n?void 0:n-Rc),zIndex:t.hasSymbol?1:0},s?{renderMode:"vector"}:{}));return o.set("layerType",s?"vectorTile":"vector"),o.set("layerId",t.id),t.filter&&o.set("filter",t.filter),t.hasSymbol&&o.set("symbolMeta",t.getSymbolMeta(i)),o}(t,i,this._styleContext)}catch(e){return void mc.v.warn('OpenLayers datasets adapter: failed to build a style for dataset "'.concat(t.id,'" — ').concat(e.message))}this._map.addLayer(n),this._layersById.set(t.id,n)}}}}],n&&Dc(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,n,r,s,o,a,l,h}(g.h)},416:function(t,e,i){i.d(e,{f:function(){return f}});var n=i(428);function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}var s=function(t){var e,i=0,n=2166136261,s=function(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return r(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?r(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,s=function(){};return{s:s,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return a=t.done,t},e:function(t){l=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(l)throw o}}}}(t);try{for(s.s();!(e=s.n()).done;){var o=e.value.codePointAt(0);i=Math.imul(i,31)+o,n=Math.imul(n^o,16777619)}}catch(t){s.e(t)}finally{s.f()}return(i>>>0).toString(36)+(n>>>0).toString(36)};function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function l(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,h(n.key),n)}}function h(t){var e=function(t){if("object"!=o(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=o(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==o(e)?e:e+""}function c(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(c=function(){return!!t})()}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}function d(t,e){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},d(t,e)}var f=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,i){return e=u(e),function(t,e){if(e&&("object"==o(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,c()?Reflect.construct(e,i||[],u(t).constructor):e.apply(t,i))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e)}(e,t),i=e,n=[{key:"_hiddenFeaturesIdExpression",get:function(){return this.hasDynamicGeoJSON?this.dynamicGeoJSON.hiddenFeaturesIdExpression:this.idProperty?["to-string",["get",this.idProperty]]:["to-string",["id"]]}},{key:"_hiddenFeaturesFilter",get:function(){var t,e=null===(t=this.hiddenFeatures)||void 0===t?void 0:t.filter(function(t){return-1!==t});return null!=e&&e.length?["!",["in",this._hiddenFeaturesIdExpression,["literal",e.map(String)]]]:null}},{key:"filter",get:function(){var t,e=["all"];null!==(t=this.parent)&&void 0!==t&&t.filter&&e.push(this.parent.filter),this._datasetDefinition.filter&&e.push(this._datasetDefinition.filter);var i=this._hiddenFeaturesFilter;return i&&e.push(i),1===e.length?null:e.length>2?e:e[1]}},{key:"leafLayerIds",get:function(){return[]}},{key:"layerIds",get:function(){return this.hasSublayers?this.sublayers.flatMap(function(t){return t.layerIds}).filter(Boolean):this.leafLayerIds}},{key:"getLayersWithValue",value:function(t){var e,i,n,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=[];if(!1===r||this[r]){var o=this.leafLayerIds;if(o.length){var l=this[t];s.push((e={layerIds:o},n=l,(i=h(i=t))in e?Object.defineProperty(e,i,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[i]=n,e))}}return this.hasSublayers&&this.sublayers.forEach(function(e){if(!1===r||e[r]){var i=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return a(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?a(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(e.getLayersWithValue(t),1)[0];i&&s.push(i)}}),s}},{key:"getLayersWithVisibility",value:function(){return this.getLayersWithValue("visibility")}},{key:"getLayersWithOpacity",value:function(){return this.getLayersWithValue("opacity")}},{key:"getLayersWithFilters",value:function(){return this.getLayersWithValue("filter","hasHiddenFeatures")}},{key:"sourceId",get:function(){if(this.isSublayer)return this.parent.sourceId;if(this.hasDynamicGeoJSON)return this.dynamicGeoJSON.sourceId;if(this.tiles){var t=Array.isArray(this.tiles)?this.tiles.join(","):this.tiles;return"tiles-".concat(s(t))}return this.geojson?"string"==typeof this.geojson?"geojson-".concat(s(this.geojson)):"geojson-".concat(this.id):"source-".concat(this.id)}}],n&&l(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,n}(n.j)},247:function(t,e,i){function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}i.d(e,{o:function(){return r}});var r=function(t,e){if(!t)return null;if("string"==typeof t)return t.trim();if("object"===n(t)){if(e&&t[e])return t[e];var i=Object.values(t)[0];return null!=i?i:null}return null}}}]);
2
+ "use strict";(Object("undefined"!=typeof self?self:this).webpackChunkdefra_DefraMap=Object("undefined"!=typeof self?self:this).webpackChunkdefra_DefraMap||[]).push([[809],{913:function(t,e,i){function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function r(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,s(n.key),n)}}function s(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function a(){var t,e,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",r=i.toStringTag||"@@toStringTag";function s(i,n,r,s){var a=n&&n.prototype instanceof h?n:h,c=Object.create(a.prototype);return l(c,"_invoke",function(i,n,r){var s,a,l,h=0,c=r||[],u=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return s=e,a=0,l=t,d.n=i,o}};function f(i,n){for(a=i,l=n,e=0;!u&&h&&!r&&e<c.length;e++){var r,s=c[e],f=d.p,g=s[2];i>3?(r=g===n)&&(l=s[(a=s[4])?5:(a=3,3)],s[4]=s[5]=t):s[0]<=f&&((r=i<2&&f<s[1])?(a=0,d.v=n,d.n=s[1]):f<g&&(r=i<3||s[0]>n||n>g)&&(s[4]=i,s[5]=n,d.n=g,a=0))}if(r||i>1)return o;throw u=!0,n}return function(r,c,g){if(h>1)throw TypeError("Generator is already running");for(u&&1===c&&f(c,g),a=c,l=g;(e=a<2?t:l)||!u;){s||(a?a<3?(a>1&&(d.n=-1),f(a,l)):d.n=l:d.v=l);try{if(h=2,s){if(a||(r="next"),e=s[r]){if(!(e=e.call(s,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,a<2&&(a=0)}else 1===a&&(e=s.return)&&e.call(s),a<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),a=1);s=t}else if((e=(u=d.n<0)?l:i.call(n,d))!==o)break}catch(e){s=t,a=1,l=e}finally{h=1}}return{value:e,done:u}}}(i,r,s),!0),c}var o={};function h(){}function c(){}function u(){}e=Object.getPrototypeOf;var d=[][n]?e(e([][n]())):(l(e={},n,function(){return this}),e),f=u.prototype=h.prototype=Object.create(d);function g(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,l(t,r,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=u,l(f,"constructor",u),l(u,"constructor",c),c.displayName="GeneratorFunction",l(u,r,"GeneratorFunction"),l(f),l(f,r,"Generator"),l(f,n,function(){return this}),l(f,"toString",function(){return"[object Generator]"}),(a=function(){return{w:s,m:g}})()}function l(t,e,i,n){var r=Object.defineProperty;try{r({},"",{})}catch(t){r=0}l=function(t,e,i,n){function s(e,i){l(t,e,function(t){return this._invoke(e,i,t)})}e?r?r(t,e,{value:i,enumerable:!n,configurable:!n,writable:!n}):t[e]=i:(s("next",0),s("throw",1),s("return",2))},l(t,e,i,n)}function h(t,e,i,n,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,r)}function c(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,u(n.key),n)}}function u(t){var e=function(t){if("object"!=o(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=o(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==o(e)?e:e+""}function d(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(d=function(){return!!t})()}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function g(t,e){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},g(t,e)}i.d(e,{h:function(){return p}});var p=function(t){function e(t,i,n,r){var s;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(s=function(t,e,i){return e=f(e),function(t,e){if(e&&("object"==o(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,d()?Reflect.construct(e,i||[],f(t).constructor):e.apply(t,i))}(this,e))._mapProvider=t,s._map=t.map,s._symbolRegistry=i,s._patternRegistry=n,s._datasetRegistry=r,s}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&g(t,e)}(e,t),i=e,n=[{key:"_pixelRatio",get:function(){return this._map.getPixelRatio()}},{key:"addDataset",value:(r=a().m(function t(e){var i;return a().w(function(t){for(;;)switch(t.n){case 0:if(i=this._datasetRegistry.getDataset(e)){t.n=1;break}return t.a(2);case 1:return t.n=2,this._registerPatternsAndSymbols(i);case 2:this._addLayers(i);case 3:return t.a(2)}},t,this)}),s=function(){var t=this,e=arguments;return new Promise(function(i,n){var s=r.apply(t,e);function o(t){h(s,i,n,o,a,"next",t)}function a(t){h(s,i,n,o,a,"throw",t)}o(void 0)})},function(t){return s.apply(this,arguments)})},{key:"applyDatasetOpacity",value:function(t){var e=this._datasetRegistry.getDataset(t);e&&this._applyRegistryDatasetOpacity(e)}},{key:"_applyRegistryDatasetOpacity",value:function(t){var e=this;t.getLayersWithOpacity().forEach(function(t){var i=t.layerIds,n=t.opacity;i.forEach(function(t){return e._setLayerOpacity(t,n)})})}},{key:"applyGlobalOpacity",value:function(){var t=this;this._datasetRegistry.forEachDataset(function(e){return t._applyRegistryDatasetOpacity(e)})}},{key:"applyDatasetVisibility",value:function(t){var e=this._datasetRegistry.getDataset(t);e&&this._applyRegistryDatasetVisibility(e)}},{key:"_applyRegistryDatasetVisibility",value:function(t){var e=this;t.getLayersWithVisibility().forEach(function(t){var i=t.layerIds,n=t.visibility;i.forEach(function(t){return e._setLayerVisibility(t,n)})})}},{key:"applyGlobalVisibility",value:function(){var t=this;this._datasetRegistry.forEachDataset(function(e){return t._applyRegistryDatasetVisibility(e)})}}],n&&c(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,n,r,s}(function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},(e=[{key:"attachDynamicSources",value:function(t){this._dynamicSources=t}},{key:"dynamicSources",get:function(){return this._dynamicSources}}])&&r(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}())},382:function(t,e,i){i.r(e),i.d(e,{default:function(){return zc}});var n=i(416),r=i(247);function s(t){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s(t)}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function a(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,l(n.key),n)}}function l(t){var e=function(t){if("object"!=s(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=s(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==s(e)?e:e+""}function h(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(h=function(){return!!t})()}function c(){return c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,i){var n=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=u(t)););return t}(t,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?t:i):r.value}},c.apply(null,arguments)}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}function d(t,e){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},d(t,e)}var f=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,i){return e=u(e),function(t,e){if(e&&("object"==s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,h()?Reflect.construct(e,i||[],u(t).constructor):e.apply(t,i))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e)}(e,t),i=e,n=[{key:"leafLayerIds",get:function(){return this.hasSublayers?[]:this.hasFill||this.hasStroke||this.hasSymbol?[this.id]:[]}},{key:"source",get:function(){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}},{key:"idStrategy",get:function(){return this.hasDynamicGeoJSON?this.dynamicGeoJSON.idProperty||null:this.idProperty||null}},{key:"filter",get:function(){var t,i,n=(t=e,i=this,c(u(1&1?t.prototype:t),"filter",i));if(!this.sourceLayer)return n;var r=["==",["get","layer"],this.sourceLayer];return n?"all"===n[0]?[].concat(function(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?o(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(n),[r]):["all",n,r]:r}},{key:"_wrapWithFilter",value:function(t){return this.filter?[{filter:this.filter,style:t}]:t}},{key:"getSymbolMeta",value:function(t){var e=t.pixelRatio,i=t.symbolRegistry;if(!this.hasSymbol)return null;var n=i.getSymbolImageId(this.style,this._datasetRegistry.mapStyle,"normal",e);return n?{imageId:n,anchor:i.getSymbolDef(this.style).anchor,pixelRatio:e}:null}},{key:"_symbolStyle",value:function(t){var e={},i=this.getSymbolMeta(t),n=i&&t.getSymbolDataUri(i.imageId);return n&&(e["icon-src"]=n,e["icon-anchor"]=i.anchor,e["icon-scale"]=1/t.pixelRatio),this._wrapWithFilter(e)}},{key:"getFlatStyle",value:function(t){var e;if(this.hasSymbol)return this._symbolStyle(t);var i=null===(e=this._datasetRegistry.mapStyle)||void 0===e?void 0:e.id,n={};return this.hasFill&&!this.hasPattern&&(n["fill-color"]=(0,r.o)(this.style.fill,i)),this.hasStroke&&(n["stroke-color"]=(0,r.o)(this.style.stroke,i),n["stroke-width"]=this.style.strokeWidth,this.style.strokeDashArray&&(n["stroke-line-dash"]=this.style.strokeDashArray)),this._wrapWithFilter(n)}}],n&&a(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,n}(n.f),g=i(913),p="add",_="remove",m="propertychange";function y(t){for(const e in t)delete t[e]}function x(t){let e;for(e in t)return!1;return!e}function v(t,e,i,n,r){if(r){const r=i;i=function(s){return t.removeEventListener(e,i),r.call(n??this,s)}}else n&&n!==t&&(i=i.bind(n));const s={target:t,type:e,listener:i};return t.addEventListener(e,i),s}function S(t,e,i,n){return v(t,e,i,n,!0)}function w(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),y(t))}var C="change",b=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function R(t,e){return t>e?1:t<e?-1:0}function T(t,e){return t<e?1:t>e?-1:0}function E(t,e,i){if(t[0]<=e)return 0;const n=t.length;if(e<=t[n-1])return n-1;if("function"==typeof i){for(let r=1;r<n;++r){const n=t[r];if(n===e)return r;if(n<e)return i(e,t[r-1],n)>0?r-1:r}return n-1}if(i>0){for(let i=1;i<n;++i)if(t[i]<e)return i-1;return n-1}if(i<0){for(let i=1;i<n;++i)if(t[i]<=e)return i;return n-1}for(let i=1;i<n;++i){if(t[i]==e)return i;if(t[i]<e)return t[i-1]-e<e-t[i]?i-1:i}return n-1}function I(t,e,i){for(;e<i;){const n=t[e];t[e]=t[i],t[i]=n,++e,--i}}function M(t,e){const i=Array.isArray(e)?e:[e],n=i.length;for(let e=0;e<n;e++)t[t.length]=i[e]}function P(t,e){const i=t.length;if(i!==e.length)return!1;for(let n=0;n<i;n++)if(t[n]!==e[n])return!1;return!0}function F(){return!0}function O(){}function k(t){let e,i,n;return function(){const r=Array.prototype.slice.call(arguments);return i&&this===n&&P(r,i)||(n=this,i=r,e=t.apply(this,arguments)),e}}var A=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},L=class extends b{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_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e="string"==typeof t,i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const r=e?new A(t):t;r.target||(r.target=this.eventTarget_||this);const s=this.dispatching_||(this.dispatching_={}),o=this.pendingRemovals_||(this.pendingRemovals_={});let a;i in s||(s[i]=0,o[i]=0),++s[i];for(let t=0,e=n.length;t<e;++t)if(a="handleEvent"in n[t]?n[t].handleEvent(r):n[t].call(this,r),!1===a||r.propagationStopped){a=!1;break}if(0===--s[i]){let t=o[i];for(delete o[i];t--;)this.removeEventListener(i,O);delete s[i]}return a}disposeInternal(){this.listeners_&&y(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 n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=O,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}};class D extends L{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(C)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=v(this,t[r],e);return n}return v(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const n=t.length;i=new Array(n);for(let r=0;r<n;++r)i[r]=S(this,t[r],e)}else i=S(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)w(t[e]);else w(t)}(i);else if(Array.isArray(t))for(let i=0,n=t.length;i<n;++i)this.removeEventListener(t[i],e);else this.removeEventListener(t,e)}}D.prototype.on,D.prototype.once,D.prototype.un;var j=D;function G(){throw new Error("Unimplemented abstract method.")}let W=0;function X(t){return t.ol_uid||(t.ol_uid=String(++W))}class z extends A{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}var Y=class extends j{constructor(t){super(),this.on,this.once,this.un,X(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 z(i,t,e)),i=m,this.hasListener(i)&&this.dispatchEvent(new z(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const n=this.values_||(this.values_={});if(i)n[t]=e;else{const i=n[t];n[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],x(this.values_)&&(this.values_=null),e||this.notify(t,i)}}};const N="length";class B extends A{constructor(t,e,i){super(t),this.element=e,this.index=i}}var Z=class extends Y{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,n=e.length;i<n;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(N)}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 B(p,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,n=e.length;i<n;++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 B(_,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 B(_,i,t)),this.dispatchEvent(new B(p,e,t))}updateLength_(){this.set(N,this.array_.length)}assertUnique_(t,e){const i=this.array_;for(let n=0,r=i.length;n<r;++n)if(i[n]===t&&n!==e)throw new Error("Duplicate item added to a unique collection")}};function V(t,e){if(!t)throw new Error(e)}function U(t){const e=[1/0,1/0,-1/0,-1/0];for(let i=0,n=t.length;i<n;++i)ot(e,t[i]);return e}function K(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 $(t,e,i){let n,r;return n=e<t[0]?t[0]-e:t[2]<e?e-t[2]:0,r=i<t[1]?t[1]-i:t[3]<i?i-t[3]:0,n*n+r*r}function q(t,e){return J(t,e[0],e[1])}function H(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function J(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function Q(t,e){const i=t[0],n=t[1],r=t[2],s=t[3],o=e[0],a=e[1];let l=0;return o<i?l|=16:o>r&&(l|=4),a<n?l|=8:a>s&&(l|=2),0===l&&(l=1),l}function tt(t,e,i,n,r){return r?(r[0]=t,r[1]=e,r[2]=i,r[3]=n,r):[t,e,i,n]}function et(t){return tt(1/0,1/0,-1/0,-1/0,t)}function it(t,e){const i=t[0],n=t[1];return tt(i,n,i,n,e)}function nt(t,e,i,n,r){return at(et(r),t,e,i,n)}function rt(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function st(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 ot(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 at(t,e,i,n,r){for(;i<n;i+=r)lt(t,e[i],e[i+1]);return t}function lt(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 ht(t,e){let i;return i=e(ut(t)),i||(i=e(dt(t)),i||(i=e(vt(t)),i||(i=e(xt(t)),i||!1)))}function ct(t){let e=0;return Ct(t)||(e=St(t)*_t(t)),e}function ut(t){return[t[0],t[1]]}function dt(t){return[t[2],t[1]]}function ft(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function gt(t,e){let i;if("bottom-left"===e)i=ut(t);else if("bottom-right"===e)i=dt(t);else if("top-left"===e)i=xt(t);else{if("top-right"!==e)throw new Error("Invalid corner");i=vt(t)}return i}function pt(t,e,i,n){const r=e*n[0]/2,s=e*n[1]/2,o=Math.cos(i),a=Math.sin(i),l=r*o,h=r*a,c=s*o,u=s*a,d=t[0],f=t[1];return[d-l+u,f-h-c,d-l-u,f-h+c,d+l-u,f+h+c,d+l+u,f+h-c,d-l+u,f-h-c]}function _t(t){return t[3]-t[1]}function mt(t,e,i){const n=i||[1/0,1/0,-1/0,-1/0];return wt(t,e)?(t[0]>e[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]<e[2]?n[2]=t[2]:n[2]=e[2],t[3]<e[3]?n[3]=t[3]:n[3]=e[3]):et(n),n}function yt(t,e){if(!wt(t,e))return[t.slice()];if(H(e,t))return[];const[i,n,r,s]=t,o=Math.max(i,e[0]),a=Math.max(n,e[1]),l=Math.min(r,e[2]),h=Math.min(s,e[3]),c=[];return o>i&&c.push([i,n,o,s]),l<r&&c.push([l,n,r,s]),a>n&&c.push([o,n,l,a]),h<s&&c.push([o,h,l,s]),c}function xt(t){return[t[0],t[3]]}function vt(t){return[t[2],t[3]]}function St(t){return t[2]-t[0]}function wt(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Ct(t){return t[2]<t[0]||t[3]<t[1]}function bt(t,e){const i=e.getExtent(),n=ft(t);if(e.canWrapX()&&(n[0]<i[0]||n[0]>=i[2])){const e=St(i),r=Math.floor((n[0]-i[0])/e)*e;t[0]-=r,t[2]-=r}return t}function Rt(t,e,i){if(e.canWrapX()){const n=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[n[0],t[1],n[2],t[3]]];bt(t,e);const r=St(n);if(St(t)>r&&!i)return[[n[0],t[1],n[2],t[3]]];if(t[0]<n[0])return[[t[0]+r,t[1],n[2],t[3]],[n[0],t[1],t[2],t[3]]];if(t[2]>n[2])return[[t[0],t[1],n[2],t[3]],[n[0],t[1],t[2]-r,t[3]]]}return[t]}function Tt(t,e){let i=[t];for(let t=0,n=e.length;t<n&&i.length>0;++t){const n=[];for(let r=0,s=i.length;r<s;++r)n.push(...yt(i[r],e[t]));i=n}return i}function Et(t,e,i,n,r,s,o){const a=new XMLHttpRequest;a.open("GET","function"==typeof t?t(i,n,r):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 n;"text"==t||"json"==t?n=a.responseText:"xml"==t?n=a.responseXML||a.responseText:"arraybuffer"==t&&(n=a.response),n?s(e.readFeatures(n,{extent:i,featureProjection:r}),e.readProjection(n)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function It(t,e){return function(i,n,r,s,o){Et(t,e,i,n,r,(t,e)=>{this.addFeatures(t),void 0!==s&&s(t)},()=>{this.changed(),void 0!==o&&o()})}}const Mt=2;let Pt=1;function Ft(t,e,i){return Math.min(Math.max(t,e),i)}function Ot(t,e,i,n,r,s){const o=r-i,a=s-n;if(0!==o||0!==a){const l=((t-i)*o+(e-n)*a)/(o*o+a*a);l>1?(i=r,n=s):l>0&&(i+=o*l,n+=a*l)}return kt(t,e,i,n)}function kt(t,e,i,n){const r=i-t,s=n-e;return r*r+s*s}function At(t){return 180*t/Math.PI}function Lt(t){return t*Math.PI/180}function Dt(t,e){const i=t%e;return i*e<0?i+e:i}function jt(t,e,i){return t+i*(e-t)}function Gt(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function Wt(t,e){return Math.floor(Gt(t,e))}function Xt(t,e){return Math.ceil(Gt(t,e))}function zt(t,e,i){if(t>=e&&t<i)return t;const n=i-e;return((t-e)%n+n)%n+e}function Yt(t,e){let i=!0;for(let n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function Nt(t,e){if(e.canWrapX()){const i=St(e.getExtent()),n=function(t,e,i){const n=e.getExtent();let r=0;return e.canWrapX()&&(t[0]<n[0]||t[0]>n[2])&&(i=i||St(n),r=Math.floor((t[0]-n[0])/i)),r}(t,e,i);n&&(t[0]-=n*i)}return t}const Bt={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var Zt=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_||Bt[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 Vt=6378137,Ut=Math.PI*Vt,Kt=[-Ut,-Ut,Ut,Ut],$t=[-180,-85,180,85],qt=Vt*Math.log(Math.tan(Math.PI/2));class Ht extends Zt{constructor(t){super({code:t,units:"m",extent:Kt,global:!0,worldExtent:$t,getPointResolution:function(t,e){return t/Math.cosh(e[1]/Vt)}})}}const Jt=[new Ht("EPSG:3857"),new Ht("EPSG:102100"),new Ht("EPSG:102113"),new Ht("EPSG:900913"),new Ht("http://www.opengis.net/def/crs/EPSG/0/3857"),new Ht("http://www.opengis.net/gml/srs/epsg.xml#3857")];const Qt=[-180,-90,180,90],te=6378137*Math.PI/180;class ee extends Zt{constructor(t,e){super({code:t,units:"degrees",extent:Qt,axisOrientation:e,global:!0,metersPerUnit:te,worldExtent:Qt})}}const ie=[new ee("CRS:84"),new ee("EPSG:4326","neu"),new ee("urn:ogc:def:crs:OGC:1.3:CRS84"),new ee("urn:ogc:def:crs:OGC:2:84"),new ee("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new ee("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new ee("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let ne={},re={};function se(t,e,i){const n=t.getCode(),r=e.getCode();n in re||(re[n]={}),re[n][r]=i}function oe(t,e){return t in re&&e in re[t]?re[t][e]:null}const ae=.9996,le=.00669438,he=le*le,ce=he*le,ue=le/(1-le),de=Math.sqrt(1-le),fe=(1-de)/(1+de),ge=fe*fe,pe=ge*fe,_e=pe*fe,me=_e*fe,ye=.9983242984503243,xe=15*he/256+45*ce/1024,ve=35*ce/3072,Se=1.5*fe-27/32*pe+269/512*me,we=21/16*ge-55/32*_e,Ce=151/96*pe-417/128*me,be=1097/512*_e,Re=6378137;function Te(t,e,i){const n=t-5e5,r=(i.north?e:e-1e7)/ae/(Re*ye),s=r+Se*Math.sin(2*r)+we*Math.sin(4*r)+Ce*Math.sin(6*r)+be*Math.sin(8*r),o=Math.sin(s),a=o*o,l=Math.cos(s),h=o/l,c=h*h,u=c*c,d=1-le*a,f=Math.sqrt(1-le*a),g=ue*l**2,p=g*g,_=n/(Re/f*ae),m=_*_,y=m*_,x=y*_,v=x*_,S=s-h/((1-le)/d)*(m/2-x/24*(5+3*c+10*g-4*p-9*ue))+v*_/720*(61+90*c+298*g+45*u-252*ue-3*p);let w=(_-y/6*(1+2*c+g)+v/120*(5-2*g+28*c-3*p+8*ue+24*u))/l;return w=zt(w+Lt(Ie(i.number)),-Math.PI,Math.PI),[At(w),At(S)]}function Ee(t,e,i){t=zt(t,-180,180),e<-80?e=-80:e>84&&(e=84);const n=Lt(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,h=Lt(t),c=Lt(Ie(i.number)),u=Re/Math.sqrt(1-le*r**2),d=ue*s**2,f=s*zt(h-c,-Math.PI,Math.PI),g=f*f,p=g*f,_=p*f,m=_*f,y=m*f,x=Re*(ye*n-.002514607064228144*Math.sin(2*n)+xe*Math.sin(4*n)-ve*Math.sin(6*n)),v=ae*u*(f+p/6*(1-a+d)+m/120*(5-18*a+l+72*d-58*ue))+5e5;let S=ae*(x+u*o*(g/2+_/24*(5-a+9*d+4*d**2)+y/720*(61-58*a+l+600*d-330*ue)));return i.north||(S+=1e7),[v,S]}function Ie(t){return 6*(t-1)-180+3}const Me=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function Pe(t){let e=0;for(const i of Me){const n=t.match(i);if(n){e=parseInt(n[1]);break}}if(!e)return null;let i=0,n=!1;return e>32700&&e<32761?i=e-32700:e>32600&&e<32661&&(n=!0,i=e-32600),i?{number:i,north:n}:null}function Fe(t,e){return function(i,n,r,s){const o=i.length;r=r>1?r:2,s=s??r,n||(n=r>2?i.slice():new Array(o));for(let r=0;r<o;r+=s){const s=i[r],o=i[r+1],a=t(s,o,e);n[r]=a[0],n[r+1]=a[1]}return n}}function Oe(t,e,i){i=i||6371008.8;const n=Lt(t[1]),r=Lt(e[1]),s=(r-n)/2,o=Lt(e[0]-t[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(r);return 2*i*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}const ke=[function(t){const e=Pe(t.getCode());return e?{forward:Fe(Ee,e),inverse:Fe(Te,e)}:null}],Ae=[function(t){return Pe(t)?new Zt({code:t,units:"m"}):null}];let Le=!0;function De(t,e){if(void 0!==e)for(let i=0,n=t.length;i<n;++i)e[i]=t[i];else e=t.slice();return e}function je(t){!function(t,e){ne[t]=e}(t.getCode(),t),se(t,t,De)}function Ge(t){if("string"!=typeof t)return t;const e=ne[i=t]||ne[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null;var i;if(e)return e;for(const e of Ae){const i=e(t);if(i)return i}return null}function We(t,e,i,n){let r;const s=(t=Ge(t)).getPointResolutionFunc();if(s){if(r=s(e,i),n&&n!==t.getUnits()){const e=t.getMetersPerUnit();e&&(r=r*e/Bt[n])}}else{const s=t.getUnits();if("degrees"==s&&!n||"degrees"==n)r=e;else{const o=Ne(t,Ge("EPSG:4326"));if(o||"degrees"===s){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=o(t,t,2),r=(Oe(t.slice(0,2),t.slice(2,4))+Oe(t.slice(4,6),t.slice(6,8)))/2}else r=e*t.getMetersPerUnit();const a=n?Bt[n]:t.getMetersPerUnit();void 0!==a&&(r/=a)}}return r}function Xe(t){!function(t){t.forEach(je)}(t),t.forEach(function(e){t.forEach(function(t){e!==t&&se(e,t,De)})})}function ze(t,e){return t?"string"==typeof t?Ge(t):t:Ge(e)}function Ye(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();return(t.getCode()===e.getCode()||Ne(t,e)===De)&&i}function Ne(t,e){const i=t.getCode(),n=e.getCode();let r=oe(i,n);if(r)return r;let s=null,o=null;for(const i of ke)s||(s=i(t)),o||(o=i(e));if(!s&&!o)return null;const a="EPSG:4326";if(o)if(s)r=Be(s.inverse,o.forward);else{const t=oe(i,a);t&&(r=Be(t,o.forward))}else{const t=oe(a,n);t&&(r=Be(s.inverse,t))}return r&&(je(t),je(e),se(t,e,r)),r}function Be(t,e){return function(i,n,r,s){return n=t(i,n,r,s),e(n,n,r,s)}}function Ze(t,e){return Ne(Ge(t),Ge(e))}function Ve(t,e,i){const n=Ze(e,i);if(!n){const t=Ge(e).getCode(),n=Ge(i).getCode();throw new Error(`No transform available between ${t} and ${n}`)}return n(t,void 0,t.length)}function Ue(t,e,i,n){return function(t,e,i,n){if(Ct(t))return et(i);let r=[];if(n>1){const e=t[2]-t[0],i=t[3]-t[1];for(let s=0;s<n;++s)r.push(t[0]+e*s/n,t[1],t[2],t[1]+i*s/n,t[2]-e*s/n,t[3],t[0],t[3]-i*s/n)}else r=[t[0],t[1],t[2],t[1],t[2],t[3],t[0],t[3]];e(r,r,2);const s=[],o=[];for(let t=0,e=r.length;t<e;t+=2)s.push(r[t]),o.push(r[t+1]);return function(t,e,i){return tt(Math.min.apply(null,t),Math.min.apply(null,e),Math.max.apply(null,t),Math.max.apply(null,e),i)}(s,o,i)}(t,Ze(e,i),void 0,n)}let Ke=null;function $e(){return Ke}function qe(t,e){return t}function He(t,e){return Le&&!Yt(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(Le=!1,function(...t){Pt>Mt||console.warn(...t)}("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t}function Je(t,e){return t}function Qe(t,e){return t}function ti(t,e){return t}var ei,ii,ni;function ri(t,e){return[[-1/0,-1/0,1/0,1/0]]}function si(t,e,i,n){const r=[];let s=[1/0,1/0,-1/0,-1/0];for(let o=0,a=i.length;o<a;++o){const a=i[o];s=nt(t,e,a[0],n),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),e=a[a.length-1]}return r}function oi(t,e,i,n,r){return!ht(r,function(r){return!ai(t,e,i,n,r[0],r[1])})}function ai(t,e,i,n,r,s){let o=0,a=t[i-n],l=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];l<=s?n>s&&(i-a)*(s-l)-(r-a)*(n-l)>0&&o++:n<=s&&(i-a)*(s-l)-(r-a)*(n-l)<0&&o--,a=i,l=n}return 0!==o}function li(t,e,i,n,r,s){if(0===i.length)return!1;if(!ai(t,e,i[0],n,r,s))return!1;for(let e=1,o=i.length;e<o;++e)if(ai(t,i[e-1],i[e],n,r,s))return!1;return!0}function hi(t,e,i,n,r,s,o){let a,l,h,c,u,d,f;const g=r[s+1],p=[];for(let r=0,s=i.length;r<s;++r){const s=i[r];for(c=t[s-n],d=t[s-n+1],a=e;a<s;a+=n)u=t[a],f=t[a+1],(g<=d&&f<=g||d<=g&&g<=f)&&(h=(g-d)/(f-d)*(u-c)+c,p.push(h)),c=u,d=f}let _=NaN,m=-1/0;for(p.sort(R),c=p[0],a=1,l=p.length;a<l;++a){u=p[a];const r=Math.abs(u-c);r>m&&(h=(c+u)/2,li(t,e,i,n,h,g)&&(_=h,m=r)),c=u}return isNaN(_)&&(_=r[s]),o?(o.push(_,g,m),o):[_,g,m]}function ci(t,e,i,n,r){let s=[];for(let o=0,a=i.length;o<a;++o){const a=i[o];s=hi(t,e,a,n,r,2*o,s),e=a[a.length-1]}return s}function ui(t,e,i,n,r,s,o){let a,l;const h=(i-e)/n;if(1===h)a=e;else if(2===h)a=e,l=r;else if(0!==h){let s=t[e],o=t[e+1],h=0;const c=[0];for(let r=e+n;r<i;r+=n){const e=t[r],i=t[r+1];h+=Math.sqrt((e-s)*(e-s)+(i-o)*(i-o)),c.push(h),s=e,o=i}const u=r*h,d=function(t,e,i){let n,r;i=i||R;let s=0,o=t.length,a=!1;for(;s<o;)n=s+(o-s>>1),r=+i(t[n],e),r<0?s=n+1:(o=n,a=!r);return a?s:~s}(c,u);d<0?(l=(u-c[-d-2])/(c[-d-1]-c[-d-2]),a=e+(-d-2)*n):a=e+d*n}o=o>1?o:2,s=s||new Array(o);for(let e=0;e<o;++e)s[e]=void 0===a?NaN:void 0===l?t[a+e]:jt(t[a+e],t[a+n+e],l);return s}function di(t,e,i,n,r,s){if(i==e)return null;let o;if(r<t[e+n-1])return s?(o=t.slice(e,e+n),o[n-1]=r,o):null;if(t[i-1]<r)return s?(o=t.slice(i-n,i),o[n-1]=r,o):null;if(r==t[e+n-1])return t.slice(e,e+n);let a=e/n,l=i/n;for(;a<l;){const e=a+l>>1;r<t[(e+1)*n-1]?l=e:a=e+1}const h=t[a*n-1];if(r==h)return t.slice((a-1)*n,(a-1)*n+n);const c=(r-h)/(t[(a+1)*n-1]-h);o=[];for(let e=0;e<n-1;++e)o.push(jt(t[(a-1)*n+e],t[a*n+e],c));return o.push(r),o}function fi(t,e,i,n){for(;e<i-n;){for(let r=0;r<n;++r){const s=t[e+r];t[e+r]=t[i-n+r],t[i-n+r]=s}e+=n,i-=n}}function gi(t,e,i,n){let r=0,s=t[i-n],o=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];r+=(i-s)*(n+o),s=i,o=n}return 0===r?void 0:r>0}function pi(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=gi(t,e,o,n);if(0===s){if(r&&a||!r&&!a)return!1}else if(r&&!a||!r&&a)return!1;e=o}return!0}function _i(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];if(!pi(t,e,o,n,r))return!1;o.length&&(e=o[o.length-1])}return!0}function mi(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=gi(t,e,o,n);(0===s?r&&a||!r&&!a:r&&!a||!r&&a)&&fi(t,e,o,n),e=o}return e}function yi(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s)e=mi(t,e,i[s],n,r);return e}function xi(t,e){const i=[];let n,r=0,s=0;for(let o=0,a=e.length;o<a;++o){const a=e[o],l=gi(t,r,a,2);if(void 0===n&&(n=l),l===n)i.push(e.slice(s,o+1));else{if(0===i.length)continue;i[i.length-1].push(e[s])}s=o+1,r=a}return i}function vi(t,e,i,n,r,s,o){const a=(i-e)/n;if(a<3){for(;e<i;e+=n)s[o++]=t[e],s[o++]=t[e+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[e,i-n];let c=0;for(;h.length>0;){const i=h.pop(),s=h.pop();let o=0;const a=t[s],u=t[s+1],d=t[i],f=t[i+1];for(let e=s+n;e<i;e+=n){const i=Ot(t[e],t[e+1],a,u,d,f);i>o&&(c=e,o=i)}o>r&&(l[(c-e)/n]=1,s+n<c&&h.push(s,c),c+n<i&&h.push(c,i))}for(let i=0;i<a;++i)l[i]&&(s[o++]=t[e+i*n],s[o++]=t[e+i*n+1]);return o}function Si(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=vi(t,e,h,n,r,s,o),a.push(o),e=h}return o}function wi(t,e){return e*Math.round(t/e)}function Ci(t,e,i,n,r,s,o){if(e==i)return o;let a,l,h=wi(t[e],r),c=wi(t[e+1],r);e+=n,s[o++]=h,s[o++]=c;do{if(a=wi(t[e],r),l=wi(t[e+1],r),(e+=n)==i)return s[o++]=a,s[o++]=l,o}while(a==h&&l==c);for(;e<i;){const i=wi(t[e],r),u=wi(t[e+1],r);if(e+=n,i==a&&u==l)continue;const d=a-h,f=l-c,g=i-h,p=u-c;d*p==f*g&&(d<0&&g<d||d==g||d>0&&g>d)&&(f<0&&p<f||f==p||f>0&&p>f)?(a=i,l=u):(s[o++]=a,s[o++]=l,h=a,c=l,a=i,l=u)}return s[o++]=a,s[o++]=l,o}function bi(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=Ci(t,e,h,n,r,s,o),a.push(o),e=h}return o}function Ri(t,e,i,n,r,s,o){s=s||[],o=o||2;let a=0;for(let l=e;l<i;l+=n){const e=t[l],i=t[l+1];s[a++]=r[0]*e+r[2]*i+r[4],s[a++]=r[1]*e+r[3]*i+r[5];for(let e=2;e<o;e++)s[a++]=t[l+e]}return s&&s.length!=a&&(s.length=a),s}function Ti(t,e,i,n,r,s,o){o=o||[];const a=Math.cos(r),l=Math.sin(r),h=s[0],c=s[1];let u=0;for(let r=e;r<i;r+=n){const e=t[r]-h,i=t[r+1]-c;o[u++]=h+e*a-i*l,o[u++]=c+e*l+i*a;for(let e=r+2;e<r+n;++e)o[u++]=t[e]}return o&&o.length!=u&&(o.length=u),o}Xe(Jt),Xe(ie),ei=Jt,ii=function(t,e,i,n){const r=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(r));for(let i=0;i<r;i+=n){e[i]=Ut*t[i]/180;let n=Vt*Math.log(Math.tan(Math.PI*(+t[i+1]+90)/360));n>qt?n=qt:n<-qt&&(n=-qt),e[i+1]=n}return e},ni=function(t,e,i,n){const r=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(r));for(let i=0;i<r;i+=n)e[i]=180*t[i]/Ut,e[i+1]=360*Math.atan(Math.exp(t[i+1]/Vt))/Math.PI-90;return e},ie.forEach(function(t){ei.forEach(function(e){se(t,e,ii),se(e,t,ni)})});const Ei=[1,0,0,1,0,0],Ii=new Array(6);function Mi(){return Ei.slice(0)}function Pi(t){return Oi(t,1,0,0,1,0,0)}function Fi(t,e){const i=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=e[0],h=e[1],c=e[2],u=e[3],d=e[4],f=e[5];return t[0]=i*l+r*h,t[1]=n*l+s*h,t[2]=i*c+r*u,t[3]=n*c+s*u,t[4]=i*d+r*f+o,t[5]=n*d+s*f+a,t}function Oi(t,e,i,n,r,s,o){return t[0]=e,t[1]=i,t[2]=n,t[3]=r,t[4]=s,t[5]=o,t}function ki(t,e){const i=e[0],n=e[1];return e[0]=t[0]*i+t[2]*n+t[4],e[1]=t[1]*i+t[3]*n+t[5],e}function Ai(t,e,i){return Fi(t,Oi(Ii,e,0,0,i,0,0))}function Li(t,e,i,n,r,s,o,a){const l=Math.sin(s),h=Math.cos(s);return t[0]=n*h,t[1]=r*l,t[2]=-n*l,t[3]=r*h,t[4]=o*n*h-a*n*l+e,t[5]=o*r*l+a*r*h+i,t}const Di=[1e5,1e5,1e5,1e5,2,2];function ji(t){return t.substring(7,t.length-1).split(",").map(parseFloat)}const Gi=Mi();class Wi{constructor(t,e,i,n,r,s){this.styleFunction,this.extent_,this.id_=s,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=r,this.squaredTolerance_,this.stride_=n,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?it(this.flatCoordinates_):nt(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=ft(this.getExtent());this.flatInteriorPoints_=hi(this.flatCoordinates_,0,this.ends_,this.stride_,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=xi(this.flatCoordinates_,this.ends_),e=si(this.flatCoordinates_,0,t,this.stride_);this.flatInteriorPoints_=ci(this.flatCoordinates_,0,t,this.stride_,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=ui(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 n=0,r=i.length;n<r;++n){const r=i[n],s=ui(t,e,r,this.stride_,.5);M(this.flatMidpoints_,s),e=r}}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=Ge(t)).getExtent(),i=t.getWorldExtent();if(e&&i){const t=_t(i)/_t(e);Li(Gi,i[0],i[3],t,-t,0,0,0),Ri(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,Gi,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new Wi(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=k((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let n;switch(this.type_){case"LineString":i.length=vi(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),n=[i.length];break;case"MultiLineString":n=[],i.length=Si(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,n);break;case"Polygon":n=[],i.length=bi(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,n)}return n&&(this.simplifiedGeometry_=new Wi(this.type_,i,n,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}Wi.prototype.getFlatCoordinates=Wi.prototype.getOrientedFlatCoordinates;var Xi=Wi;function zi(t,e,i=0,n=t.length-1,r=Ni){for(;n>i;){if(n-i>600){const s=n-i+1,o=e-i+1,a=Math.log(s),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);zi(t,e,Math.max(i,Math.floor(e-o*l/s+h)),Math.min(n,Math.floor(e+(s-o)*l/s+h)),r)}const s=t[e];let o=i,a=n;for(Yi(t,i,e),r(t[n],s)>0&&Yi(t,i,n);o<a;){for(Yi(t,o,a),o++,a--;r(t[o],s)<0;)o++;for(;r(t[a],s)>0;)a--}0===r(t[i],s)?Yi(t,i,a):(a++,Yi(t,a,n)),a<=e&&(i=a+1),e<=a&&(n=a-1)}}function Yi(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function Ni(t,e){return t<e?-1:t>e?1:0}class Bi{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(!nn(t,e))return i;const n=this.toBBox,r=[];for(;e;){for(let s=0;s<e.children.length;s++){const o=e.children[s],a=e.leaf?n(o):o;nn(t,a)&&(e.leaf?i.push(o):en(t,a)?this._all(o,i):r.push(o))}e=r.pop()}return i}collides(t){let e=this.data;if(!nn(t,e))return!1;const i=[];for(;e;){for(let n=0;n<e.children.length;n++){const r=e.children[n],s=e.leaf?this.toBBox(r):r;if(nn(t,s)){if(e.leaf||en(t,s))return!0;i.push(r)}}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=rn([]),this}remove(t,e){if(!t)return this;let i=this.data;const n=this.toBBox(t),r=[],s=[];let o,a,l;for(;i||r.length;){if(i||(i=r.pop(),a=r[r.length-1],o=s.pop(),l=!0),i.leaf){const n=Zi(t,i.children,e);if(-1!==n)return i.children.splice(n,1),r.push(i),this._condense(r),this}l||i.leaf||!en(i,n)?a?(o++,i=a.children[o],l=!1):i=null:(r.push(i),s.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,n){const r=i-e+1;let s,o=this._maxEntries;if(r<=o)return s=rn(t.slice(e,i+1)),Vi(s,this.toBBox),s;n||(n=Math.ceil(Math.log(r)/Math.log(o)),o=Math.ceil(r/Math.pow(o,n-1))),s=rn([]),s.leaf=!1,s.height=n;const a=Math.ceil(r/o),l=a*Math.ceil(Math.sqrt(o));sn(t,e,i,l,this.compareMinX);for(let r=e;r<=i;r+=l){const e=Math.min(r+l-1,i);sn(t,r,e,a,this.compareMinY);for(let i=r;i<=e;i+=a){const r=Math.min(i+a-1,e);s.children.push(this._build(t,i,r,n-1))}}return Vi(s,this.toBBox),s}_chooseSubtree(t,e,i,n){for(;n.push(e),!e.leaf&&n.length-1!==i;){let i,n=1/0,r=1/0;for(let s=0;s<e.children.length;s++){const o=e.children[s],a=Hi(o),l=Qi(t,o)-a;l<r?(r=l,n=a<n?a:n,i=o):l===r&&a<n&&(n=a,i=o)}e=i||e.children[0]}return e}_insert(t,e,i){const n=i?t:this.toBBox(t),r=[],s=this._chooseSubtree(n,this.data,e,r);for(s.children.push(t),Ki(s,n);e>=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)}_split(t,e){const i=t[e],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);const s=this._chooseSplitIndex(i,r,n),o=rn(i.children.splice(s,i.children.length-s));o.height=i.height,o.leaf=i.leaf,Vi(i,this.toBBox),Vi(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=rn([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Vi(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let n,r=1/0,s=1/0;for(let o=e;o<=i-e;o++){const e=Ui(t,0,o,this.toBBox),a=Ui(t,o,i,this.toBBox),l=tn(e,a),h=Hi(e)+Hi(a);l<r?(r=l,n=o,s=h<s?h:s):l===r&&h<s&&(s=h,n=o)}return n||i-e}_chooseSplitAxis(t,e,i){const n=t.leaf?this.compareMinX:$i,r=t.leaf?this.compareMinY:qi;this._allDistMargin(t,e,i,n)<this._allDistMargin(t,e,i,r)&&t.children.sort(n)}_allDistMargin(t,e,i,n){t.children.sort(n);const r=this.toBBox,s=Ui(t,0,e,r),o=Ui(t,i-e,i,r);let a=Ji(s)+Ji(o);for(let n=e;n<i-e;n++){const e=t.children[n];Ki(s,t.leaf?r(e):e),a+=Ji(s)}for(let n=i-e-1;n>=e;n--){const e=t.children[n];Ki(o,t.leaf?r(e):e),a+=Ji(o)}return a}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)Ki(e[n],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():Vi(t[i],this.toBBox)}}function Zi(t,e,i){if(!i)return e.indexOf(t);for(let n=0;n<e.length;n++)if(i(t,e[n]))return n;return-1}function Vi(t,e){Ui(t,0,t.children.length,e,t)}function Ui(t,e,i,n,r){r||(r=rn(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=e;s<i;s++){const e=t.children[s];Ki(r,t.leaf?n(e):e)}return r}function Ki(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 $i(t,e){return t.minX-e.minX}function qi(t,e){return t.minY-e.minY}function Hi(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Ji(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Qi(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 tn(t,e){const i=Math.max(t.minX,e.minX),n=Math.max(t.minY,e.minY),r=Math.min(t.maxX,e.maxX),s=Math.min(t.maxY,e.maxY);return Math.max(0,r-i)*Math.max(0,s-n)}function en(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function nn(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function rn(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function sn(t,e,i,n,r){const s=[e,i];for(;s.length;){if((i=s.pop())-(e=s.pop())<=n)continue;const o=e+Math.ceil((i-e)/n/2)*n;zi(t,o,e,i,r),s.push(e,o,o,i)}}var on=class{constructor(t){this.rbush_=new Bi(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_[X(e)]=i}load(t,e){const i=new Array(e.length);for(let n=0,r=e.length;n<r;n++){const r=t[n],s=e[n],o={minX:r[0],minY:r[1],maxX:r[2],maxY:r[3],value:s};i[n]=o,this.items_[X(s)]=o}this.rbush_.load(i)}remove(t){const e=X(t),i=this.items_[e];return delete this.items_[e],null!==this.rbush_.remove(i)}update(t,e){const i=this.items_[X(e)];rt([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 n=0,r=t.length;n<r;n++)if(i=e(t[n]),i)return i;return i}isEmpty(){return x(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return tt(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]}};function an(t){return t?"function"==typeof t?t:(Array.isArray(t)||(t=[t]),e=>t):null}var ln=class extends Y{constructor(t){super(),this.projection=Ge(t.projection),this.attributions_=an(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 n=this.getState();"ready"===n?(this.un("change",i),t()):"error"===n&&(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_=an(t),this.changed()}setState(t){this.state_=t,this.changed()}},hn="addfeature",cn="removefeature";class un extends A{constructor(t,e,i){super(t),this.feature=e,this.features=i}}var dn=class extends ln{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_=O,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_&&(V(this.format_,"`format` must be set when `url` is set"),this.loader_=It(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:ri;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,n;this.featuresRtree_=e?new on:null,this.loadedExtentsRtree_=new on,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(t.features)?n=t.features:t.features&&(i=t.features,n=i.getArray()),e||void 0!==i||(i=new Z(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=X(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 un(hn,t))}setupChangeEvents_(t,e){e instanceof Xi||(this.featureChangeKeys_[t]=[v(e,C,this.handleFeatureChange_,this),v(e,m,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 Xi){const n=this.idIndex_[t];n instanceof Xi?Array.isArray(n)?n.push(e):this.idIndex_[t]=[n,e]:i=!1}else i=!1;else this.idIndex_[t]=e}return i&&(V(!(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=[],n=[];for(let e=0,n=t.length;e<n;e++){const n=t[e],r=X(n);this.addToIndex_(r,n)&&i.push(n)}for(let t=0,r=i.length;t<r;t++){const r=i[t],s=X(r);this.setupChangeEvents_(s,r);const o=r.getGeometry();if(o){const t=o.getExtent();e.push(t),n.push(r)}else this.nullGeometryFeatures_[s]=r}if(this.featuresRtree_&&this.featuresRtree_.load(e,n),this.hasListener(hn))for(let t=0,e=i.length;t<e;t++)this.dispatchEvent(new un(hn,i[t]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(hn,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(cn,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(p,t=>{e||(e=!0,this.addFeature(t.element),e=!1)}),t.addEventListener(_,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(w);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 un("clear");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 n=i.getGeometry();if(n instanceof Xi||n.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 n=i.getGeometry();if(n instanceof Xi||n.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(),x(this.nullGeometryFeatures_)||M(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=Rt(t,e);return[].concat(...i.map(t=>this.featuresRtree_.getInExtent(t)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let r=null;const s=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||F,this.featuresRtree_.forEachInExtent(a,function(t){if(e(t)){const e=t.getGeometry(),l=o;if(o=e instanceof Xi?0:e.closestPointXY(i,n,s,o),o<l){r=t;const e=Math.sqrt(o);a[0]=i-e,a[1]=n-e,a[2]=i+e,a[3]=n+e}}}),r}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=X(e),n=e.getGeometry();if(n){const t=n.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 r=e.getId();if(void 0!==r){const t=r.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 un("changefeature",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 X(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&x(this.nullGeometryFeatures_):!this.featuresCollection_||0===this.featuresCollection_.getLength()}loadFeatures(t,e,i){const n=this.loadedExtentsRtree_,r=this.strategy_(t,e,i);for(let t=0,s=r.length;t<s;++t){const s=r[t];if(!n.forEachInExtent(s,function(t){return H(t.extent,s)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new un("featuresloadstart"));const t=t=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new un("featuresloadend",void 0,t))},r=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new un("featuresloaderror"))};let o=!1;const a=this.loader_.call(this,s,e,i,e=>o||t(e),()=>o||r());a instanceof Promise?(o=!0,a.then(e=>{this.addFeatures(e),t(e)}).catch(r)):this.loader_.length<4&&(this.loading=!1),n.insert(s,{extent:s.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 n=yt(i.extent,t);for(const t of n)e.insert(t,{extent:t})})}removeFeatures(t){let e=!1;for(let i=0,n=t.length;i<n;++i)e=this.removeFeatureInternal(t[i])||e;e&&this.changed()}removeFeature(t){t&&this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=X(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(w),delete this.featureChangeKeys_[e];const n=t.getId();if(void 0!==n){const e=n.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(cn)&&this.dispatchEvent(new un(cn,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){V(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(It(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}};const fn="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",gn=(fn.includes("safari")&&!fn.includes("chrom")&&(fn.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(fn)),fn.includes("webkit")&&fn.includes("edge"),fn.includes("macintosh"),"undefined"!=typeof devicePixelRatio&&devicePixelRatio,"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope),pn="undefined"!=typeof Image&&Image.prototype.decode;function _n(t,e,i,n){let r;return r=i&&i.length?i.shift():gn?new class extends OffscreenCanvas{style={}}(t??300,e??150):document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e),r.getContext("2d",n)}let mn;function yn(){return mn||(mn=_n(1,1)),mn}function xn(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function vn(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 Sn="prerender",wn="postrender";const Cn=[NaN,NaN,NaN,0];let bn;const Rn=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Tn=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,En=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,In=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Mn(t,e){return t.endsWith("%")?Number(t.substring(0,t.length-1))/e:Number(t)}function Pn(t){throw new Error('failed to parse "'+t+'" as color')}function Fn(t){if(t.toLowerCase().startsWith("rgb")){const e=t.match(Tn)||t.match(Rn)||t.match(En);if(e){const t=e[4],i=100/255;return[Ft(Mn(e[1],i)+.5|0,0,255),Ft(Mn(e[2],i)+.5|0,0,255),Ft(Mn(e[3],i)+.5|0,0,255),void 0!==t?Ft(Mn(t,100),0,1):1]}Pn(t)}if(t.startsWith("#")){if(In.test(t)){const e=t.substring(1),i=e.length<=4?1:2,n=[0,0,0,255];for(let t=0,r=e.length;t<r;t+=i){let r=parseInt(e.substring(t,t+i),16);1===i&&(r+=r<<4),n[t/i]=r}return n[3]=n[3]/255,n}Pn(t)}const e=(bn||(bn=_n(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),bn);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&&Pn(t));const n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return Fn(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);const r=Array.from(e.getImageData(0,0,1,1).data);return r[3]=Gt(r[3]/255,3),r}const On={};let kn=0;function An(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function Ln(t){return t>.0031308?269.025*Math.pow(t,1/2.4)-14.025:3294.6*t}function Dn(t){return t>.2068965?Math.pow(t,3):108/841*(t-4/29)}function jn(t){return t>10.314724?Math.pow((t+14.025)/269.025,2.4):t/3294.6}function Gn(t){return t>.0088564?Math.pow(t,1/3):t/(108/841)+4/29}function Wn(t){const e=jn(t[0]),i=jn(t[1]),n=jn(t[2]),r=Gn(.222488403*e+.716873169*i+.06060791*n),s=500*(Gn(.452247074*e+.399439023*i+.148375274*n)-r),o=200*(r-Gn(.016863605*e+.117638439*i+.865350722*n)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,t[3]]}function Xn(t){if("none"===t)return Cn;if(On.hasOwnProperty(t))return On[t];if(kn>=1024){let t=0;for(const e in On)3&t++||(delete On[e],--kn)}const e=Fn(t);4!==e.length&&Pn(t);for(const i of e)isNaN(i)&&Pn(t);return On[t]=e,++kn,e}function zn(t){return Array.isArray(t)?t:Xn(t)}function Yn(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];return n!=(0|n)&&(n=n+.5|0),"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}function Nn(t,e){return t+":"+(e?zn(e):"null")}const Bn=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=Nn(t,e);return i in this.cache_?this.cache_[i]:null}getPattern(t,e){const i=Nn(t,e);return i in this.patternCache_?this.patternCache_[i]:null}set(t,e,i,n){const r=Nn(t,e),s=r in this.cache_;this.cache_[r]=i,n&&(0===i.getImageState()&&i.load(),1===i.getImageState()?i.ready().then(()=>{this.patternCache_[r]=yn().createPattern(i.getImage(1),"repeat")}):this.patternCache_[r]=yn().createPattern(i.getImage(1),"repeat")),s||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};let Zn=null;class Vn extends L{constructor(t,e,i,n,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i?.crossOrigin,this.referrerPolicy_=i?.referrerPolicy,this.canvas_={},this.color_=r,this.imageState_=void 0===n?0:n,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_&&2===this.imageState_){Zn||(Zn=_n(1,1,void 0,{willReadFrequently:!0})),Zn.drawImage(this.image_,0,0);try{Zn.getImageData(0,0,1,1),this.tainted_=!1}catch{Zn=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(C)}handleImageError_(){this.imageState_=3,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=2,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=_n(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(0===this.imageState_){this.image_||this.initializeImage_(),this.imageState_=1;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&(t=this.image_,e=this.src_,e&&(t.src=e),t.src&&pn?new Promise((e,i)=>t.decode().then(()=>e(t)).catch(n=>t.complete&&t.width?e(t):i(n))):function(t){return new Promise((e,i)=>{function n(){s(),e(t)}function r(){s(),i(new Error("Image load error"))}function s(){t.removeEventListener("load",n),t.removeEventListener("error",r)}t.addEventListener("load",n),t.addEventListener("error",r)})}(t)).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}var t,e}replaceColor_(t){if(!this.color_||this.canvas_[t]||2!==this.imageState_)return;const e=this.image_,i=_n(Math.ceil(e.width*t),Math.ceil(e.height*t)),n=i.canvas;var r;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle="string"==typeof(r=this.color_)?r:Yn(r),i.fillRect(0,0,n.width/t,n.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=n}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(2===this.imageState_||3===this.imageState_)t();else{const e=()=>{2!==this.imageState_&&3!==this.imageState_||(this.removeEventListener(C,e),t())};this.addEventListener(C,e)}})),this.ready_}}function Un(t,e,i,n,r,s){let o=void 0===e?void 0:Bn.get(e,r);return o||(o=new Vn(t,t&&"src"in t?t.src||void 0:e,i,n,r),Bn.set(e,r,o,s)),s&&o&&!Bn.getPattern(e,r)&&Bn.set(e,r,o,s),o}var Kn=Vn;function $n(t){return t?Array.isArray(t)?Yn(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return Bn.getPattern(t.src,t.color);const e=t.src+":"+t.offset,i=Bn.getPattern(e,t.color);if(i)return i;const n=Bn.get(t.src,null);if(2!==n.getImageState())return null;const r=_n(t.size[0],t.size[1]);return r.drawImage(n.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),Un(r.canvas,e,void 0,2,t.color,!0),Bn.getPattern(e,t.color)}(t):t:null}function qn(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=e;o<i;o+=n)r[s++]=t.slice(o,o+n);return r.length=s,r}function Hn(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];r[s++]=qn(t,e,a,n,r[s]),e=a}return r.length=s,r}function Jn(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];r[s++]=1===a.length&&a[0]===e?[]:Hn(t,e,a,n,r[s]),e=a[a.length-1]}return r.length=s,r}var Qn=class{drawCustom(t,e,i,n,r){}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 tr=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"),er=["style","variant","weight","size","lineHeight","family"],ir={normal:400,bold:700},nr=function(t){const e=t.match(tr);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let t=0,n=er.length;t<n;++t){const n=e[t+1];void 0!==n&&(i[er[t]]="string"==typeof n?n.trim():n)}return isNaN(Number(i.weight))&&i.weight in ir&&(i.weight=ir[i.weight]),i.families=i.family.split(/,\s?/).map(t=>t.trim().replace(/^['"]|['"]$/g,"")),i},rr="10px sans-serif",sr="#000",or="round",ar=[],lr="round",hr="#000",cr="center",ur="middle",dr=[0,0,0,0],fr=new Y;let gr,pr=null;const _r={},mr=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function yr(t,e,i){return`${t} ${e} 16px "${i}"`}const xr=function(){const t=100;let e,i;async function n(t){await i.ready;const e=nr(t),n=e.families[0].toLowerCase(),r=e.weight,s=[];return i.forEach(t=>{const i=t.family.replace(/^['"]|['"]$/g,"").toLowerCase(),o=ir[t.weight]||t.weight;i===n&&t.style===e.style&&o==r&&s.push(t)}),0!==s.length&&(await Promise.all(s.map(t=>t.load().then(()=>!0,()=>!1)))).some(t=>t)}async function r(){await i.ready;let s=!0;const o=fr.getProperties(),a=Object.keys(o).filter(e=>o[e]<t);for(let e=a.length-1;e>=0;--e){const i=a[e];let r=o[i];r<t&&(await n(i)?(y(_r),fr.set(i,t)):(r+=10,fr.set(i,r,!0),r<t&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(t){i||(i=gn?self.fonts:document.fonts);const n=nr(t);if(!n)return;const s=n.families;let o=!1;for(const t of s){if(mr.has(t))continue;const e=yr(n.style,n.weight,t);void 0===fr.get(e)&&(fr.set(e,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(r,100))}}(),vr=function(){let t;return function(e){let i=_r[e];if(null==i){if(gn){const t=nr(e),n=Sr(e,"Žg");i=(isNaN(Number(t.lineHeight))?1.2:Number(t.lineHeight))*(n.actualBoundingBoxAscent+n.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);_r[e]=i}return i}}();function Sr(t,e){return pr||(pr=_n(1,1)),t!=gr&&(pr.font=t,gr=pr.font),pr.measureText(e)}function wr(t,e){return Sr(t,e).width}function Cr(t,e,i){if(e in i)return i[e];const n=e.split("\n").reduce((e,i)=>Math.max(e,wr(t,i)),0);return i[e]=n,n}const br={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},Rr=[br.FILL],Tr=[br.STROKE],Er=[br.BEGIN_PATH],Ir=[br.CLOSE_PATH];var Mr=br,Pr=class extends Qn{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,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(),n=this.tmpCoordinate_,r=this.coordinates;let s=r.length;for(let o=0,a=t.length;o<a;o+=e)n[0]=t[o],n[1]=t[o+1],q(i,n)&&(r[s++]=n[0],r[s++]=n[1]);return s}appendFlatLineCoordinates(t,e,i,n,r,s){const o=this.coordinates;let a=o.length;const l=this.getBufferedMaxExtent();s&&(e+=n);let h=t[e],c=t[e+1];const u=this.tmpCoordinate_;let d,f,g,p=!0;for(d=e+n;d<i;d+=n)u[0]=t[d],u[1]=t[d+1],g=Q(l,u),g!==f?(p&&(o[a++]=h,o[a++]=c,p=!1),o[a++]=u[0],o[a++]=u[1]):1===g?(o[a++]=u[0],o[a++]=u[1],p=!1):p=!0,h=u[0],c=u[1],f=g;return(r&&p||d===e+n)&&(o[a++]=h,o[a++]=c),a}drawCustomCoordinates_(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s],a=this.appendFlatLineCoordinates(t,e,o,n,!1,!1);r.push(a),e=o}return e}drawCustom(t,e,i,n,r){this.beginGeometry(t,e,r);const s=t.getType(),o=t.getStride(),a=this.coordinates.length;let l,h,c,u,d;switch(s){case"MultiPolygon":l=t.getOrientedFlatCoordinates(),u=[];const e=t.getEndss();d=0;for(let t=0,i=e.length;t<i;++t){const i=[];d=this.drawCustomCoordinates_(l,d,e[t],o,i),u.push(i)}this.instructions.push([Mr.CUSTOM,a,u,t,i,Jn,r]),this.hitDetectionInstructions.push([Mr.CUSTOM,a,u,t,n||i,Jn,r]);break;case"Polygon":case"MultiLineString":c=[],l="Polygon"==s?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(l,0,t.getEnds(),o,c),this.instructions.push([Mr.CUSTOM,a,c,t,i,Hn,r]),this.hitDetectionInstructions.push([Mr.CUSTOM,a,c,t,n||i,Hn,r]);break;case"LineString":case"Circle":l=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(l,0,l.length,o,!1,!1),this.instructions.push([Mr.CUSTOM,a,h,t,i,qn,r]),this.hitDetectionInstructions.push([Mr.CUSTOM,a,h,t,n||i,qn,r]);break;case"MultiPoint":l=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(l,o),h>a&&(this.instructions.push([Mr.CUSTOM,a,h,t,i,qn,r]),this.hitDetectionInstructions.push([Mr.CUSTOM,a,h,t,n||i,qn,r]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([Mr.CUSTOM,a,h,t,i,void 0,r]),this.hitDetectionInstructions.push([Mr.CUSTOM,a,h,t,n||i,void 0,r])}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[Mr.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[Mr.BEGIN_GEOMETRY,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 n,r,s=-1;for(e=0;e<i;++e)n=t[e],r=n[0],r==Mr.END_GEOMETRY?s=e:r==Mr.BEGIN_GEOMETRY&&(n[2]=e,I(this.hitDetectionInstructions,s,e),s=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&"object"==typeof i&&"src"in i?this.pixelRatio:1,e.fillStyle=$n(i||sr)??void 0}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=$n(i||hr);const n=t.getLineCap();e.lineCap=void 0!==n?n:or;const r=t.getLineDash();e.lineDash=r?r.slice():ar;const s=t.getLineDashOffset();e.lineDashOffset=s||0;const o=t.getLineJoin();e.lineJoin=void 0!==o?o:lr;const a=t.getWidth();e.lineWidth=void 0!==a?a:1;const l=t.getMiterLimit();e.miterLimit=void 0!==l?l:10;const h=t.getOffset();e.strokeOffset=h??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=[Mr.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[Mr.SET_STROKE_STYLE,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,n=t.lineCap,r=t.lineDash,s=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit,h=t.strokeOffset;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!P(t.currentLineDash,r)||t.currentLineDashOffset!=s||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l||t.currentStrokeOffset!=h)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=s,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l,t.currentStrokeOffset=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[Mr.END_GEOMETRY,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;K(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Fr=class extends Pr{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinatess_(t,e,i,n,r){const s=this.state,o=void 0!==s.fillStyle,a=void 0!==s.strokeStyle,l=i.length;this.instructions.push(Er),this.hitDetectionInstructions.push(Er);for(let s=0;s<l;++s){const o=i[s],l=this.coordinates.length,h=this.appendFlatLineCoordinates(t,e,o,n,!0,!a);this.instructions.push([Mr.MOVE_TO_LINE_TO,l,h,r*this.pixelRatio,!0]),this.hitDetectionInstructions.push([Mr.MOVE_TO_LINE_TO,l,h,r,!0]),a&&(this.instructions.push(Ir),this.hitDetectionInstructions.push(Ir)),e=o}return o&&(this.instructions.push(Rr),this.hitDetectionInstructions.push(Rr)),a&&(this.instructions.push(Tr),this.hitDetectionInstructions.push(Tr)),e}drawCircle(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_(()=>this.drawCircle(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Mr.SET_FILL_STYLE,sr]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Mr.SET_STROKE_STYLE,hr,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,ar,0]);const a=t.getFlatCoordinates(),l=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const c=[Mr.CIRCLE,h,o];this.instructions.push(Er,c),this.hitDetectionInstructions.push(Er,c),void 0!==n.fillStyle&&(this.instructions.push(Rr),this.hitDetectionInstructions.push(Rr)),void 0!==n.strokeStyle&&(this.instructions.push(Tr),this.hitDetectionInstructions.push(Tr)),this.endGeometry(e)}drawPolygon(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_(()=>this.drawPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Mr.SET_FILL_STYLE,sr]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Mr.SET_STROKE_STYLE,hr,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,ar,0]);const a=t.getEnds(),l=t.getOrientedFlatCoordinates(),h=t.getStride();this.drawFlatCoordinatess_(l,0,a,h,o),this.endGeometry(e)}drawMultiPolygon(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_(()=>this.drawMultiPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Mr.SET_FILL_STYLE,sr]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Mr.SET_STROKE_STYLE,hr,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,ar,0]);const a=t.getEndss(),l=t.getOrientedFlatCoordinates(),h=t.getStride();let c=0;for(let t=0,e=a.length;t<e;++t)c=this.drawFlatCoordinatess_(l,c,a[t],h,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,n=e.length;i<n;++i)e[i]=wi(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,n=e.strokeStyle,r=e.strokeOffset;return Math.abs(r)>0&&void 0!==i&&void 0!==n&&(e.strokeStyle=void 0,e.strokeOffset=0,t(),e.fillStyle=void 0,e.strokeStyle=n,e.strokeOffset=r,t(),e.fillStyle=i,!0)}};let Or=0,kr=1;function Ar(t,e,i,n,r,s,o,a){const l=o-r,h=a-s;let c=0,u=1;if(0===l){if(r<t||r>i)return!1}else{let e=(t-r)/l,n=(i-r)/l;if(e>n){const t=e;e=n,n=t}if(e>c&&(c=e),n<u&&(u=n),c>u)return!1}if(0===h){if(s<e||s>n)return!1}else{let t=(e-s)/h,i=(n-s)/h;if(t>i){const e=t;t=i,i=e}if(t>c&&(c=t),i<u&&(u=i),c>u)return!1}return Or=c,kr=u,!0}function Lr(t,e,i,n,r){const s=[];let o=i,a=0,l=e.slice(i,2);for(;a<t&&o+r<n;){const[i,n]=l.slice(-2),h=e[o+r],c=e[o+r+1],u=Math.sqrt((h-i)*(h-i)+(c-n)*(c-n));if(a+=u,a>=t){const e=(t-a+u)/u,d=jt(i,h,e),f=jt(n,c,e);l.push(d,f),s.push(l),l=[d,f],a==t&&(o+=r),a=0}else if(a<t)l.push(e[o+r],e[o+r+1]),o+=r;else{const t=u-a,e=jt(i,h,t/u),d=jt(n,c,t/u);l.push(e,d),s.push(l),l=[e,d],a=0,o+=r}}return a>0&&s.push(l),s}function Dr(t,e,i,n,r){let s,o,a,l,h,c,u,d,f,g,p=i,_=i,m=0,y=0,x=i;for(o=i;o<n;o+=r){const i=e[o],n=e[o+1];void 0!==h&&(f=i-h,g=n-c,l=Math.sqrt(f*f+g*g),void 0!==u&&(y+=a,s=Math.acos((u*f+d*g)/(a*l)),s>t&&(y>m&&(m=y,p=x,_=o),y=0,x=o-r)),a=l,u=f,d=g),h=i,c=n}return y+=l,y>m?[x,o]:[p,_]}const jr={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};const Gr={Circle:Fr,Default:Pr,Image:class extends Pr{constructor(t,e,i,n){super(t,e,i,n),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!q(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=t.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(n,r);this.instructions.push([Mr.DRAW_IMAGE,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([Mr.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=[];for(let e=0,i=n.length;e<i;e+=t.getStride())this.maxExtent&&!q(this.maxExtent,n.slice(e,e+2))||r.push(n[e],n[e+1]);const s=this.coordinates.length,o=this.appendFlatPointCoordinates(r,2);this.instructions.push([Mr.DRAW_IMAGE,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([Mr.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),n=t.getSize(),r=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}},LineString:class extends Pr{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n,r){const s=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,n,!1,!1);return this.instructions.push([Mr.MOVE_TO_LINE_TO,s,o,r*this.pixelRatio]),this.hitDetectionInstructions.push([Mr.MOVE_TO_LINE_TO,s,o,r]),i}drawLineString(t,e,i){const n=this.state,r=n.strokeStyle,s=n.lineWidth,o=n.strokeOffset;if(void 0===r||void 0===s)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([Mr.SET_STROKE_STYLE,hr,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,ar,0],Er);const a=t.getFlatCoordinates(),l=t.getStride();this.drawFlatCoordinates_(a,0,a.length,l,o),this.hitDetectionInstructions.push(Tr),this.endGeometry(e)}drawMultiLineString(t,e,i){const n=this.state,r=n.strokeStyle,s=n.lineWidth,o=n.strokeOffset;if(void 0===r||void 0===s)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([Mr.SET_STROKE_STYLE,hr,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,ar,0],Er);const a=t.getEnds(),l=t.getFlatCoordinates(),h=t.getStride();let c=0;for(let t=0,e=a.length;t<e;++t)c=this.drawFlatCoordinates_(l,c,a[t],h,o);this.hitDetectionInstructions.push(Tr),this.endGeometry(e)}finish(){const t=this.state;return null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(Tr),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(Tr),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(Er)}},Polygon:Fr,Text:class extends Pr{constructor(t,e,i,n){super(t,e,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[sr]={fillStyle:sr},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 n=this.textFillState_,r=this.textStrokeState_,s=this.textState_;if(""===this.text_||!s||!n&&!r)return;const o=this.coordinates;let a=o.length;const l=t.getType();let h=null,c=t.getStride();if("line"!==s.placement||"LineString"!=l&&"MultiLineString"!=l&&"Polygon"!=l&&"MultiPolygon"!=l){let n=s.overflow?null:[];switch(l){case"Point":case"MultiPoint":h=t.getFlatCoordinates();break;case"LineString":h=t.getFlatMidpoint();break;case"Circle":h=t.getCenter();break;case"MultiLineString":h=t.getFlatMidpoints(),c=2;break;case"Polygon":h=t.getFlatInteriorPoint(),s.overflow||n.push(h[2]/this.resolution),c=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();h=[];for(let t=0,i=e.length;t<i;t+=3)s.overflow||n.push(e[t+2]/this.resolution),h.push(e[t],e[t+1]);if(0===h.length)return;c=2}const r=this.appendFlatPointCoordinates(h,c);if(r===a)return;if(n&&(r-a)/2!==h.length/c){let t=a/2;n=n.filter((e,i)=>{const n=o[2*(t+i)]===h[i*c]&&o[2*(t+i)+1]===h[i*c+1];return n||--t,n})}this.saveTextStates_();const u=s.backgroundFill?this.createFill(this.fillStyleToState(s.backgroundFill)):null,d=s.backgroundStroke?this.createStroke(this.strokeStyleToState(s.backgroundStroke)):null;this.beginGeometry(t,e,i);let f=s.padding;if(f!=dr&&(s.scale[0]<0||s.scale[1]<0)){let t=s.padding[0],e=s.padding[1],i=s.padding[2],n=s.padding[3];s.scale[0]<0&&(e=-e,n=-n),s.scale[1]<0&&(t=-t,i=-i),f=[t,e,i,n]}const g=this.pixelRatio;this.instructions.push([Mr.DRAW_IMAGE,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,f==dr?dr:f.map(function(t){return t*g}),u,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]);const p=1/g,_=u?u.slice(0):null;_&&(_[1]=sr),this.hitDetectionInstructions.push([Mr.DRAW_IMAGE,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[p,p],NaN,this.declutterMode_,this.declutterImageWithText_,f,_,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?sr:this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]),this.endGeometry(e)}else{const n=t.getExtent();if(!wt(this.maxExtent,n))return;let r;if(h=t.getFlatCoordinates(),"LineString"==l)r=[h.length];else if("MultiLineString"==l)r=t.getEnds();else if("Polygon"==l)r=t.getEnds().slice(0,1);else if("MultiPolygon"==l){const e=t.getEndss();r=[];for(let t=0,i=e.length;t<i;++t)r.push(e[t][0])}if(("LineString"==l||"MultiLineString"==l)&&!H(this.getBufferedMaxExtent(),n)){const t=function(t,e,i,n){const r=n[0],s=n[1],o=n[2],a=n[3],l=[],h=[];let c,u,d=!1,f=0;for(let n=0,g=e.length;n<g;++n){const g=e[n];let p=t[f],_=t[f+1],m=!1;for(let e=f+i;e<g;e+=i){const i=t[e],n=t[e+1];if(Ar(r,s,o,a,p,_,i,n)){const t=i-p,e=n-_,r=p+Or*t,s=_+Or*e,o=p+kr*t,a=_+kr*e;d&&m&&r===c&&s===u?l.push(o,a):(d&&h.push(l.length),l.push(r,s,o,a),d=!0),c=o,u=a,m=!0}p=i,_=n}f=g}return d&&h.push(l.length),{flatCoordinates:l,ends:h}}(h,r,c,this.getBufferedMaxExtent());if(h=t.flatCoordinates,r=t.ends,c=2,0===r.length)return}this.beginGeometry(t,e,i);const u=s.repeat,d=u?void 0:s.textAlign;let f=0;for(let t=0,e=r.length;t<e;++t){let e;e=u?Lr(u*this.resolution,h,f,r[t],c):[h.slice(f,r[t])];for(let i=0,n=e.length;i<n;++i){const n=e[i];let l=0,h=n.length;if(null==d){const t=Dr(s.maxAngle,n,0,n.length,2);l=t[0],h=t[1]}for(let t=l;t<h;t+=c)o.push(n[t],n[t+1]);const u=o.length;f=r[t],this.drawChars_(a,u),a=u}}this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,n=this.strokeKey_;t&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const r=this.textKey_;r in this.textStates||(this.textStates[r]={font:e.font,textAlign:e.textAlign||cr,justify:e.justify,textBaseline:e.textBaseline||ur,scale:e.scale});const s=this.fillKey_;i&&(s in this.fillStates||(this.fillStates[s]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,n=this.textState_,r=this.strokeKey_,s=this.textKey_,o=this.fillKey_;this.saveTextStates_();const a=this.pixelRatio,l=jr[n.textBaseline],h=this.textOffsetX_*a,c=this.textOffsetY_*a,u=this.text_,d=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([Mr.DRAW_CHARS,t,e,l,n.overflow,o,n.maxAngle,a,c,r,d*a,u,s,1,this.declutterMode_,this.textKeepUpright_,h]),this.hitDetectionInstructions.push([Mr.DRAW_CHARS,t,e,l,n.overflow,o?sr:o,n.maxAngle,a,c,r,d*a,u,s,1/a,this.declutterMode_,this.textKeepUpright_,h])}setTextStyle(t,e){let i,n,r;if(t){const e=t.getFill();e?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=$n(e.getColor()||sr)):(n=null,this.textFillState_=n);const s=t.getStroke();if(s){r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const t=s.getLineDash(),e=s.getLineDashOffset(),i=s.getWidth(),n=s.getMiterLimit();r.lineCap=s.getLineCap()||or,r.lineDash=t?t.slice():ar,r.lineDashOffset=void 0===e?0:e,r.lineJoin=s.getLineJoin()||lr,r.lineWidth=void 0===i?1:i,r.miterLimit=void 0===n?10:n,r.strokeStyle=$n(s.getColor()||hr)}else r=null,this.textStrokeState_=r;i=this.textState_;const o=t.getFont()||rr;xr(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()||ur,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||dr,i.scale=void 0===a?[1,1]:a;const l=t.getOffsetX(),h=t.getOffsetY(),c=t.getRotateWithView(),u=t.getKeepUpright(),d=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=void 0===l?0:l,this.textOffsetY_=void 0===h?0:h,this.textRotateWithView_=void 0!==c&&c,this.textKeepUpright_=void 0===u||u,this.textRotation_=void 0===d?0:d,this.strokeKey_=r?("string"==typeof r.strokeStyle?r.strokeStyle:X(r.strokeStyle))+r.lineCap+r.lineDashOffset+"|"+r.lineWidth+r.lineJoin+r.miterLimit+"["+r.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=n&&n.fillStyle?"string"==typeof n.fillStyle?n.fillStyle:"|"+X(n.fillStyle):""}else this.text_="";this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}};var Wr=class{constructor(t,e,i,n){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=n,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 n in i){const r=i[n].finish();t[e][n]=r}}return t}getBuilder(t,e){const i=void 0!==t?t.toString():"0";let n=this.buildersByZIndex_[i];void 0===n&&(n={},this.buildersByZIndex_[i]=n);let r=n[e];return void 0===r&&(r=new(0,Gr[e])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=r),r}};function Xr(t,e,i,n){let r=t[e],s=t[e+1],o=0;for(let a=e+n;a<i;a+=n){const e=t[a],i=t[a+1];o+=Math.sqrt((e-r)*(e-r)+(i-s)*(i-s)),r=e,s=i}return o}function zr(t,e,i,n,r,s,o,a){o=o??[],a=a??n;const l=t[e+n],h=t[e+n+1],c=t[i-2*n],u=t[i-2*n+1];let d,f,g,p,_,m,y,x,v=0;for(let S=e;S<i;S+=n){g=d,p=f,_=void 0,m=void 0,S+n<i&&(_=t[S+n],m=t[S+n+1]),s&&S===e&&(g=c,p=u),s&&S===i-n&&(_=l,m=h),d=t[S],f=t[S+1],[y,x]=Yr(d,f,g,p,_,m,r),o[v++]=y,o[v++]=x;for(let e=2;e<a;e++)o[v++]=t[S+e]}return o.length!=v&&(o.length=v),o}function Yr(t,e,i,n,r,s,o){let a,l;void 0!==i&&void 0!==n?(a=t-i,l=e-n):void 0!==r&&void 0!==s?(a=r-t,l=s-e):(a=1,l=0);const h=Math.hypot(a,l),c=a/h,u=l/h;if(a=-u,l=c,void 0===i||void 0===n)return[t+a*o,e+l*o];if(void 0===r||void 0===s)return[t+a*o,e+l*o];const d=function(t,e,i){const n=Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),r=[(e[0]-t[0])/n,(e[1]-t[1])/n],s=[-r[1],r[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 l=0===n||0===o?0:Math.acos(Ft(a[0]*r[0]+a[1]*r[1],-1,1));return l=Math.max(l,1e-5),a[0]*s[0]+a[1]*s[1]>0?l:2*Math.PI-l}([t,e],[i,n],[r,s]);if(Math.cos(d)>.998)return[t+c*o,e+u*o];const f=Math.cos(d/2),g=Math.sin(d/2);return[t+1/g*(g*a+f*l)*o,e+1/g*(-f*a+g*l)*o]}function Nr(t,e,i=!1){for(let n=0,r=t.length-2;n<r;n+=e)for(let r=i&&0===n?t.length-3*e:t.length-2*e;r>n+e;r-=e){const i=t[n],s=t[n+1],o=t[n+e],a=t[n+e+1],l=t[r],h=t[r+1],c=t[r+e],u=t[r+e+1],d=(u-h)*(o-i)-(c-l)*(a-s);if(0===d)continue;const f=((c-l)*(s-h)-(u-h)*(i-l))/d,g=((o-i)*(s-h)-(a-s)*(i-l))/d;if(f>0&&f<1&&g>0&&g<1){const l=i+f*(o-i),h=s+f*(a-s);t[n+e]=l,t[n+e+1]=h,t.splice(n+2*e,r-n-e);break}}return t}let Br;function Zr(t,e,i,n,r,s,o,a,l,h,c,u,d=!0){let f=t[e],g=t[e+1],p=0,_=0,m=0,y=0;function x(){p=f,_=g,f=t[e+=n],g=t[e+1],y+=m,m=Math.sqrt((f-p)*(f-p)+(g-_)*(g-_))}do{x()}while(e<i-n&&y+m<s);let v=0===m?0:(s-y)/m;const S=jt(p,f,v),w=jt(_,g,v),C=e-n,b=y,R=s+a*l(h,r,c);for(;e<i-n&&y+m<R;)x();v=0===m?0:(R-y)/m;const T=jt(p,f,v),E=jt(_,g,v);let I=!1;if(d)if(u){const t=[S,w,T,E];Ti(t,0,4,2,u,t,t),I=t[0]>t[2]}else I=S>T;const M=Math.PI,P=[],F=C+n===e;let O;if(m=0,y=b,f=t[e=C],g=t[e+1],F){x(),O=Math.atan2(g-_,f-p),I&&(O+=O>0?-M:M);const t=(T+S)/2,e=(E+w)/2;return P[0]=[t,e,(R-s)/2,O,r],P}r=r.replace(/\n/g," ");const k=Array.from((Br||(Br=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Br).segment(r),t=>t.segment);for(let t=0,r=k.length;t<r;){x();let u=Math.atan2(g-_,f-p);if(I&&(u+=u>0?-M:M),void 0!==O){let t=u-O;if(t+=t>M?-2*M:t<-M?2*M:0,Math.abs(t)>o)return null}O=u;const d=t;let S=0;for(;t<r;++t){const o=a*l(h,k[I?r-t-1:t],c);if(e+n<i&&y+m<s+S+o/2)break;S+=o}if(t===d)continue;const w=(I?k.slice(r-t,r-d):k.slice(d,t)).join("");v=0===m?0:(s+S/2-y)/m;const C=jt(p,f,v),b=jt(_,g,v);P.push([C,b,S/2,u,w]),s+=S}return P}var Vr=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(yn(),{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,n=e.length;i<n;++i){const n=e[i];if("function"==typeof n){n(t);continue}const r=e[++i];"function"==typeof t[n]?t[n](...r):t[n]="function"==typeof r?r(t):r}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}};const Ur=[1/0,1/0,-1/0,-1/0],Kr=[],$r=[],qr=[],Hr=[];function Jr(t){return t[3].declutterBox}const Qr=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 ts(t,e){return"start"===e?e=Qr.test(t)?"right":"left":"end"===e&&(e=Qr.test(t)?"left":"right"),jr[e]}function es(t,e,i){return i>0&&t.push("\n",""),t.push(e,""),t}function is(t,e,i){return i%2==0&&(t+=e),t}var ns=class{constructor(t,e,i,n,r){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=Mi(),this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=r?new Vr:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,n){const r=t+e+i+n;if(this.labels_[r])return this.labels_[r];const s=n?this.strokeStates[n]:null,o=i?this.fillStates[i]:null,a=this.textStates[e],l=this.pixelRatio,h=[a.scale[0]*l,a.scale[1]*l],c=a.justify?jr[a.justify]:ts(Array.isArray(t)?t[0]:t,a.textAlign||cr),u=n&&s.lineWidth?s.lineWidth:0,d=Array.isArray(t)?t:String(t).split("\n").reduce(es,[]),{width:f,height:g,widths:p,heights:_,lineWidths:m}=function(t,e){const i=[],n=[],r=[];let s=0,o=0,a=0,l=0;for(let h=0,c=e.length;h<=c;h+=2){const u=e[h];if("\n"===u||h===c){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}const d=e[h+1]||t.font,f=wr(d,u);i.push(f),o+=f;const g=vr(d);n.push(g),l=Math.max(l,g)}return{width:s,height:a,widths:i,heights:n,lineWidths:r}}(a,d),y=f+u,x=[],v=(y+2)*h[0],S=(g+u)*h[1],w={width:v<0?Math.floor(v):Math.ceil(v),height:S<0?Math.floor(S):Math.ceil(S),contextInstructions:x};1==h[0]&&1==h[1]||x.push("scale",h),n&&(x.push("strokeStyle",s.strokeStyle),x.push("lineWidth",u),x.push("lineCap",s.lineCap),x.push("lineJoin",s.lineJoin),x.push("miterLimit",s.miterLimit),x.push("setLineDash",[s.lineDash]),x.push("lineDashOffset",s.lineDashOffset)),i&&x.push("fillStyle",o.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const C=.5-c;let b=c*y+C*u;const R=[],T=[];let E,I=0,M=0,P=0,F=0;for(let t=0,e=d.length;t<e;t+=2){const e=d[t];if("\n"===e){M+=I,I=0,b=c*y+C*u,++F;continue}const r=d[t+1]||a.font;r!==E&&(n&&R.push("font",r),i&&T.push("font",r),E=r),I=Math.max(I,_[P]);const s=[e,b+C*p[P]+c*(p[P]-m[F]),.5*(u+I)+M];b+=p[P],n&&R.push("strokeText",s),i&&T.push("fillText",s),++P}return Array.prototype.push.apply(x,R),Array.prototype.push.apply(x,T),this.labels_[r]=w,w}replayTextBackground_(t,e,i,n,r,s,o){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,n),t.lineTo.apply(t,r),t.lineTo.apply(t,e),s&&(this.alignAndScaleFill_=s[2],t.fillStyle=s[1],this.fill_(t)),o&&(this.setStrokeStyle_(t,o),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,n,r,s,o,a,l,h,c,u,d,f,g,p){let _=i-(o*=u[0]),m=n-(a*=u[1]);const y=r+l>t?t-l:r,x=s+h>e?e-h:s,v=f[3]+y*u[0]+f[1],S=f[0]+x*u[1]+f[2],w=_-f[3],C=m-f[0];let b;return(g||0!==c)&&(Kr[0]=w,Hr[0]=w,Kr[1]=C,$r[1]=C,$r[0]=w+v,qr[0]=$r[0],qr[1]=C+S,Hr[1]=qr[1]),0!==c?(b=Li(Mi(),i,n,1,1,c,-i,-n),ki(b,Kr),ki(b,$r),ki(b,qr),ki(b,Hr),tt(Math.min(Kr[0],$r[0],qr[0],Hr[0]),Math.min(Kr[1],$r[1],qr[1],Hr[1]),Math.max(Kr[0],$r[0],qr[0],Hr[0]),Math.max(Kr[1],$r[1],qr[1],Hr[1]),Ur)):tt(Math.min(w,w+v),Math.min(C,C+S),Math.max(w,w+v),Math.max(C,C+S),Ur),d&&(_=Math.round(_),m=Math.round(m)),{drawImageX:_,drawImageY:m,drawImageW:y,drawImageH:x,originX:l,originY:h,declutterBox:{minX:Ur[0],minY:Ur[1],maxX:Ur[2],maxY:Ur[3],value:p},canvasTransform:b,scale:u}}replayImageOrLabel_(t,e,i,n,r,s,o){const a=!(!s&&!o),l=n.declutterBox,h=o?o[2]*n.scale[0]/2:0;return l.minX-h<=e[0]&&l.maxX+h>=0&&l.minY-h<=e[1]&&l.maxY+h>=0&&(a&&this.replayTextBackground_(t,Kr,$r,qr,Hr,s,o),function(t,e,i,n,r,s,o,a,l,h,c){t.save(),1!==i&&(void 0===t.globalAlpha?t.globalAlpha=t=>t.globalAlpha*=i:t.globalAlpha*=i),e&&t.transform.apply(t,e),n.contextInstructions?(t.translate(l,h),t.scale(c[0],c[1]),function(t,e){const i=t.contextInstructions;for(let t=0,n=i.length;t<n;t+=2)Array.isArray(i[t+1])?e[i[t]].apply(e,i[t+1]):e[i[t]]=i[t+1]}(n,t)):c[0]<0||c[1]<0?(t.translate(l,h),t.scale(c[0],c[1]),t.drawImage(n,r,s,o,a,0,0,o,a)):t.drawImage(n,r,s,o,a,l,h,o*c[0],a*c[1]),t.restore()}(t,n.canvasTransform,r,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=ki(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(i[0]%n,i[1]%n),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,n){const r=this.textStates[e],s=this.createLabel(t,e,n,i),o=this.strokeStates[i],a=this.pixelRatio,l=ts(Array.isArray(t)?t[0]:t,r.textAlign||cr),h=jr[r.textBaseline||ur],c=o&&o.lineWidth?o.lineWidth:0;return{label:s,anchorX:l*(s.width/a-2*r.scale[0])+2*(.5-l)*c,anchorY:h*s.height/a+2*(.5-h)*c}}execute_(t,e,i,n,r,s,o,a){const l=this.zIndexContext_;let h;var c,u;this.pixelCoordinates_&&P(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=Ri(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),u=i,(c=this.renderedTransform_)[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 f=n.length;let g,p=0;const _=[];let m,y,x,v,S,w,C,b,R,T,E,I,M,F=0,O=0;const k=this.coordinateCache_,A=this.viewRotation_,L=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,D={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:A},j=this.instructions!=n||this.overlaps?0:200;let G,W,X,z;for(;d<f;){const i=n[d];switch(i[0]){case Mr.BEGIN_GEOMETRY:G=i[1],z=i[3],G.getGeometry()?void 0===o||wt(o,z.getExtent())?++d:d=i[2]+1:d=i[2],l&&(l.zIndex=i[4]);break;case Mr.BEGIN_PATH:F>j&&(this.fill_(t),F=0),O>j&&(t.stroke(),O=0),F||O||(t.beginPath(),S=NaN,w=NaN),++d;break;case Mr.CIRCLE:p=i[1],x=i[2]??0;const n=h[p],c=h[p+1],u=h[p+2]-x-n,f=h[p+3]-x-c,P=Math.sqrt(u*u+f*f);t.moveTo(n+P,c),t.arc(n,c,P,0,2*Math.PI,!0),++d;break;case Mr.CLOSE_PATH:t.closePath(),++d;break;case Mr.CUSTOM:p=i[1],g=i[2];const Y=i[3],N=i[4],B=i[5];D.geometry=Y,D.feature=G,d in k||(k[d]=[]);const Z=k[d];B?B(h,p,g,2,Z):(Z[0]=h[p],Z[1]=h[p+1],Z.length=2),l&&(l.zIndex=i[6]),N(Z,D),++d;break;case Mr.DRAW_IMAGE:p=i[1],g=i[2],R=i[3],m=i[4],y=i[5];let V=i[6];const U=i[7],K=i[8],$=i[9],q=i[10];let H=i[11];const J=i[12];let Q=i[13];v=i[14]||"declutter";const tt=i[15];if(!R&&i.length>=20){T=i[19],E=i[20],I=i[21],M=i[22];const t=this.drawLabelWithPointPlacement_(T,E,I,M);R=t.label,i[3]=R;const e=i[23];m=(t.anchorX-e)*this.pixelRatio,i[4]=m;const n=i[24];y=(t.anchorY-n)*this.pixelRatio,i[5]=y,V=R.height,i[6]=V,Q=R.width,i[13]=Q}let et,it,nt,rt;i.length>25&&(et=i[25]),i.length>17?(it=i[16],nt=i[17],rt=i[18]):(it=dr,nt=null,rt=null),q&&L?H+=A:q||L||(H-=A);let st=0;for(;p<g;p+=2){if(et&&et[st++]<Q/this.pixelRatio)continue;const i=this.calculateImageOrLabelDimensions_(R.width,R.height,h[p],h[p+1],Q,V,m,y,K,$,H,J,r,it,!!nt||!!rt,G),n=[t,e,R,i,U,nt,rt];if(a){let t,e,r,s,o;if(tt){const i=g-p;if(!tt[i]){tt[i]={args:n,declutterMode:v};continue}const s=tt[i];t=s.args,e=s.declutterMode,delete tt[i],r=Jr(t)}if(!t||"declutter"===e&&a.collides(r)||(s=!0),"declutter"===v&&a.collides(i.declutterBox)||(o=!0),"declutter"===e&&"declutter"===v){const t=s&&o;s=t,o=t}s&&("none"!==e&&a.insert(r),this.replayImageOrLabel_.apply(this,t)),o&&("none"!==v&&a.insert(i.declutterBox),this.replayImageOrLabel_.apply(this,n))}else this.replayImageOrLabel_.apply(this,n)}++d;break;case Mr.DRAW_CHARS:const ot=i[1],at=i[2],lt=i[3],ht=i[4];M=i[5];const ct=i[6],ut=i[7],dt=i[8];I=i[9];const ft=i[10];T=i[11],Array.isArray(T)&&(T=T.reduce(is,"")),E=i[12];const gt=[i[13],i[13]];v=i[14]||"declutter";const pt=i[15],_t=i[16],mt=this.textStates[E],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 St=Xr(h,ot,at,2),Ct=Math.abs(xt[0])*Cr(yt,T,vt);if(ht||Ct<=St){const i=Zr(h,ot,at,2,T,(St-Ct)*ts(T,this.textStates[E].textAlign),ct,Math.abs(xt[0]),Cr,yt,vt,L?0:this.viewRotation_,pt);t:if(i){const n=[];let r,s,o,l,h;if(I)for(r=0,s=i.length;r<s;++r){h=i[r],o=h[4],l=this.createLabel(o,E,"",I),m=h[2]+(xt[0]<0?-ft:ft)-_t,y=lt*l.height+2*(.5-lt)*ft*xt[1]/xt[0]-dt;const s=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,m,y,0,0,h[3],gt,!1,dr,!1,G);if(a&&"declutter"===v&&a.collides(s.declutterBox))break t;n.push([t,e,l,s,1,null,null])}if(M)for(r=0,s=i.length;r<s;++r){h=i[r],o=h[4],l=this.createLabel(o,E,M,""),m=h[2]-_t,y=lt*l.height-dt;const s=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,m,y,0,0,h[3],gt,!1,dr,!1,G);if(a&&"declutter"===v&&a.collides(s.declutterBox))break t;n.push([t,e,l,s,1,null,null])}a&&"none"!==v&&a.load(n.map(Jr));for(let t=0,e=n.length;t<e;++t)this.replayImageOrLabel_.apply(this,n[t])}}++d;break;case Mr.END_GEOMETRY:if(void 0!==s){G=i[1];const t=s(G,z,v);if(t)return t}++d;break;case Mr.FILL:j?F++:this.fill_(t),++d;break;case Mr.MOVE_TO_LINE_TO:let bt,Rt,Tt;if(p=i[1],g=i[2],x=i[3],x){const t=(i[4]??!1)||Math.abs(h[p]-h[g-2])<1e-6&&Math.abs(h[p+1]-h[g-1])<1e-6;zr(h,p,g,2,x,t,_),Nr(_,2,t),bt=_,Rt=0,Tt=bt.length}else bt=h,Rt=p,Tt=g;W=bt[Rt],X=bt[Rt+1],t.moveTo(W,X),S=W+.5|0,w=X+.5|0;for(let e=Rt+2;e<Tt;e+=2)W=bt[e],X=bt[e+1],C=W+.5|0,b=X+.5|0,e!=Tt-2&&C===S&&b===w||(t.lineTo(W,X),S=C,w=b);++d;break;case Mr.SET_FILL_STYLE:this.alignAndScaleFill_=i[2],F?(this.fill_(t),F=0,O&&(t.stroke(),O=0)):O&&i[1]&&(t.stroke(),O=0),t.fillStyle=i[1],++d;break;case Mr.SET_STROKE_STYLE:F&&i[1]&&(this.fill_(t),F=0),O&&(t.stroke(),O=0),this.setStrokeStyle_(t,i),++d;break;case Mr.STROKE:j?O++:t.stroke(),++d;break;default:++d}}F&&this.fill_(t),O&&t.stroke()}execute(t,e,i,n,r,s){this.viewRotation_=n,this.execute_(t,e,i,this.instructions,r,void 0,void 0,s)}executeHitDetection(t,e,i,n,r){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,n,r)}};const rs=["Polygon","Circle","LineString","Image","Text","Default"],ss=["Image","Text"],os=rs.filter(t=>!ss.includes(t));let as=!1,ls=!1;const hs={};var cs=class{constructor(t,e,i,n,r,s,o){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=s,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=Mi(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,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 n=this.executorsByZIndex_[i];void 0===n&&(n={},this.executorsByZIndex_[i]=n);const r=t[i];for(const t in r){const i=r[t];n[t]=new ns(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,n=t.length;e<n;++e)if(t[e]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,n,r,s){!1===ls&&function(){let t=0;const e=e=>{const i=_n(1,1,null,{willReadFrequently:e});let n=0;const r=performance.now();for(;performance.now()-r<50;++n)i.fillStyle=`rgba(255,0,${n%256},1)`,i.fillRect(0,0,1,1),i.getImageData(0,0,1,1);return t=n>t?n:t,n},i={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0};as=i[t],ls=!0}();const o=2*(n=Math.round(n))+1,a=Li(this.hitDetectionTransform_,n+.5,n+.5,1/e,-1/e,-i,-t[0],-t[1]),l=!this.hitDetectionContext_;l&&(this.hitDetectionContext_=_n(o,o,null,{willReadFrequently:as}));const h=this.hitDetectionContext_;let c;h.canvas.width!==o||h.canvas.height!==o?(h.canvas.width=o,h.canvas.height=o):l||h.clearRect(0,0,o,o),void 0!==this.renderBuffer_&&(c=[1/0,1/0,-1/0,-1/0],ot(c,t),K(c,e*(this.renderBuffer_+n),c));const u=function(t){if(void 0!==hs[t])return hs[t];const e=2*t+1,i=t*t,n=new Array(i+1);for(let r=0;r<=t;++r)for(let s=0;s<=t;++s){const o=r*r+s*s;if(o>i)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+r)*e+(t+s))+3),r>0&&a.push(4*((t-r)*e+(t+s))+3),s>0&&(a.push(4*((t+r)*e+(t-s))+3),r>0&&a.push(4*((t-r)*e+(t-s))+3))}const r=[];for(let t=0,e=n.length;t<e;++t)n[t]&&r.push(...n[t]);return hs[t]=r,r}(n);let d;function f(t,e,i){const a=h.getImageData(0,0,o,o).data;for(let l=0,c=u.length;l<c;l++)if(a[u[l]]>0){if(!s||"none"===i||"Image"!==d&&"Text"!==d||s.includes(t)){const i=(u[l]-3)/4,s=n-i%o,a=n-(i/o|0),h=r(t,e,s*s+a*a);if(h)return h}h.clearRect(0,0,o,o);break}}const g=Object.keys(this.executorsByZIndex_).map(Number);let p,_,m,y,x;for(g.sort(R),p=g.length-1;p>=0;--p){const t=g[p].toString();for(m=this.executorsByZIndex_[t],_=rs.length-1;_>=0;--_)if(d=rs[_],y=m[d],void 0!==y&&(x=y.executeHitDetection(h,a,i,f,c),x))return x}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],r=e[2],s=e[3],o=[i,n,i,s,r,s,r,n];return Ri(o,0,8,2,t,o),o}isEmpty(){return x(this.executorsByZIndex_)}execute(t,e,i,n,r,s,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?T:R),s=s||rs;const l=rs.length;for(let h=0,c=a.length;h<c;++h){const c=a[h].toString(),u=this.executorsByZIndex_[c];for(let c=0,d=s.length;c<d;++c){const d=s[c],f=u[d];if(void 0!==f){const s=null===o?void 0:f.getZIndexContext(),c=s?s.getContext():t,u=this.maxExtent_&&"Image"!==d&&"Text"!==d;if(u&&(c.save(),this.clip(c,i)),s&&"Text"!==d&&"Image"!==d?s.pushFunction(t=>f.execute(t,e,i,n,r,o)):f.execute(c,e,i,n,r,o),u&&c.restore(),s){s.offset();const t=a[h]*l+rs.indexOf(d);this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(s)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(R);for(let i=0,n=e.length;i<n;++i)t[e[i]].forEach(t=>{t.draw(this.renderedContext_),t.clear()}),t[e[i]].length=0}};function us(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}class ds{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=us(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new ds({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 G()}getImage(t){return G()}getHitDetectionImage(){return G()}getPixelRatio(t){return 1}getImageState(){return G()}getImageSize(){return G()}getOrigin(){return G()}getSize(){return G()}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_=us(t)}listenImageChange(t){G()}load(){G()}unlistenImageChange(t){G()}ready(){return Promise.resolve()}}var fs=ds;function gs(t,e,i,n){return void 0!==i&&void 0!==n?[i/t,n/e]:void 0!==i?i/t:void 0!==n?n/e:1}class ps extends fs{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,n=void 0!==t.scale?t.scale:1,r=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:n,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:r,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 s=void 0!==t.img?t.img:null;let o,a=t.src;if(V(!(void 0!==a&&s),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!s||(a=s.src||X(s)),V(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),V(!((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=0:void 0!==s&&(o="complete"in s?s.complete?s.src?2:0:1:2),this.color_=void 0!==t.color?zn(t.color):null,this.iconImage_=Un(s,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 n=this.getImage(1);if(n.width&&n.height)e=n.width,i=n.height;else if(n instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(gs(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(gs(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 ps({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?zn(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(),n=void 0!==i?null:this.getHitDetectionImage(),r=void 0!==i?0:this.iconImage_.getImageState();this.iconImage_=Un(n,i,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},r,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_=Un(null,t,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},0,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();return this.size_?this.size_[0]*t[0]:2==this.iconImage_.getImageState()?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:2==this.iconImage_.getImageState()?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(C,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(C,t)}ready(){return this.iconImage_.ready()}}var _s=ps;const ms=Mi(),ys=[NaN,NaN];var xs=class extends Y{constructor(){super(),this.extent_=[1/0,1/0,-1/0,-1/0],this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=k((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return G()}closestPointXY(t,e,i,n){return G()}containsXY(t,e){return 0===this.closestPointXY(t,e,ys,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 G()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&et(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){G()}scale(t,e,i){G()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return G()}getType(){return G()}applyTransform(t){G()}intersectsExtent(t){return G()}translate(t,e){G()}transform(t,e){const i=Ge(t),n="tile-pixels"==i.getUnits()?function(t,n,r){const s=i.getExtent(),o=i.getWorldExtent(),a=_t(o)/_t(s);Li(ms,o[0],o[3],a,-a,0,0,0);const l=Ri(t,0,t.length,r,ms,n),h=Ze(i,e);return h?h(l,l,r):l}:Ze(i,e);return this.applyTransform(n),this}};function vs(t){let e;return 2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM"),e}function Ss(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}var ws=class extends xs{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return nt(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return G()}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=Ss(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){G()}setLayout(t,e,i){let n;if(t)n=Ss(t);else{for(let t=0;t<i;++t){if(0===e.length)return this.layout="XY",void(this.stride=2);e=e[0]}n=e.length,t=vs(n)}this.layout=t,this.stride=n}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 n=this.getStride();Ti(i,0,i.length,n,t,e,i),this.changed()}}scale(t,e,i){void 0===e&&(e=t),i||(i=ft(this.getExtent()));const n=this.getFlatCoordinates();if(n){const r=this.getStride();!function(t,e,i,n,r,s,o,a){a=a||[];const l=o[0],h=o[1];let c=0;for(let e=0;e<i;e+=n){const i=t[e]-l,o=t[e+1]-h;a[c++]=l+r*i,a[c++]=h+s*o;for(let i=e+2;i<e+n;++i)a[c++]=t[i]}a&&a.length!=c&&(a.length=c)}(n,0,n.length,r,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();!function(t,e,i,n,r,s,o){o=o||[];let a=0;for(let e=0;e<i;e+=n){o[a++]=t[e]+r,o[a++]=t[e+1]+s;for(let i=e+2;i<e+n;++i)o[a++]=t[i]}o&&o.length!=a&&(o.length=a)}(i,0,i.length,n,t,e,i),this.changed()}}},Cs=class extends Qn{constructor(t,e,i,n,r,s,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?Gt(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=r,this.squaredTolerance_=s,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_=Mi()}drawImages_(t,e,i,n){if(!this.image_)return;const r=Ri(t,e,i,n,this.transform_,this.pixelCoordinates_),s=this.context_,o=this.tmpLocalTransform_,a=s.globalAlpha;1!=this.imageOpacity_&&(s.globalAlpha=a*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let t=0,e=r.length;t<e;t+=2){const e=r[t]-this.imageAnchorX_,i=r[t+1]-this.imageAnchorY_;if(0!==l||1!=this.imageScale_[0]||1!=this.imageScale_[1]){const t=e+this.imageAnchorX_,n=i+this.imageAnchorY_;Li(o,t,n,1,1,l,-t,-n),s.save(),s.transform.apply(s,o),s.translate(t,n),s.scale(this.imageScale_[0],this.imageScale_[1]),s.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),s.restore()}else s.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,e,i,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(s.globalAlpha=a)}drawText_(t,e,i,n){if(!this.textState_||""===this.text_)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const r=Ri(t,e,i,n,this.transform_,this.pixelCoordinates_),s=this.context_;let o=this.textRotation_;for(0===this.transformRotation_&&(o-=this.viewRotation_),this.textRotateWithView_&&(o+=this.viewRotation_);e<i;e+=n){const t=r[e]+this.textOffsetX_,i=r[e+1]+this.textOffsetY_;0!==o||1!=this.textScale_[0]||1!=this.textScale_[1]?(s.save(),s.translate(t-this.textOffsetX_,i-this.textOffsetY_),s.rotate(o),s.translate(this.textOffsetX_,this.textOffsetY_),s.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&s.strokeText(this.text_,0,0),this.textFillState_&&s.fillText(this.text_,0,0),s.restore()):(this.textStrokeState_&&s.strokeText(this.text_,t,i),this.textFillState_&&s.fillText(this.text_,t,i))}}moveToLineTo_(t,e,i,n,r,s){const o=this.context_;let a=Ri(t,e,i,n,this.transform_,this.pixelCoordinates_);if(Math.abs(s)>0){const t=a.length,e=r||Math.abs(a[0]-a[t-2])<1e-6&&Math.abs(a[1]-a[t-1])<1e-6;a=zr(a,0,t,2,s,e,a),Nr(a,2,e)}o.moveTo(a[0],a[1]);let l=a.length;r&&(l-=2);for(let t=2;t<l;t+=2)o.lineTo(a[t],a[t+1]);return r&&o.closePath(),i}drawRings_(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s)e=this.moveToLineTo_(t,e,i[s],n,!0,r);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),wt(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 n=t.getFlatCoordinates();if(!n)return null;const r=t.getStride();return Ri(n,0,n.length,r,e,i)}(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],n=e[3]-e[1],r=Math.sqrt(i*i+n*n),s=this.context_;s.beginPath(),s.arc(e[0],e[1],r,0,2*Math.PI),this.fillState_&&s.fill(),this.strokeState_&&s.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_)),wt(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(wt(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();let n=0;const r=t.getEnds(),s=t.getStride();e.beginPath();for(let t=0,e=r.length;t<e;++t)n=this.moveToLineTo_(i,n,r[t],s,!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_)),wt(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_)),wt(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 n=0;const r=t.getEndss(),s=t.getStride();e.beginPath();for(let t=0,e=r.length;t<e;++t){const e=r[t];n=this.drawRings_(i,n,e,s,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),P(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_,n=t.textAlign?t.textAlign:cr;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=n&&(i.textAlign=n,e.textAlign=n),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=n,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:n,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(t){const e=t.getColor();this.fillState_={fillStyle:$n(e||sr)}}else this.fillState_=null;if(e){const t=e.getColor(),i=e.getLineCap(),n=e.getLineDash(),r=e.getLineDashOffset(),s=e.getLineJoin(),o=e.getWidth(),a=e.getMiterLimit(),l=n||ar,h=e.getOffset();this.strokeState_={lineCap:void 0!==i?i:or,lineDash:1===this.pixelRatio_?l:l.map(t=>t*this.pixelRatio_),lineDashOffset:(r||0)*this.pixelRatio_,lineJoin:void 0!==s?s:lr,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:$n(t||hr),strokeOffset:(h??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_),n=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const s=t.getScaleArray();this.imageScale_=[s[0]*this.pixelRatio_/i,s[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:$n(t||sr)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),r=i.getLineDashOffset(),s=i.getLineJoin(),o=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:or,lineDash:n||ar,lineDashOffset:r||0,lineJoin:void 0!==s?s:lr,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:$n(t||hr)}}else this.textStrokeState_=null;const n=t.getFont(),r=t.getOffsetX(),s=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),l=t.getScaleArray(),h=t.getText(),c=t.getTextAlign(),u=t.getTextBaseline();this.textState_={font:void 0!==n?n:rr,textAlign:void 0!==c?c:cr,textBaseline:void 0!==u?u:ur},this.text_=void 0!==h?Array.isArray(h)?h.reduce((t,e,i)=>t+(i%2?" ":e),""):h:"",this.textOffsetX_=void 0!==r?this.pixelRatio_*r:0,this.textOffsetY_=void 0!==s?this.pixelRatio_*s:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*l[0],this.pixelRatio_*l[1]]}else this.text_=""}};const bs=.5;function Rs(t,e,i,n,r,s,o,a,l){const h=l?Je(r):r,c=_n(t[0]*bs,t[1]*bs);c.imageSmoothingEnabled=!1;const u=c.canvas,d=new Cs(c,bs,r,null,o,a,l?Ne($e(),l):null),f=i.length,g=Math.floor(16777215/f),p={};for(let t=1;t<=f;++t){const e=i[t-1],r=e.getStyleFunction()||n;if(!r)continue;let o=r(e,s);if(!o)continue;Array.isArray(o)||(o=[o]);const a=(t*g).toString(16).padStart(7,"#00000");for(let t=0,i=o.length;t<i;++t){const i=o[t],n=i.getGeometryFunction()(e);if(!n||!wt(h,n.getExtent()))continue;const r=i.clone(),s=r.getFill();s&&s.setColor(a);const l=r.getStroke();l&&(l.setColor(a),l.setLineDash(null)),r.setText(void 0);const c=i.getImage();if(c){const t=c.getImageSize();if(!t)continue;const e=_n(t[0],t[1],void 0,{alpha:!1}),i=e.canvas;e.fillStyle=a,e.fillRect(0,0,i.width,i.height),r.setImage(new _s({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=r.getZIndex()||0;let d=p[u];d||(d={},p[u]=d,d.Polygon=[],d.Circle=[],d.LineString=[],d.Point=[]);const f=n.getType();if("GeometryCollection"===f){const t=n.getGeometriesArrayRecursive();for(let e=0,i=t.length;e<i;++e){const i=t[e];d[i.getType().replace("Multi","")].push(i,r)}}else d[f.replace("Multi","")].push(n,r)}}const _=Object.keys(p).map(Number).sort(R);for(let t=0,i=_.length;t<i;++t){const i=p[_[t]];for(const t in i){const n=i[t];for(let t=0,i=n.length;t<i;t+=2){d.setStyle(n[t+1]);for(let i=0,r=e.length;i<r;++i)d.setTransform(e[i]),d.drawGeometry(n[t])}}}return c.getImageData(0,0,u.width,u.height)}function Ts(t,e,i){const n=[];if(i){const r=Math.floor(Math.round(t[0])*bs),s=Math.floor(Math.round(t[1])*bs),o=4*(Ft(r,0,i.width-1)+Ft(s,0,i.height-1)*i.width),a=i.data[o],l=i.data[o+1],h=i.data[o+2]+256*(l+256*a),c=Math.floor(16777215/e.length);h&&h%c===0&&n.push(e[h/c-1])}return n}const Es={Point:function(t,e,i,n,r,s){const o=i.getImage(),a=i.getText(),l=a&&a.getText(),h=s&&o&&l?{}:void 0;if(o){if(2!=o.getImageState())return;const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(o,h),s.drawPoint(e,n,r)}if(l){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a,h),s.drawText(e,n,r)}},LineString:function(t,e,i,n,r){const s=i.getStroke();if(s){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawLineString(e,n,r)}const o=i.getText();if(o&&o.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,n,r)}},Polygon:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(s||o){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawPolygon(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}},MultiPoint:function(t,e,i,n,r,s){const o=i.getImage(),a=o&&0!==o.getOpacity(),l=i.getText(),h=l&&l.getText(),c=s&&a&&h?{}:void 0;if(a){if(2!=o.getImageState())return;const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(o,c),s.drawMultiPoint(e,n,r)}if(h){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(l,c),s.drawText(e,n,r)}},MultiLineString:function(t,e,i,n,r){const s=i.getStroke();if(s){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawMultiLineString(e,n,r)}const o=i.getText();if(o&&o.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,n,r)}},MultiPolygon:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(o||s){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawMultiPolygon(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}},GeometryCollection:function(t,e,i,n,r,s){const o=e.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a)(0,Es[o[a].getType()])(t,o[a],i,n,r,s)},Circle:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(s||o){const a=t.getBuilder(i.getZIndex(),"Circle");a.setFillStrokeStyle(s,o),a.drawCircle(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}}};function Is(t,e){return parseInt(X(t),10)-parseInt(X(e),10)}function Ms(t,e){const i=Ps(t,e);return i*i}function Ps(t,e){return.5*t/e}function Fs(t,e,i,n,r,s,o,a){const l=[],h=i.getImage();if(h){let t=!0;const e=h.getImageState();2==e||3==e?t=!1:0==e&&h.load(),t&&l.push(h.ready())}const c=i.getFill();c&&c.loading()&&l.push(c.ready());const u=l.length>0;return u&&Promise.all(l).then(()=>r(null)),function(t,e,i,n,r,s,o){const a=i.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(n,r);i.getRenderer()?Os(t,l,i,e,o):(0,Es[l.getType()])(t,l,i,e,o,s)}(t,e,i,n,s,o,a),u}function Os(t,e,i,n,r){if("GeometryCollection"==e.getType()){const s=e.getGeometries();for(let e=0,o=s.length;e<o;++e)Os(t,s[e],i,n,r);return}t.getBuilder(i.getZIndex(),"Default").drawCustom(e,n,i.getRenderer(),i.getHitDetectionRenderer(),r)}var ks=class extends A{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}},As=class extends j{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 G()}getData(t){return null}prepareFrame(t){return G()}renderFrame(t,e){return G()}forEachFeatureAtCoordinate(t,e,i,n,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;2!==e.getState()&&3!==e.getState()||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return 2!=e&&3!=e&&t.addEventListener(C,this.boundHandleImageChange_),0==e&&(t.load(),e=t.getState()),2==e}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}};const Ls=[];let Ds=null;var js=class extends As{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=Mi(),this.pixelTransform=Mi(),this.inversePixelTransform=Mi(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){let n;Ds||(Ds=_n(1,1,void 0,{willReadFrequently:!0})),Ds.clearRect(0,0,1,1);try{Ds.drawImage(t,e,i,1,1,0,0,1,1),n=Ds.getImageData(0,0,1,1).data}catch{return Ds=null,null}return n}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i,n,r){if(vn(t)&&0===this.pixelTransform[1]&&0===this.pixelTransform[2]&&0===this.pixelTransform[4]&&0===this.pixelTransform[5]&&t.width===n&&t.height===r){const e=t,n=e.getContext("2d");if(n)return this.container=t,this.context=n,this.containerReused=!0,void(i&&(n.fillStyle=i,n.fillRect(0,0,e.width,e.height)))}const s=this.getLayer().getClassName();let o,a;if(t&&t.className===s&&(!i||t&&t.style.backgroundColor&&P(zn(t.style.backgroundColor),zn(i)))){const e=t.firstElementChild;vn(e)&&(a=e.getContext("2d"))}if(a&&function(t,e){const i=ji(t),n=ji(e);for(let t=0;t<6;++t)if(0!==Math.round((i[t]-n[t])*Di[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=gn?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){return"firstElementChild"===e?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,i)}}):document.createElement("div"),o.className=s;let t=o.style;t.position="absolute",t.width="100%",t.height="100%",a=_n();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 n=xt(i),r=vt(i),s=dt(i),o=ut(i);ki(e.coordinateToPixelTransform,n),ki(e.coordinateToPixelTransform,r),ki(e.coordinateToPixelTransform,s),ki(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;ki(a,n),ki(a,r),ki(a,s),ki(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}prepareContainer(t,e){const i=t.extent,n=t.viewState.resolution,r=t.viewState.rotation,s=t.pixelRatio,o=Math.round(St(i)/n*s),a=Math.round(_t(i)/n*s);Li(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/s,1/s,r,-o/2,-a/2),function(t,e){const i=(n=e)[0]*n[3]-n[1]*n[2];var n;V(0!==i,"Transformation matrix cannot be inverted");const r=e[0],s=e[1],o=e[2],a=e[3],l=e[4],h=e[5];t[0]=a/i,t[1]=-s/i,t[2]=-o/i,t[3]=r/i,t[4]=(o*h-a*l)/i,t[5]=-(r*h-s*l)/i}(this.inversePixelTransform,this.pixelTransform);const l="matrix("+this.pixelTransform.join(", ")+")",h=this.getBackground(t);if(this.useContainer(e,l,h,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),l!==t.style.transform&&(t.style.transform=l)}}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const r=new ks(t,this.inversePixelTransform,i,e);n.dispatchEvent(r)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(Sn,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(wn,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new Vr),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(Sn,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(wn,this.context,t))}getRenderTransform(t,e,i,n,r,s,o){const a=r/2,l=s/2,h=n/e,c=-h,u=-t[0]+o,d=-t[1];return Li(this.tempTransform,a,l,h,c,-i,u,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}},Gs=class extends js{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 n=e.extent,r=e.viewState,s=r.center,o=r.resolution,a=r.projection,l=r.rotation,h=a.getExtent(),c=this.getLayer().getSource(),u=this.getLayer().getDeclutter(),d=e.pixelRatio,f=e.viewHints,g=!(f[0]||f[1]),p=this.context,_=Math.round(St(n)/o*d),m=Math.round(_t(n)/o*d),y=c.getWrapX()&&a.canWrapX(),x=y?St(h):null,v=y?Math.ceil((n[2]-h[2])/x)+(this.extendX_?2:1):1;let S=y?Math.floor((n[0]-h[0])/x)-(this.extendX_?1:0):0;do{let n=this.getRenderTransform(s,o,0,d,_,m,S*x);e.declutter&&(n=n.slice(0)),t.execute(p,[p.canvas.width,p.canvas.height],n,l,g,void 0===i?rs:i?ss:os,i?u&&e.declutter[u]:void 0)}while(++S<v)}setDrawContext_(){1!==this.opacity_&&(this.targetContext_=this.context,this.context=_n(this.context.canvas.width,this.context.canvas.height,Ls))}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,xn(this.context),Ls.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 n=t.viewState;this.prepareContainer(t,e);const r=this.context,s=this.replayGroup_;let o=s&&!s.isEmpty();if(!o&&!this.getLayer().hasListener(Sn)&&!this.getLayer().hasListener(wn))return this.container;this.setDrawContext_(),this.preRender(r,t);n.projection;this.clipExtent_=null;let a=!1;if(o&&i.extent&&this.clipping){const e=Qe(i.extent);o=wt(e,t.extent),o&&!H(e,t.extent)&&(t.declutter?this.clipExtent_=e:(this.clipUnrotated(r,t,e),a=!0))}return o&&this.renderWorlds(s,t,!this.getLayer().getDeclutter()&&void 0),a&&r.restore(),this.postRender(r,t),this.renderedRotation_!==n.rotation&&(this.renderedRotation_=n.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_,n=this.renderedRotation_,r=this.renderedProjection_,s=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],l=t[0]*bs,h=t[1]*bs;a.push(this.getRenderTransform(e,i,n,bs,l,h,0).slice());const c=o.getSource(),u=r.getExtent();if(c.getWrapX()&&r.canWrapX()&&!H(u,s)){let t=s[0];const r=St(u);let o,c=0;for(;t<u[0];)--c,o=r*c,a.push(this.getRenderTransform(e,i,n,bs,l,h,o).slice()),t+=r;for(c=0,t=s[2];t>u[2];)++c,o=r*c,a.push(this.getRenderTransform(e,i,n,bs,l,h,o).slice()),t-=r}const d=$e();this.hitDetectionImageData_=Rs(t,a,this.renderedFeatures_,o.getStyleFunction(),s,i,n,Ms(i,this.renderedPixelRatio_),d?r:null)}e(Ts(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,n,r){if(!this.replayGroup_)return;const s=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),l={},h=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,s,o,i,function(t,e,i){const s=X(t),o=l[s];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return l[s]=!0,r.splice(r.lastIndexOf(o),1),n(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return l[s]=!0,n(t,a,e);r.push(l[s]={feature:t,layer:a,geometry:e,distanceSq:i,callback:n})}},h?e.declutter?.[h]?.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 n=t.viewHints[0],r=t.viewHints[1],s=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!s&&n||!o&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,l=t.viewState,h=l.projection,c=l.resolution,u=t.pixelRatio,d=e.getRevision(),f=e.getRenderBuffer();let g=e.getRenderOrder();void 0===g&&(g=Is);const p=l.center.slice(),_=K(a,f*c),m=_.slice(),y=[_.slice()],x=h.getExtent(),v=i.getWrapX()&&h.canWrapX();if(this.extendX_=!1,v){const t=i.getExtent();t&&!Ct(t)&&(this.extendX_=t[0]<x[0]||t[2]>x[2])}if(v&&(!H(x,t.extent)||this.extendX_)){const t=St(x),e=Math.max(St(_)/2,t);let i=x[0],n=x[2];this.extendX_&&(i-=t,n+=t),_[0]=i-e,_[2]=n+e,Nt(p,h);const r=bt(y[0],h);r[0]<x[0]&&r[2]<x[2]?y.push([r[0]+t,r[1],r[2]+t,r[3]]):r[0]>x[0]&&r[2]>x[2]&&y.push([r[0]-t,r[1],r[2]-t,r[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedPixelRatio_===u&&this.renderedRevision_==d&&this.renderedRenderOrder_==g&&this.renderedFrameDeclutter_===!!t.declutter&&H(this.wrappedRenderedExtent_,_))return P(this.renderedExtent_,m)||(this.hitDetectionImageData_=null,this.renderedExtent_=m),this.renderedCenter_=p,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const S=new Wr(Ps(c,u),_,c,u),w=$e();let C;if(w){for(let t=0,e=y.length;t<e;++t){const e=Je(y[t]);i.loadFeatures(e,ti(c),w)}C=Ne(w,h)}else for(let t=0,e=y.length;t<e;++t)i.loadFeatures(y[t],c,h);const b=Ms(c,u);let R=!0;const T=(t,i)=>{let n;const r=t.getStyleFunction()||e.getStyleFunction();if(r&&(n=r(t,c)),n){const e=this.renderFeature(t,b,n,S,C,this.getLayer().getDeclutter(),i);R=R&&!e}},E=Je(_),I=i.getFeaturesInExtent(E);g&&I.sort(g);for(let t=0,e=I.length;t<e;++t)T(I[t],t);this.renderedFeatures_=I,this.ready=R;const M=S.finish(),F=new cs(_,c,u,i.getOverlaps(),M,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=c,this.renderedRevision_=d,this.renderedRenderOrder_=g,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=m,this.wrappedRenderedExtent_=_,this.renderedCenter_=p,this.renderedProjection_=h,this.renderedPixelRatio_=u,this.replayGroup_=F,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,n,r,s,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let l=0,h=i.length;l<h;++l)a=Fs(n,t,i[l],e,this.boundHandleStyleImageChange_,r,s,o)||a;else a=Fs(n,t,i,e,this.boundHandleStyleImageChange_,r,s,o);return a}};let Ws=0;const Xs=1<<Ws++,zs=1<<Ws++,Ys=1<<Ws++,Ns=1<<Ws++,Bs=1<<Ws++,Zs=1<<Ws++,Vs=Math.pow(2,6)-1,Us={[Xs]:"boolean",[zs]:"number",[Ys]:"string",[Ns]:"color",[Bs]:"number[]",[Zs]:"size"},Ks=Object.keys(Us).map(Number).sort(R);function $s(t){const e=[];for(const i of Ks)qs(t,i)&&e.push(Us[i]);return 0===e.length?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function qs(t,e){return(t&e)===e}function Hs(t,e){return!!(t&e)}function Js(t,e){return t===e}class Qs{constructor(t,e){if(!function(t){return t in Us}(t))throw new Error(`literal expressions must have a specific type, got ${$s(t)}`);this.type=t,this.value=e}}class to{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function eo(t){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:t}}function io(t,e,i){switch(typeof t){case"boolean":if(Js(e,Ys))return new Qs(Ys,t?"true":"false");if(!qs(e,Xs))throw new Error(`got a boolean, but expected ${$s(e)}`);return new Qs(Xs,t);case"number":if(Js(e,Zs))return new Qs(Zs,us(t));if(Js(e,Xs))return new Qs(Xs,!!t);if(Js(e,Ys))return new Qs(Ys,t.toString());if(!qs(e,zs))throw new Error(`got a number, but expected ${$s(e)}`);return new Qs(zs,t);case"string":if(Js(e,Ns))return new Qs(Ns,Xn(t));if(Js(e,Xs))return new Qs(Xs,!!t);if(!qs(e,Ys))throw new Error(`got a string, but expected ${$s(e)}`);return new Qs(Ys,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 n=t[0],r=Ho[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(t,e,i)}(t,e,i);for(const e of t)if("number"!=typeof e)throw new Error("expected an array of numbers");if(Js(e,Zs)){if(2!==t.length)throw new Error(`expected an array of two values for a size, got ${t.length}`);return new Qs(Zs,t)}if(Js(e,Ns)){if(3===t.length)return new Qs(Ns,[...t,1]);if(4===t.length)return new Qs(Ns,t);throw new Error(`expected an array of 3 or 4 values for a color, got ${t.length}`)}if(!qs(e,Bs))throw new Error(`got an array of numbers, but expected ${$s(e)}`);return new Qs(Bs,t)}const no="get",ro="var",so="concat",oo="geometry-type",ao="line-metric",lo="any",ho="all",co="!",uo="resolution",fo="zoom",go="time",po="==",_o="!=",mo=">",yo=">=",xo="<",vo="<=",So="*",wo="/",Co="+",bo="-",Ro="clamp",To="%",Eo="^",Io="abs",Mo="floor",Po="ceil",Fo="round",Oo="sin",ko="cos",Ao="atan",Lo="sqrt",Do="match",jo="between",Go="interpolate",Wo="coalesce",Xo="case",zo="in",Yo="number",No="string",Bo="array",Zo="color",Vo="id",Uo="band",Ko="palette",$o="to-string",qo="has",Ho={[no]:oa(ea(1,1/0),Jo),[ro]:function(t,e,i){const n=t[1];if("string"!=typeof n)throw new Error("expected a string argument for var operation");let r=e;const s=i.inputVariables?.[n];if(void 0!==s){const t=io(s,Vs,i);if(!(t instanceof Qs))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let o=t.type;if("string"==typeof s&&Hs(r,Ns)&&!Hs(r,Ys)?o=Ns:Array.isArray(s)&&2===s.length&&Hs(r,Zs)&&!Hs(r,Bs)&&(o=Zs),r&=o,0===r)throw new Error(`the type expected from the var operator (${$s(e)}) did not have any overlap with the type of the corresponding style variables (${$s(o)}), variable name: ${n}`)}if(i.variables.has(n)){const t=i.variables.get(n);if(r&=t,0===r)throw new Error(`a new type expected from the var operator (${$s(e)}) did not have any overlap with the previous type expected for it (${$s(t)}), variable name: ${n}`)}return i.variables.set(n,r),new to(r,"var",new Qs(Ys,n))},[qo]:oa(ea(1,1/0),Jo),[Vo]:oa(function(t,e,i){i.featureId=!0},ta),[so]:oa(ea(2,1/0),na(Ys)),[oo]:oa(function(t,e,i){i.geometryType=!0},ta),[ao]:oa(function(t,e,i){i.mCoordinate=!0},ta),[uo]:oa(Qo,ta),[fo]:oa(Qo,ta),[go]:oa(Qo,ta),[lo]:oa(ea(2,1/0),na(Xs)),[ho]:oa(ea(2,1/0),na(Xs)),[co]:oa(ea(1,1),na(Xs)),[po]:oa(ea(2,2),ra()),[_o]:oa(ea(2,2),ra()),[mo]:oa(ea(2,2),na(zs)),[yo]:oa(ea(2,2),na(zs)),[xo]:oa(ea(2,2),na(zs)),[vo]:oa(ea(2,2),na(zs)),[So]:oa(ea(2,1/0),ia),[Wo]:oa(ea(2,1/0),ia),[wo]:oa(ea(2,2),na(zs)),[Co]:oa(ea(2,1/0),na(zs)),[bo]:oa(ea(2,2),na(zs)),[Ro]:oa(ea(3,3),na(zs)),[To]:oa(ea(2,2),na(zs)),[Eo]:oa(ea(2,2),na(zs)),[Io]:oa(ea(1,1),na(zs)),[Mo]:oa(ea(1,1),na(zs)),[Po]:oa(ea(1,1),na(zs)),[Fo]:oa(ea(1,1),na(zs)),[Oo]:oa(ea(1,1),na(zs)),[ko]:oa(ea(1,1),na(zs)),[Ao]:oa(ea(1,2),na(zs)),[Lo]:oa(ea(1,1),na(zs)),[Do]:oa(ea(4,1/0),sa,function(t,e,i){const n=t.length-1,r=io(t[t.length-1],e,i);let s=Ys|zs|Xs;const o=new Array(n-2);for(let e=0;e<n-2;e+=2){try{s&=io(t[e+2],s,i).type}catch(t){throw new Error(`failed to parse argument ${e+1} of match expression: ${t.message}`)}if(0===s)throw new Error("no common type was found among the arguments of match expression")}for(let e=0;e<n-2;e+=2){try{const n=io(t[e+2],s,i);o[e]=n}catch(t){throw new Error(`failed to parse argument ${e+1} of match expression: ${t.message}`)}try{const n=io(t[e+3],r.type,i);o[e+1]=n}catch(t){throw new Error(`failed to parse argument ${e+2} of match expression: ${t.message}`)}}return[io(t[1],s,i),...o,r]}),[jo]:oa(ea(3,3),na(zs)),[Go]:oa(ea(6,1/0),sa,function(t,e,i){const n=t[1];let r;switch(n[0]){case"linear":r=1;break;case"exponential":const t=n[1];if("number"!=typeof t||t<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(t)} instead`);r=t;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}const s=new Qs(zs,r);let o;try{o=io(t[2],zs,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 n=0;n<a.length;n+=2){try{const e=io(t[n+3],zs,i);a[n]=e}catch(t){throw new Error(`failed to parse argument ${n+2} for interpolate expression: ${t.message}`)}try{const r=io(t[n+4],e,i);a[n+1]=r}catch(t){throw new Error(`failed to parse argument ${n+3} for interpolate expression: ${t.message}`)}}return[s,o,...a]}),[Xo]:oa(ea(3,1/0),function(t,e,i){const n=t[0],r=t.length-1;if(r%2==0)throw new Error(`expected an odd number of arguments for ${n}, got ${r} instead`)},function(t,e,i){const n=io(t[t.length-1],e,i),r=new Array(t.length-1);for(let e=0;e<r.length-1;e+=2){try{const n=io(t[e+1],Xs,i);r[e]=n}catch(t){throw new Error(`failed to parse argument ${e} of case expression: ${t.message}`)}try{const s=io(t[e+2],n.type,i);r[e+1]=s}catch(t){throw new Error(`failed to parse argument ${e+1} of case expression: ${t.message}`)}}return r[r.length-1]=n,r}),[zo]:oa(ea(2,2),function(t,e,i){let n,r=t[2];if(!Array.isArray(r))throw new Error('the second argument for the "in" operator must be an array');if("literal"===r[0]){if(r=r[1],!Array.isArray(r))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if("string"==typeof r[0])throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');n="string"==typeof r[0]?Ys:zs;const s=new Array(r.length);for(let t=0;t<s.length;t++)try{const e=io(r[t],n,i);s[t]=e}catch(e){throw new Error(`failed to parse haystack item ${t} for "in" expression: ${e.message}`)}return[io(t[1],n,i),...s]}),[Yo]:oa(ea(1,1/0),na(Vs)),[No]:oa(ea(1,1/0),na(Vs)),[Bo]:oa(ea(1,1/0),na(zs)),[Zo]:oa(ea(1,4),na(zs)),[Uo]:oa(ea(1,3),na(zs)),[Ko]:oa(ea(2,2),function(t,e,i){let n;try{n=io(t[1],zs,i)}catch(t){throw new Error(`failed to parse first argument in palette expression: ${t.message}`)}const r=t[2];if(!Array.isArray(r))throw new Error("the second argument of palette must be an array");const s=new Array(r.length);for(let t=0;t<s.length;t++){let e;try{e=io(r[t],Ns,i)}catch(e){throw new Error(`failed to parse color at index ${t} in palette expression: ${e.message}`)}if(!(e instanceof Qs))throw new Error(`the palette color at index ${t} must be a literal value`);s[t]=e}return[n,...s]}),[$o]:oa(ea(1,1),na(Xs|zs|Ys|Ns))};function Jo(t,e,i){const n=t.length-1,r=new Array(n);for(let s=0;s<n;++s){const n=t[s+1];switch(typeof n){case"number":r[s]=new Qs(zs,n);break;case"string":r[s]=new Qs(Ys,n);break;default:throw new Error(`expected a string key or numeric array index for a get operation, got ${n}`)}0===s&&i.properties.set(String(n),e)}return r}function Qo(t,e,i){i.mapState=!0}function ta(t,e,i){const n=t[0];if(1!==t.length)throw new Error(`expected no arguments for ${n} operation`);return[]}function ea(t,e){return function(i,n,r){const s=i[0],o=i.length-1;if(t===e){if(o!==t)throw new Error(`expected ${t} argument${1===t?"":"s"} for ${s}, got ${o}`)}else if(o<t||o>e)throw new Error(`expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${s}, got ${o}`)}}function ia(t,e,i){const n=t.length-1,r=new Array(n);for(let s=0;s<n;++s){const n=io(t[s+1],e,i);r[s]=n}return r}function na(t){return function(e,i,n){const r=e.length-1,s=new Array(r);for(let i=0;i<r;++i){const r=io(e[i+1],t,n);s[i]=r}return s}}function ra(){return function(t,e,i){const n=t[0],r=t.length-1,s=new Array(r);let o=Vs;for(let e=0;e<r;++e)o&=io(t[e+1],o,i).type;if(0===o)throw new Error(`no common type was found among the arguments of ${n}`);for(let e=0;e<r;++e){const n=io(t[e+1],o,i);s[e]=n}return s}}function sa(t,e,i){const n=t[0],r=t.length-1;if(r%2==1)throw new Error(`expected an even number of arguments for operation ${n}, got ${r} instead`)}function oa(...t){return function(e,i,n){const r=e[0];let s;for(let r=0;r<t.length;r++){const o=t[r](e,i,n);if(r==t.length-1){if(!o)throw new Error("expected last argument validator to return the parsed args");s=o}}return new to(i,r,...s)}}function aa(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 aa(t.getGeometries()[0]);default:return""}}function la(t,e,i){return ha(io(t,e,i),i)}function ha(t,e){if(t instanceof Qs){if(t.type===Ns&&"string"==typeof t.value){const e=Xn(t.value);return function(){return e}}return function(){return t.value}}const i=t.operator;switch(i){case Yo:case No:case Wo:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=ha(t.args[i],e);switch(i){case Wo:return t=>{for(let e=0;e<n;++e){const i=r[e](t);if(null!=i)return i}throw new Error("Expected one of the values to be non-null")};case Yo:case No:return t=>{for(let e=0;e<n;++e){const n=r[e](t);if(typeof n===i)return n}throw new Error(`Expected one of the values to be a ${i}`)};default:throw new Error(`Unsupported assertion operator ${i}`)}}(t,e);case no:case ro:case qo:return function(t){const e=t.args[0].value;switch(t.operator){case no:return i=>{const n=t.args;let r=i.properties[e];for(let t=1,e=n.length;t<e;++t)r=r[n[t].value];return r};case ro:return t=>t.variables[e];case qo:return i=>{const n=t.args;if(!(e in i.properties))return!1;let r=i.properties[e];for(let t=1,e=n.length;t<e;++t){const e=n[t].value;if(!r||!Object.hasOwn(r,e))return!1;r=r[e]}return!0};default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}(t);case"id":return t=>t.featureId;case oo:return t=>t.geometryType;case so:{const i=t.args.map(t=>ha(t,e));return t=>"".concat(...i.map(e=>e(t).toString()))}case uo:return t=>t.resolution;case lo:case ho:case jo:case zo:case"!":return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=ha(t.args[i],e);switch(i){case lo:return t=>{for(let e=0;e<n;++e)if(r[e](t))return!0;return!1};case ho:return t=>{for(let e=0;e<n;++e)if(!r[e](t))return!1;return!0};case jo:return t=>{const e=r[0](t),i=r[1](t),n=r[2](t);return e>=i&&e<=n};case zo:return t=>{const e=r[0](t);for(let i=1;i<n;++i)if(e===r[i](t))return!0;return!1};case"!":return t=>!r[0](t);default:throw new Error(`Unsupported logical operator ${i}`)}}(t,e);case po:case _o:case"<":case vo:case">":case yo:return function(t,e){const i=t.operator,n=ha(t.args[0],e),r=ha(t.args[1],e);switch(i){case po:return t=>n(t)===r(t);case _o:return t=>n(t)!==r(t);case"<":return t=>n(t)<r(t);case vo:return t=>n(t)<=r(t);case">":return t=>n(t)>r(t);case yo:return t=>n(t)>=r(t);default:throw new Error(`Unsupported comparison operator ${i}`)}}(t,e);case"*":case"/":case"+":case"-":case Ro:case"%":case"^":case Io:case Mo:case Po:case Fo:case Oo:case ko:case Ao:case Lo:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=ha(t.args[i],e);switch(i){case"*":return t=>{let e=1;for(let i=0;i<n;++i)e*=r[i](t);return e};case"/":return t=>r[0](t)/r[1](t);case"+":return t=>{let e=0;for(let i=0;i<n;++i)e+=r[i](t);return e};case"-":return t=>r[0](t)-r[1](t);case Ro:return t=>{const e=r[0](t),i=r[1](t);if(e<i)return i;const n=r[2](t);return e>n?n:e};case"%":return t=>r[0](t)%r[1](t);case"^":return t=>Math.pow(r[0](t),r[1](t));case Io:return t=>Math.abs(r[0](t));case Mo:return t=>Math.floor(r[0](t));case Po:return t=>Math.ceil(r[0](t));case Fo:return t=>Math.round(r[0](t));case Oo:return t=>Math.sin(r[0](t));case ko:return t=>Math.cos(r[0](t));case Ao:return 2===n?t=>Math.atan2(r[0](t),r[1](t)):t=>Math.atan(r[0](t));case Lo:return t=>Math.sqrt(r[0](t));default:throw new Error(`Unsupported numeric operator ${i}`)}}(t,e);case Xo:return function(t,e){const i=t.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=ha(t.args[r],e);return t=>{for(let e=0;e<i-1;e+=2)if(n[e](t))return n[e+1](t);return n[i-1](t)}}(t,e);case Do:return function(t,e){const i=t.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=ha(t.args[r],e);return t=>{const e=n[0](t);for(let r=1;r<i-1;r+=2)if(e===n[r](t))return n[r+1](t);return n[i-1](t)}}(t,e);case Go:return function(t,e){const i=t.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=ha(t.args[r],e);return t=>{const e=n[0](t),r=n[1](t);let s,o;for(let a=2;a<i;a+=2){const i=n[a](t);let l=n[a+1](t);const h=Array.isArray(l);if(h&&(l=An(l)),i>=r)return 2===a?l:h?ua(e,r,s,o,i,l):ca(e,r,s,o,i,l);s=i,o=l}return o}}(t,e);case $o:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=ha(t.args[i],e);if(i===$o)return e=>{const i=r[0](e);return t.args[0].type===Ns?Yn(i):i.toString()};throw new Error(`Unsupported convert operator ${i}`)}(t,e);default:throw new Error(`Unsupported operator ${i}`)}}function ca(t,e,i,n,r,s){const o=r-i;if(0===o)return n;const a=e-i;return n+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(s-n)}function ua(t,e,i,n,r,s){if(0===r-i)return n;const o=Wn(n),a=Wn(s);let l=a[2]-o[2];return l>180?l-=360:l<-180&&(l+=360),function(t){const e=(t[0]+16)/116,i=t[1],n=t[2]*Math.PI/180,r=Dn(e),s=Dn(e+i/500*Math.cos(n)),o=Dn(e-i/200*Math.sin(n)),a=Ln(3.021973625*s-1.617392459*r-.404875592*o),l=Ln(-.943766287*s+1.916279586*r+.027607165*o),h=Ln(.069407491*s-.22898585*r+1.159737864*o);return[Ft(a+.5|0,0,255),Ft(l+.5|0,0,255),Ft(h+.5|0,0,255),t[3]]}([ca(t,e,i,o[0],r,a[0]),ca(t,e,i,o[1],r,a[1]),o[2]+ca(t,e,i,0,r,l),ca(t,e,i,n[3],r,s[3])])}class da extends fs{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()?1:2,1===this.imageState_&&this.ready().then(()=>this.imageState_=2),this.render()}clone(){const t=this.getScale(),e=new da({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 n=Bn.get(i,null)?.getImage(1);if(!n){const e=this.renderOptions_,r=Math.ceil(e.size*t),s=_n(r,r);this.draw_(e,s,t),n=s.canvas;const o=new Kn(n,void 0,null,2,null);Bn.set(i,null,o),createImageBitmap(n).then(t=>{o.setImage(t)})}return n}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 n=this.radius,r=void 0===this.radius2_?n:this.radius2_;if(n<r){const t=n;n=r,r=t}const s=void 0===this.radius2_?this.points_:2*this.points_,o=2*Math.PI/s,a=r*Math.sin(o),l=n-Math.sqrt(r*r-a*a),h=Math.sqrt(a*a+l*l),c=h/a;if("miter"===t&&c<=i)return c*e;const u=e/2/c,d=e/2*(l/h),f=Math.sqrt((n+u)*(n+u)+d*d)-n;if(void 0===this.radius2_||"bevel"===t)return 2*f;const g=n*Math.sin(o),p=r-Math.sqrt(n*n-g*g),_=Math.sqrt(g*g+p*p)/g;if(_<=i){const t=_*e/2-r-n;return 2*Math.max(f,t)}return 2*f}createRenderOptions(){let t,e=or,i=lr,n=0,r=null,s=0,o=0;this.stroke_&&(t=$n(this.stroke_.getColor()??hr),o=this.stroke_.getWidth()??1,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,i=this.stroke_.getLineJoin()??lr,e=this.stroke_.getLineCap()??or,n=this.stroke_.getMiterLimit()??10);const a=this.calculateLineJoinSize_(i,o,n),l=Math.max(this.radius,this.radius2_||0);return{strokeStyle:t,strokeWidth:o,size:Math.ceil(2*l+a),lineCap:e,lineDash:r,lineDashOffset:s,lineJoin:i,miterLimit:n}}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=sr),e.fillStyle=$n(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(),n=0;"string"==typeof i&&(i=zn(i)),null===i?n=1:Array.isArray(i)&&(n=4===i.length?i[3]:1),0===n&&(e=_n(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 n=void 0===this.radius2_?i:this.radius2_;void 0!==this.radius2_&&(e*=2);const r=this.angle_-Math.PI/2,s=2*Math.PI/e;for(let o=0;o<e;o++){const e=r+o*s,a=o%2==0?i:n;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=sr,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()}}var fa=da;class ga extends fa{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 ga({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}}var pa=ga;class _a{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 _a({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=Un(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}),0===e.getImageState()&&e.load(),1===e.getImageState()&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?X(t):"object"==typeof t&&"src"in t?t.src+":"+t.offset:zn(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}var ma=_a;class ya{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 ya({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}}var xa=ya;class va{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=Ca,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 va({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_=Ca,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let Sa=null;function wa(t,e){if(!Sa){const t=new ma({color:"rgba(255,255,255,0.4)"}),e=new xa({color:"#3399CC",width:1.25});Sa=[new va({image:new pa({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return Sa}function Ca(t){return t.getGeometry()}var ba=va;class Ra{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_=us(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 ma({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 Ra({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 ma?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_=us(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}}var Ta=Ra;function Ea(t){return!0}function Ia(t,e){e=e??eo();const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=Ma(t[r],e);const r={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""},s=new Array(i);return function(t,o){if(r.properties=t.getPropertiesInternal(),r.resolution=o,e.featureId){const e=t.getId();r.featureId=void 0!==e?e:null}e.geometryType&&(r.geometryType=aa(t.getGeometry()));let a=0;for(let t=0;t<i;++t){const e=n[t](r);e&&(s[a]=e,a+=1)}return s.length=a,s}}function Ma(t,e){const i=Pa(t,"",e),n=Fa(t,"",e),r=function(t,e){const i="text-",n=Aa(t,i+"value",e);if(!n)return null;const r=Pa(t,i,e),s=Pa(t,i+"background-",e),o=Fa(t,i,e),a=Fa(t,i+"background-",e),l=Aa(t,i+"font",e),h=ka(t,i+"max-angle",e),c=ka(t,i+"offset-x",e),u=ka(t,i+"offset-y",e),d=La(t,i+"overflow",e),f=Aa(t,i+"placement",e),g=ka(t,i+"repeat",e),p=Xa(t,i+"scale",e),_=La(t,i+"rotate-with-view",e),m=ka(t,i+"rotation",e),y=Aa(t,i+"align",e),x=Aa(t,i+"justify",e),v=Aa(t,i+"baseline",e),S=La(t,i+"keep-upright",e),w=ja(t,i+"padding",e),C=Ba(t,i+"declutter-mode"),b=new Ta({declutterMode:C});return function(t){if(b.setText(n(t)),r&&b.setFill(r(t)),s&&b.setBackgroundFill(s(t)),o&&b.setStroke(o(t)),a&&b.setBackgroundStroke(a(t)),l&&b.setFont(l(t)),h&&b.setMaxAngle(h(t)),c&&b.setOffsetX(c(t)),u&&b.setOffsetY(u(t)),d&&b.setOverflow(d(t)),f){const e=f(t);if("point"!==e&&"line"!==e)throw new Error("Expected point or line for text-placement");b.setPlacement(e)}if(g&&b.setRepeat(g(t)),p&&b.setScale(p(t)),_&&b.setRotateWithView(_(t)),m&&b.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");b.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");b.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");b.setTextBaseline(e)}return w&&b.setPadding(w(t)),S&&b.setKeepUpright(S(t)),b}}(t,e),s=function(t,e){return"icon-src"in t?function(t,e){const i="icon-",n=i+"src",r=Va(t[n],n),s=Ga(t,i+"anchor",e),o=Xa(t,i+"scale",e),a=ka(t,i+"opacity",e),l=Ga(t,i+"displacement",e),h=ka(t,i+"rotation",e),c=La(t,i+"rotate-with-view",e),u=Ya(t,i+"anchor-origin"),d=Na(t,i+"anchor-x-units"),f=Na(t,i+"anchor-y-units"),g=Oa(t,i+"color");let p,_=null;void 0!==g&&(Array.isArray(g)&&g.length>0&&"string"==typeof g[0]?_=Da(t,i+"color",e):p=Ka(g,i+"color"));const m=function(t,e){const i=t[e];if(void 0!==i){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 Za(i,e)}(t,i+"offset"),x=Ya(t,i+"offset-origin"),v=za(t,i+"width"),S=za(t,i+"height"),w=function(t,e){const i=t[e];if(void 0!==i){if("number"==typeof i)return us(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"),C={src:r,anchorOrigin:u,anchorXUnits:d,anchorYUnits:f,crossOrigin:m,offset:y,offsetOrigin:x,height:S,width:v,size:w,declutterMode:Ba(t,i+"declutter-mode")};let b=null;return function(t){if(b)_&&b.setColor(_(t));else{const e=_?_(t):p;b=new _s(void 0!==e?Object.assign({},C,{color:e}):Object.assign({},C))}return a&&b.setOpacity(a(t)),l&&b.setDisplacement(l(t)),h&&b.setRotation(h(t)),c&&b.setRotateWithView(c(t)),o&&b.setScale(o(t)),s&&b.setAnchor(s(t)),b}}(t,e):"shape-points"in t?function(t,e){const i="shape-",n=i+"points",r=i+"radius",s=Ua(t[n],n);if(!(r in t))throw new Error(`Expected a number for ${r}`);const o=ka(t,r,e),a="number"==typeof t[r]?t[r]:5,l=i+"radius2",h=ka(t,l,e),c="number"==typeof t[l]?t[l]:void 0,u=Pa(t,i,e),d=Fa(t,i,e),f=Xa(t,i+"scale",e),g=Ga(t,i+"displacement",e),p=ka(t,i+"rotation",e),_=La(t,i+"rotate-with-view",e),m=za(t,i+"angle"),y=Ba(t,i+"declutter-mode"),x=new fa({points:s,radius:a,radius2:c,angle:m,declutterMode:y});return function(t){return o&&x.setRadius(o(t)),h&&x.setRadius2(h(t)),u&&x.setFill(u(t)),d&&x.setStroke(d(t)),g&&x.setDisplacement(g(t)),p&&x.setRotation(p(t)),_&&x.setRotateWithView(_(t)),f&&x.setScale(f(t)),x}}(t,e):"circle-radius"in t?function(t,e){const i="circle-",n=Pa(t,i,e),r=Fa(t,i,e),s=ka(t,i+"radius",e),o=Xa(t,i+"scale",e),a=Ga(t,i+"displacement",e),l=ka(t,i+"rotation",e),h=La(t,i+"rotate-with-view",e),c=Ba(t,i+"declutter-mode"),u=new pa({radius:5,declutterMode:c});return function(t){return s&&u.setRadius(s(t)),n&&u.setFill(n(t)),r&&u.setStroke(r(t)),a&&u.setDisplacement(a(t)),l&&u.setRotation(l(t)),h&&u.setRotateWithView(h(t)),o&&u.setScale(o(t)),u}}(t,e):null}(t,e),o=ka(t,"z-index",e);if(!(i||n||r||s||x(t)))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(t));const a=new ba;return function(t){let e=!0;if(i){const n=i(t);n&&(e=!1),a.setFill(n)}if(n){const i=n(t);i&&(e=!1),a.setStroke(i)}if(r){const i=r(t);i&&(e=!1),a.setText(i)}if(s){const i=s(t);i&&(e=!1),a.setImage(i)}return o&&a.setZIndex(o(t)),e?null:a}}function Pa(t,e,i){let n;if(e+"fill-pattern-src"in t)n=function(t,e,i){const n=Aa(t,e+"pattern-src",i),r=Wa(t,e+"pattern-offset",i),s=Wa(t,e+"pattern-size",i),o=Da(t,e+"color",i);return function(t){return{src:n(t),offset:r&&r(t),size:s&&s(t),color:o&&o(t)}}}(t,e+"fill-",i);else{if("none"===t[e+"fill-color"])return t=>null;n=Da(t,e+"fill-color",i)}if(!n)return null;const r=new ma;return function(t){const e=n(t);return e===Cn?null:(r.setColor(e),r)}}function Fa(t,e,i){const n=ka(t,e+"stroke-width",i),r=Da(t,e+"stroke-color",i);if(!n&&!r)return null;const s=Aa(t,e+"stroke-line-cap",i),o=Aa(t,e+"stroke-line-join",i),a=ja(t,e+"stroke-line-dash",i),l=ka(t,e+"stroke-line-dash-offset",i),h=ka(t,e+"stroke-miter-limit",i),c=ka(t,e+"stroke-offset",i),u=new xa;return function(t){if(r){const e=r(t);if(e===Cn)return null;u.setColor(e)}if(n&&u.setWidth(n(t)),s){const e=s(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)),l&&u.setLineDashOffset(l(t)),h&&u.setMiterLimit(h(t)),c&&u.setOffset(c(t)),u}}function Oa(t,e){if(!(e in t))return;const i=t[e];return void 0===i?void 0:i}function ka(t,e,i){const n=Oa(t,e);if(void 0===n)return;const r=la(n,zs,i);return function(t){return Ua(r(t),e)}}function Aa(t,e,i){const n=Oa(t,e);if(void 0===n)return null;const r=la(n,Ys,i);return function(t){return Va(r(t),e)}}function La(t,e,i){const n=Oa(t,e);if(void 0===n)return null;const r=la(n,Xs,i);return function(t){const i=r(t);if("boolean"!=typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function Da(t,e,i){const n=Oa(t,e);if(void 0===n)return null;const r=la(n,Ns,i);return function(t){return Ka(r(t),e)}}function ja(t,e,i){const n=Oa(t,e);if(void 0===n)return null;if(Array.isArray(n)&&(0===n.length||"string"!=typeof n[0])){const t=n.map((t,n)=>{if("number"==typeof t)return()=>t;const r=la(t,zs,i);return function(t){return Ua(r(t),`${e}[${n}]`)}});return function(e){const i=new Array(t.length);for(let n=0;n<t.length;++n)i[n]=t[n](e);return i}}const r=la(n,Bs,i);return function(t){return Za(r(t),e)}}function Ga(t,e,i){const n=Oa(t,e);if(void 0===n)return null;const r=la(n,Bs,i);return function(t){const i=Za(r(t),e);if(2!==i.length)throw new Error(`Expected two numbers for ${e}`);return i}}function Wa(t,e,i){const n=Oa(t,e);if(void 0===n)return null;const r=la(n,Bs,i);return function(t){return $a(r(t),e)}}function Xa(t,e,i){const n=Oa(t,e);if(void 0===n)return null;const r=la(n,Bs|zs,i);return function(t){return i=r(t),n=e,"number"==typeof i?i:$a(i,n);var i,n}}function za(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 Ya(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 Na(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 Ba(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 Za(t,e){if(!Array.isArray(t))throw new Error(`Expected an array for ${e}`);const i=t.length;for(let n=0;n<i;++n)if("number"!=typeof t[n])throw new Error(`Expected an array of numbers for ${e}`);return t}function Va(t,e){if("string"!=typeof t)throw new Error(`Expected a string for ${e}`);return t}function Ua(t,e){if("number"!=typeof t)throw new Error(`Expected a number for ${e}`);return t}function Ka(t,e){if("string"==typeof t)return t;const i=Za(t,e),n=i.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function $a(t,e){const i=Za(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}var qa={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function Ha(t,e,i){return function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;const l=e?0:s[0]*r,h=e?0:s[1]*r,c=a?a[0]:0,u=a?a[1]:0;let d=t[0]+l/2+c,f=t[2]-l/2+c,g=t[1]+h/2+u,p=t[3]-h/2+u;d>f&&(d=(f+d)/2,f=d),g>p&&(g=(p+g)/2,p=g);let _=Ft(n[0],d,f),m=Ft(n[1],g,p);if(o&&i&&r){const t=30*r;_+=-t*Math.log(1+Math.max(0,d-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-f)/t),m+=-t*Math.log(1+Math.max(0,g-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-p)/t)}return[_,m]}}function Ja(t){return t}function Qa(t){return Math.pow(t,3)}function tl(t){return 1-Qa(1-t)}function el(t){return 3*t*t-2*t*t*t}function il(t,e,i,n){let r=0;const s=t[i-n],o=t[i-n+1];let a=0,l=0;for(;e<i;e+=n){const i=t[e]-s,n=t[e+1]-o;r+=l*i-a*n,a=i,l=n}return r/2}function nl(t,e,i,n){let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s];r+=il(t,e,o,n),e=o}return r}function rl(t,e,i,n,r,s,o){const a=t[e],l=t[e+1],h=t[i]-a,c=t[i+1]-l;let u;if(0===h&&0===c)u=e;else{const d=((r-a)*h+(s-l)*c)/(h*h+c*c);if(d>1)u=i;else{if(d>0){for(let r=0;r<n;++r)o[r]=jt(t[e+r],t[i+r],d);return void(o.length=n)}u=e}}for(let e=0;e<n;++e)o[e]=t[u+e];o.length=n}function sl(t,e,i,n,r){let s=t[e],o=t[e+1];for(e+=n;e<i;e+=n){const i=t[e],n=t[e+1],a=kt(s,o,i,n);a>r&&(r=a),s=i,o=n}return r}function ol(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];r=sl(t,e,o,n,r),e=o}return r}function al(t,e,i,n,r,s,o,a,l,h,c){if(e==i)return h;let u,d;if(0===r){if(d=kt(o,a,t[e],t[e+1]),d<h){for(u=0;u<n;++u)l[u]=t[e+u];return l.length=n,d}return h}c=c||[NaN,NaN];let f=e+n;for(;f<i;)if(rl(t,f-n,f,n,o,a,c),d=kt(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<n;++u)l[u]=c[u];l.length=n,f+=n}else f+=n*Math.max((Math.sqrt(d)-Math.sqrt(h))/r|0,1);if(s&&(rl(t,i-n,e,n,o,a,c),d=kt(o,a,c[0],c[1]),d<h)){for(h=d,u=0;u<n;++u)l[u]=c[u];l.length=n}return h}function ll(t,e,i,n,r,s,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=i.length;u<d;++u){const d=i[u];h=al(t,e,d,n,r,s,o,a,l,h,c),e=d}return h}function hl(t,e,i,n){for(let r=0,s=i.length;r<s;++r){const s=i[r];for(let i=0;i<n;++i)t[e++]=s[i]}return e}function cl(t,e,i,n,r){r=r||[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=hl(t,e,i[o],n);r[s++]=a,e=a}return r.length=s,r}function ul(t,e,i,n,r){r=r||[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=cl(t,e,i[o],n,r[s]);0===a.length&&(a[0]=e),r[s++]=a,e=a[a.length-1]}return r.length=s,r}function dl(t,e,i,n,r){let s;for(e+=n;e<i;e+=n)if(s=r(t.slice(e-n,e),t.slice(e,e+n)),s)return s;return!1}function fl(t,e,i,n,r,s){return s=s??at([1/0,1/0,-1/0,-1/0],t,e,i,n),!!wt(r,s)&&(s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]||dl(t,e,i,n,function(t,e){return function(t,e,i){let n=!1;const r=Q(t,e),s=Q(t,i);if(1===r||1===s)n=!0;else{const o=t[0],a=t[1],l=t[2],h=t[3],c=e[0],u=e[1],d=i[0],f=i[1],g=(f-u)/(d-c);let p,_;2&s&&!(2&r)&&(p=d-(f-h)/g,n=p>=o&&p<=l),n||!(4&s)||4&r||(_=f-(d-l)*g,n=_>=a&&_<=h),n||!(8&s)||8&r||(p=d-(f-a)/g,n=p>=o&&p<=l),n||!(16&s)||16&r||(_=f-(d-o)*g,n=_>=a&&_<=h)}return n}(r,t,e)}))}function gl(t,e,i,n,r){return!!(fl(t,e,i,n,r)||ai(t,e,i,n,r[0],r[1])||ai(t,e,i,n,r[0],r[3])||ai(t,e,i,n,r[2],r[1])||ai(t,e,i,n,r[2],r[3]))}function pl(t,e,i,n,r){if(!gl(t,e,i[0],n,r))return!1;if(1===i.length)return!0;for(let e=1,s=i.length;e<s;++e)if(oi(t,i[e-1],i[e],n,r)&&!fl(t,i[e-1],i[e],n,r))return!1;return!0}class _l extends ws{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 _l(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<$(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(sl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),al(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return il(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return qn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=vi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new _l(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return fl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=hl(this.flatCoordinates,0,t,this.stride),this.changed()}}var ml=_l;class yl extends ws{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new yl(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const r=this.flatCoordinates,s=kt(t,e,r[0],r[1]);if(s<n){const t=this.stride;for(let e=0;e<t;++e)i[e]=r[e];return i.length=t,s}return n}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return it(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return J(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 n=0,r=i.length;n<r;++n)t[e++]=i[n];return e}(this.flatCoordinates,0,t,this.stride),this.changed()}}var xl=yl;class vl extends ws{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?M(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new vl(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<$(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ol(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ll(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return li(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return nl(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),mi(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,Hn(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=ft(this.getExtent());this.flatInteriorPoint_=hi(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new xl(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new ml(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,n=[];let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=new ml(e.slice(r,o),t);n.push(a),r=o}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;pi(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=mi(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=bi(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new vl(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return pl(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=cl(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}var Sl=vl;function wl(t){if(Ct(t))throw new Error("Cannot create polygon from empty extent");const e=t[0],i=t[1],n=t[2],r=t[3],s=[e,i,e,r,n,r,n,i,e,i];return new vl(s,"XY",[s.length])}function Cl(t,e,i,n){const r=St(e)/i[0],s=_t(e)/i[1];return n?Math.min(t,Math.max(r,s)):Math.min(t,Math.min(r,s))}function bl(t,e,i){let n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(n=Math.max(n,i),n/=Math.log(1+50*Math.max(0,i/t-1))/50+1),Ft(n,i/2,2*e)}function Rl(t,e,i,n,r){return i=void 0===i||i,function(s,o,a,l){if(void 0!==s){const o=n?Cl(t,n,a,r):t;return i&&l?bl(s,o,e):Ft(s,e,o)}}}function Tl(t){if(void 0!==t)return 0}function El(t){if(void 0!==t)return t}function Il(t,e){setTimeout(function(){t(e)},0)}function Ml(t){return!(t.sourceCenter&&t.targetCenter&&!Yt(t.sourceCenter,t.targetCenter))&&t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation}function Pl(t,e,i,n,r){const s=Math.cos(-r);let o=Math.sin(-r),a=t[0]*s-t[1]*o,l=t[1]*s+t[0]*o;return a+=(e[0]/2-i[0])*n,l+=(i[1]-e[1]/2)*n,o=-o,[a*s-l*o,l*s+a*o]}var Fl=class extends Y{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=ze(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&&function(t){Le=!(void 0===t||t)}(),t.center&&(t.center=He(t.center,this.projection_)),t.extent&&(t.extent=Qe(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const t in qa)delete e[t];this.setProperties(e,!0);const i=function(t){let e,i,n;let r=void 0!==t.minZoom?t.minZoom:0,s=void 0!==t.maxZoom?t.maxZoom:28;const o=void 0!==t.zoomFactor?t.zoomFactor:2,a=void 0!==t.multiWorld&&t.multiWorld,l=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,h=void 0!==t.showFullExtent&&t.showFullExtent,c=ze(t.projection,"EPSG:3857"),u=c.getExtent();let d=t.constrainOnlyCenter,f=t.extent;if(a||f||!c.isGlobal()||(d=!1,f=u),void 0!==t.resolutions){const o=t.resolutions;i=o[r],n=void 0!==o[s]?o[s]:o[o.length-1],e=t.constrainResolution?function(t,e,i,n){return e=void 0===e||e,function(r,s,o,a){if(void 0!==r){const l=t[0],h=t[t.length-1],c=i?Cl(l,i,o,n):l;if(a)return e?bl(r,c,h):Ft(r,h,c);const u=Math.min(c,r),d=Math.floor(E(t,u,s));return t[d]>c&&d<t.length-1?t[d+1]:t[d]}}}(o,l,!d&&f,h):Rl(i,n,l,!d&&f,h)}else{const a=(u?Math.max(St(u),_t(u)):360*Bt.degrees/c.getMetersPerUnit())/256/Math.pow(2,0),g=a/Math.pow(2,28);i=t.maxResolution,void 0!==i?r=0:i=a/Math.pow(o,r),n=t.minResolution,void 0===n&&(n=void 0!==t.maxZoom?void 0!==t.maxResolution?i/Math.pow(o,s):a/Math.pow(o,s):g),s=r+Math.floor(Math.log(i/n)/Math.log(o)),n=i/Math.pow(o,s-r),e=t.constrainResolution?function(t,e,i,n,r,s){return n=void 0===n||n,i=void 0!==i?i:0,function(o,a,l,h){if(void 0!==o){const c=r?Cl(e,r,l,s):e;if(h)return n?bl(o,c,i):Ft(o,i,c);const u=1e-9,d=Math.ceil(Math.log(e/c)/Math.log(t)-u),f=-a*(.5-u)+.5,g=Math.min(c,o),p=Math.floor(Math.log(e/g)/Math.log(t)+f),_=Math.max(d,p);return Ft(e/Math.pow(t,_),i,c)}}}(o,i,n,l,!d&&f,h):Rl(i,n,l,!d&&f,h)}return{constraint:e,maxResolution:i,minResolution:n,minZoom:r,zoomFactor:o}}(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 n=function(t){if(void 0!==t.extent){const e=void 0===t.smoothExtentConstraint||t.smoothExtentConstraint;return Ha(t.extent,t.constrainOnlyCenter,e)}const e=ze(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,Ha(t,!1,!1)}return Ja}(t),r=i.constraint,s=function(t){if(void 0===t.enableRotation||t.enableRotation){const e=t.constrainRotation;return void 0===e||!0===e?function(){const t=Lt(5);return function(e,i){return i||void 0===e?e:Math.abs(e)<=t?0:e}}():!1===e?El:"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):El}return Tl}(t);this.constraints_={center:n,resolution:r,rotation:s},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 n=t||[0,0,0,0];e=e||[0,0,0,0];const r=this.getResolution(),s=r/2*(n[3]-e[3]+e[1]-n[1]),o=r/2*(n[0]-e[0]+e[2]-n[2]);this.setCenterInternal([i[0]+s,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=He(i.center,this.getProjection())),i.anchor&&(i=Object.assign({},i),i.anchor=He(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 n=0;for(;n<i&&!this.isDef();++n){const t=arguments[n];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(n===i)return void(e&&Il(e,!0));let r=Date.now(),s=this.targetCenter_.slice(),o=this.targetResolution_,a=this.targetRotation_;const l=[];for(;n<i;++n){const t=arguments[n],i={start:r,complete:!1,anchor:t.anchor,duration:void 0!==t.duration?t.duration:1e3,easing:t.easing||el,callback:e};if(t.center&&(i.sourceCenter=s,i.targetCenter=t.center.slice(),s=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=Dt(t.rotation-a+Math.PI,2*Math.PI)-Math.PI;i.targetRotation=a+e,a=i.targetRotation}Ml(i)?i.complete=!0:r+=i.duration,l.push(i)}this.animations_.push(l),this.setHint(0,1),this.updateAnimations_()}getAnimating(){return this.hints_[0]>0}getInteracting(){return this.hints_[1]>0}cancelAnimations(){let t;this.setHint(0,-this.hints_[0]);for(let e=0,i=this.animations_.length;e<i;++e){const i=this.animations_[e];if(i[0].callback&&Il(i[0].callback,!1),!t)for(let e=0,n=i.length;e<n;++e){const n=i[e];if(!n.complete){t=n.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 n=this.animations_[i];let r=!0;for(let i=0,s=n.length;i<s;++i){const s=n[i];if(s.complete)continue;const o=t-s.start;let a=s.duration>0?o/s.duration:1;a>=1?(s.complete=!0,a=1):r=!1;const l=s.easing(a);if(s.sourceCenter){const t=s.sourceCenter[0],e=s.sourceCenter[1],i=s.targetCenter[0],n=s.targetCenter[1];this.nextCenter_=s.targetCenter;const r=t+l*(i-t),o=e+l*(n-e);this.targetCenter_=[r,o]}if(s.sourceResolution&&s.targetResolution){const t=1===l?s.targetResolution:s.sourceResolution+l*(s.targetResolution-s.sourceResolution);if(s.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,s.anchor)}this.nextResolution_=s.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==s.sourceRotation&&void 0!==s.targetRotation){const t=1===l?Dt(s.targetRotation+Math.PI,2*Math.PI)-Math.PI:s.sourceRotation+l*(s.targetRotation-s.sourceRotation);if(s.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,s.anchor)}this.nextRotation_=s.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!s.complete)break}if(r){this.animations_[i]=null,this.setHint(0,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&Il(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();var r,s;return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],function(t,e){const i=Math.cos(e),n=Math.sin(e),r=t[0]*i-t[1]*n,s=t[1]*i+t[0]*n;t[0]=r,t[1]=s}(i,t-this.getRotation()),s=e,(r=i)[0]+=+s[0],r[1]+=+s[1]),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),r=this.getResolution();return void 0!==n&&void 0!==r&&(i=[e[0]-t*(e[0]-n[0])/r,e[1]-t*(e[1]-n[1])/r]),i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?qe(t,this.getProjection()):t}getCenterInternal(){return this.get(qa.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 Je(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();V(e,"The view center is not defined");const i=this.getResolution();V(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return V(void 0!==n,"The view rotation is not defined"),function(t,e,i,n){const[r,s,o,a,l,h,c,u]=pt(t,e,i,n);return tt(Math.min(r,o,l,c),Math.min(s,a,h,u),Math.max(r,o,l,c),Math.max(s,a,h,u),void 0)}(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(qa.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(Qe(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=St(t)/e[0],n=_t(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return function(i){return e/Math.pow(t,i*n)}}getRotation(){return this.get(qa.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/r}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const r=this.padding_;if(r){const t=this.getViewportSizeMinusPadding_();n=Pl(n,this.getViewportSize_(),[t[0]/2+r[3],t[1]/2+r[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const r=E(this.resolutions_,t,1);n=r,e=this.resolutions_[r],i=r==this.resolutions_.length-1?2:e/this.resolutions_[r+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=Ft(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,Ft(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(V(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t))V(!Ct(t),"Cannot fit empty extent provided as `geometry`"),i=wl(Qe(t,this.getProjection()));else if("Circle"===t.getType()){const e=Qe(t.getExtent(),this.getProjection());i=wl(e),i.rotate(this.getRotation(),ft(e))}else{const e=$e();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),r=t.getFlatCoordinates(),s=t.getStride();let o=1/0,a=1/0,l=-1/0,h=-1/0;for(let t=0,e=r.length;t<e;t+=s){const e=r[t]*i-r[t+1]*n,s=r[t]*n+r[t+1]*i;o=Math.min(o,e),a=Math.min(a,s),l=Math.max(l,e),h=Math.max(h,s)}return[o,a,l,h]}fitInternal(t,e){let i=(e=e||{}).size;i||(i=this.getViewportSizeMinusPadding_());const n=void 0!==e.padding?e.padding:[0,0,0,0],r=void 0!==e.nearest&&e.nearest;let s;s=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]-n[1]-n[3],i[1]-n[0]-n[2]]);a=isNaN(a)?s:Math.max(a,s),a=this.getConstrainedResolution(a,r?0:1);const l=this.getRotation(),h=Math.sin(l),c=Math.cos(l),u=ft(o);u[0]+=(n[1]-n[3])/2*a,u[1]+=(n[0]-n[2])/2*a;const d=u[0]*c-u[1]*h,f=u[1]*c+u[0]*h,g=this.getConstrainedCenter([d,f],a),p=e.callback?e.callback:O;void 0!==e.duration?this.animateInternal({resolution:a,center:g,duration:e.duration,easing:e.easing},p):(this.targetResolution_=a,this.targetCenter_=g,this.applyTargetState_(!1,!0),Il(p,!0))}centerOn(t,e,i){this.centerOnInternal(He(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(Pl(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,n){let r;const s=this.padding_;if(s&&t){const o=this.getViewportSizeMinusPadding_(-i),a=Pl(t,n,[o[0]/2+s[3],o[1]/2+s[0]],e,i);r=[t[0]-a[0],t[1]-a[1]]}return r}isDef(){return!!this.getCenterInternal()&&void 0!==this.getResolution()}adjustCenter(t){const e=qe(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&&He(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.getViewportSize_(this.getRotation()),r=this.constraints_.resolution(this.targetResolution_*t,0,n,i);e&&(this.targetCenter_=this.calculateCenterZoom(r,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=He(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(n,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t?He(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,n=this.constraints_.rotation(this.targetRotation_,i),r=this.getViewportSize_(n),s=this.constraints_.resolution(this.targetResolution_,0,r,i),o=this.constraints_.center(this.targetCenter_,s,r,i,this.calculateCenterShift(this.targetCenter_,s,n,r));this.get(qa.ROTATION)!==n&&this.set(qa.ROTATION,n),this.get(qa.RESOLUTION)!==s&&(this.set(qa.RESOLUTION,s),this.set("zoom",this.getZoom(),!0)),o&&this.get(qa.CENTER)&&Yt(this.get(qa.CENTER),o)||this.set(qa.CENTER,o),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=void 0!==t?t:200;const n=e||0,r=this.constraints_.rotation(this.targetRotation_),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,n,s),a=this.constraints_.center(this.targetCenter_,o,s,!1,this.calculateCenterShift(this.targetCenter_,o,r,s));if(0===t&&!this.cancelAnchor_)return this.targetResolution_=o,this.targetRotation_=r,this.targetCenter_=a,void this.applyTargetState_();i=i||(0===t?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,this.getResolution()===o&&this.getRotation()===r&&this.getCenterInternal()&&Yt(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:a,resolution:o,duration:t,easing:tl,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(1,1)}endInteraction(t,e,i){i=i&&He(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(1,-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)}},Ol="opacity",kl="visible",Al="extent",Ll="zIndex",Dl="maxResolution",jl="minResolution",Gl="maxZoom",Wl="minZoom",Xl="source",zl=class extends Y{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[Ol]=void 0!==t.opacity?t.opacity:1,V("number"==typeof e[Ol],"Layer opacity must be a number"),e[kl]=void 0===t.visible||t.visible,e[Ll]=t.zIndex,e[Dl]=void 0!==t.maxResolution?t.maxResolution:1/0,e[jl]=void 0!==t.minResolution?t.minResolution:0,e[Wl]=void 0!==t.minZoom?t.minZoom:-1/0,e[Gl]=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=Ft(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 G()}getLayerStatesArray(t){return G()}getExtent(){return this.get(Al)}getMaxResolution(){return this.get(Dl)}getMinResolution(){return this.get(jl)}getMinZoom(){return this.get(Wl)}getMaxZoom(){return this.get(Gl)}getOpacity(){return this.get(Ol)}getSourceState(){return G()}getVisible(){return this.get(kl)}getZIndex(){return this.get(Ll)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Al,t)}setMaxResolution(t){this.set(Dl,t)}setMinResolution(t){this.set(jl,t)}setMaxZoom(t){this.set(Gl,t)}setMinZoom(t){this.set(Wl,t)}setOpacity(t){V("number"==typeof t,"Layer opacity must be a number"),this.set(Ol,t)}setVisible(t){this.set(kl,t)}setZIndex(t){this.set(Ll,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},Yl=class extends zl{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(Xl,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(Xl)||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_&&(w(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=v(t,C,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 n;if(!t&&i&&(t=i.getView()),e=t instanceof Fl?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),e.layerStatesArray){if(n=e.layerStatesArray.find(t=>t.layer===this),!n)return!1}else n=this.getLayerState();const r=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 n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}(n,e.viewState)&&(!r||wt(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];let i=e(t instanceof Fl?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("map",t)}getMapInternal(){return this.get("map")}setMap(t){this.mapPrecomposeKey_&&(w(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(w(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=v(t,"precompose",this.handlePrecompose_,this),this.mapRenderKey_=v(this,C,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);V(!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(Xl,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 Nl="renderOrder";var Bl=class extends Yl{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(Nl)}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==0&&(t.declutter[i]=new Bi(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Nl,t)}setStyle(t){this.style_=void 0===t?wa:t;const e=function(t){if(void 0===t)return wa;if(!t)return null;if("function"==typeof t)return t;if(t instanceof ba)return t;if(Array.isArray(t)&&0===t.length)return[];if(Array.isArray(t)&&t[0]instanceof ba){const e=t.length,i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!(e instanceof ba))throw new Error("Expected a list of style instances");i[n]=e}return i}return function(t,e){if(e=e??eo(),!Array.isArray(t))return Ia([t],e);const i=t.length;if("style"in t[0]){const n=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");n[e]=i}return function(t,e){const i=function(t,e){const i=t.length,n=new Array(i);for(let r=0;r<i;++r){const i=t[r],s="filter"in i?la(i.filter,Xs,e):Ea;let o;if(Array.isArray(i.style)){const t=i.style.length;o=new Array(t);for(let n=0;n<t;++n)o[n]=Ma(i.style[n],e)}else o=[Ma(i.style,e)];n[r]={filter:s,styles:o}}return function(e){const r=[];let s=!1;for(let o=0;o<i;++o)if((0,n[o].filter)(e)&&(!t[o].else||!s)){s=!0;for(const t of n[o].styles){const i=t(e);i&&r.push(i)}}return r}}(t,e=e??eo()),n={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""};return function(t,r){if(n.properties=t.getPropertiesInternal(),n.resolution=r,e.featureId){const e=t.getId();n.featureId=void 0!==e?e:null}return e.geometryType&&(n.geometryType=aa(t.getGeometry())),i(n)}}(n,e)}return Ia(t,e)}(t)}(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:(V("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()}},Zl=class extends Bl{constructor(t){super(t)}createRenderer(){return new Gs(this)}},Vl=class extends L{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(C)}release(){this.setState(4)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(4!==this.state){if(3!==this.state&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){G()}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 n=e-i+1e3/60;return n>=this.transition_?1:Qa(n/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 Ul=[];var Kl=class extends Vl{constructor(t,e,i,n,r){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=n.bind(void 0,this),this.removeSourceTiles_=r,this.wrappedTileCoord=i}getContext(){return this.context_||(this.context_=_n(1,1,Ul)),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(t){const e=X(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_&&(xn(this.context_),Ul.push(this.context_.canvas),this.context_=null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}},$l=class extends Vl{constructor(t,e,i,n,r,s){super(t,e,s),this.extent=null,this.format_=n,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=r,this.url_=i,this.key=i}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){0==this.state&&(this.setState(1),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(t,e){this.setFeatures(t)}onError(){this.setState(3)}setFeatures(t){this.features_=t,this.setState(2)}setLoader(t){this.loader_=t}};class ql{constructor(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}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 Hl(t,e,i,n,r){return void 0!==r?(r.minX=t,r.maxX=e,r.minY=i,r.maxY=n,r):new ql(t,e,i,n)}var Jl=ql;function Ql(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function th(t,e,i,n,r){return`${X(t)},${e},${function(t,e,i){return t+"/"+e+"/"+i}(i,n,r)}`}const eh=[0,0,0];var ih=class{constructor(t){let e=t.minZoom;const i=t.resolutions;let n;if(void 0===e&&i&&(e=i.findIndex(t=>void 0!==t)),this.minZoom=void 0!==e?e:0,this.resolutions_=i,V(function(t){const e=((t,e)=>e-t)||R;return t.every(function(i,n){if(0===n)return!0;const r=e(t[n-1],i);return!(r>0||0===r)})}(this.resolutions_),"`resolutions` must be sorted in descending order"),!t.origins)for(let t=0,e=this.resolutions_.length-1;t<e;++t)if(n){if(this.resolutions_[t]/this.resolutions_[t+1]!==n){n=void 0;break}}else n=this.resolutions_[t]/this.resolutions_[t+1];this.zoomFactor_=n,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,V(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const r=t.extent;void 0===r||this.origin_||this.origins_||(this.origin_=xt(r)),V(!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,V(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:256,V(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=void 0!==r?r: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 Jl(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(r){const t=this.getTileRangeForExtentAndZ(r,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}):r&&this.calculateTileRanges_(r)}forEachTileCoord(t,e,i){const n=this.getTileRangeForExtentAndZ(t,e);for(let t=n.minX,r=n.maxX;t<=r;++t)for(let r=n.minY,s=n.maxY;r<=s;++r)i([e,t,r])}forEachTileCoordParentTileRange(t,e,i,n){let r,s,o,a=null,l=t[0]-1;for(2===this.zoomFactor_?(s=t[1],o=t[2]):a=this.getTileCoordExtent(t,n);l>=this.minZoom;){if(void 0!==s&&void 0!==o?(s=Math.floor(s/2),o=Math.floor(o/2),r=Hl(s,s,o,o,i)):r=this.getTileRangeForExtentAndZ(a,l,i),e(l,r))return!0;--l}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],n=2*t[2];return Hl(i,i+1,n,n+1,e)}const n=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(n,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const n=t[0],r=t[1],s=t[2];if(e===n)return Hl(r,s,r,s,i);if(this.zoomFactor_){const t=Math.pow(this.zoomFactor_,e-n),o=Math.floor(r*t),a=Math.floor(s*t);return e<n?Hl(o,o,a,a,i):Hl(o,Math.floor(t*(r+1))-1,a,Math.floor(t*(s+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,eh);const n=eh[1],r=eh[2];return this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,eh),Hl(n,eh[1],r,eh[2],i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),n=us(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*n[0]*i,e[1]-(t[2]+.5)*n[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),n=this.getResolution(t[0]),r=us(this.getTileSize(t[0]),this.tmpSize_),s=i[0]+t[1]*r[0]*n,o=i[1]-(t[2]+1)*r[1]*n;return tt(s,o,s+r[0]*n,o+r[1]*n,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,n,r){const s=this.getZForResolution(i),o=i/this.getResolution(s),a=this.getOrigin(s),l=us(this.getTileSize(s),this.tmpSize_);let h=o*(t-a[0])/i/l[0],c=o*(a[1]-e)/i/l[1];return n?(h=Xt(h,5)-1,c=Xt(c,5)-1):(h=Wt(h,5),c=Wt(c,5)),Ql(s,h,c,r)}getTileCoordForXYAndZ_(t,e,i,n,r){const s=this.getOrigin(i),o=this.getResolution(i),a=us(this.getTileSize(i),this.tmpSize_);let l=(t-s[0])/o/a[0],h=(s[1]-e)/o/a[1];return n?(l=Xt(l,5)-1,h=Xt(h,5)-1):(l=Wt(l,5),h=Wt(h,5)),Ql(i,l,h,r)}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 Ft(E(this.resolutions_,t,e||0),this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return gl(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,i=new Array(e);for(let n=this.minZoom;n<e;++n)i[n]=this.getTileRangeForExtentAndZ(t,n);this.fullTileRanges_=i}};function nh(t){let e=t.getDefaultTileGrid();return e||(e=function(t){return function(t,e,i,n){n=void 0!==n?n:"top-left";const r=rh(t,e,i);return new ih({extent:t,origin:gt(t,n),resolutions:r,tileSize:i})}(sh(t),void 0,void 0,void 0)}(t),t.setDefaultTileGrid(e)),e}function rh(t,e,i,n){e=void 0!==e?e:42,i=us(void 0!==i?i:256);const r=_t(t),s=St(t);n=n>0?n:Math.max(s/i[0],r/i[1]);const o=e+1,a=new Array(o);for(let t=0;t<o;++t)a[t]=n/Math.pow(2,t);return a}function sh(t){let e=(t=Ge(t)).getExtent();if(!e){const i=180*Bt.degrees/t.getMetersPerUnit();e=tt(-i,-i,i,i)}return e}const oh=/\{z\}/g,ah=/\{x\}/g,lh=/\{y\}/g,hh=/\{-y\}/g;function ch(t,e){return function(i,n,r){if(!i)return;let s;const o=i[0];if(e){const t=e.getFullTileRange(o);t&&(s=t.getHeight()-1)}return function(t,e,i,n,r){return t.replace(oh,e.toString()).replace(ah,i.toString()).replace(lh,n.toString()).replace(hh,function(){if(void 0===r)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(r-n).toString()})}(t,o,i[1],i[2],s)}}class uh extends A{constructor(t,e){super(t),this.tile=e}}var dh=class extends ln{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;this.tileGrid&&us(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),[256,256]),this.tmpSize=[0,0],this.key_=t.key||X(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,n,r,s){return G()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:nh(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const n=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),s=us(n.getTileSize(t),this.tmpSize);return 1==r?s:(o=s,a=r,void 0===(l=this.tmpSize)&&(l=[0,0]),l[0]=o[0]*a+.5|0,l[1]=o[1]*a+.5|0,l);var o,a,l}getTileCoordForTileUrlFunction(t,e){const i=void 0!==e?e:this.getProjection(),n=void 0!==e?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=function(t,e,i){const n=e[0],r=t.getTileCoordCenter(e),s=sh(i);if(!q(s,r)){const e=St(s),i=Math.ceil((s[0]-r[0])/e);return r[0]+=e*i,t.getTileCoordForCoordAndZ(r,n)}return e}(n,t,i)),function(t,e){const i=t[0],n=t[1],r=t[2];if(e.getMinZoom()>i||i>e.getMaxZoom())return!1;const s=e.getFullTileRange(i);return!s||s.containsXY(n,r)}(t,n)?t:null}clear(){}refresh(){this.clear(),super.refresh()}};class fh extends dh{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===fh.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=X(e),n=e.getState();let r;1==n?(this.tileLoadingKeys_[i]=!0,r="tileloadstart"):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=3==n?"tileloaderror":2==n?"tileloadend":void 0),null!=r&&this.dispatchEvent(new uh(r,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 n=i[1].charCodeAt(0),r=i[2].charCodeAt(0);let s;for(s=n;s<=r;++s)e.push(t.replace(i[0],String.fromCharCode(s)));return e}if(i=/\{(\d+)-(\d+)\}/.exec(t),i){const n=parseInt(i[2],10);for(let r=parseInt(i[1],10);r<=n;r++)e.push(t.replace(i[0],r.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(function(t,e){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=ch(t[r],e);return function(t){return 1===t.length?t[0]:function(e,i,n){if(!e)return;const r=function(t){return e=t[0],(t[1]<<e)+t[2];var e}(e),s=Dt(r,t.length);return t[s](e,i,n)}}(n)}(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}var gh=fh,ph=class extends gh{constructor(t){const e=t.projection||"EPSG:3857",i=t.extent||sh(e),n=t.tileGrid||function(t){const e=t||{},i=e.extent||Ge("EPSG:3857").getExtent(),n={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:rh(i,e.maxZoom,e.tileSize,e.maxResolution)};return new ih(n)}({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:n,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:_h,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:$l,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceZ_(t,e,i){const n=this.projection,r=e&&n&&!Ye(e,n)?t/n.getMetersPerUnit()*e.getMetersPerUnit():t;return this.tileGrid.getZForResolution(r,i)}getSourceTiles(t,e,i,n){if(0===i.getState()){i.setState(1);const r=i.wrappedTileCoord,s=this.getTileGridForProjection(e);let o=s.getTileCoordExtent(r);const a=r[0],l=s.getResolution(a);K(o,-l,o);const h=this.projection;e&&this.projection&&!Ye(e,h)&&(o=Ue(o,e,h));const c=this.tileGrid,u=c.getExtent();u&&mt(o,u,o);const d=this.getSourceZ_(l,e,this.zDirection),f=n||this.tileUrlFunction;c.forEachTileCoord(o,d,n=>{const r=f(n,t,e);this.sourceTiles_[r]||(this.sourceTiles_[r]=new this.tileClass(n,r?0:4,r,this.format_,this.tileLoadFunction));const s=this.sourceTiles_[r];i.sourceTiles.push(s),this.tileKeysBySourceTileUrl_[r]||(this.tileKeysBySourceTileUrl_[r]=[]),this.tileKeysBySourceTileUrl_[r].push(i.getKey());const o=s.getState();if(o<2){const t=e=>{this.handleTileChange(e);const n=s.getState();if(2===n||3===n){const e=s.getKey();e in i.errorTileKeys?2===s.getState()&&delete i.errorTileKeys[e]:i.loadingSourceTiles--,3===n?i.errorTileKeys[e]=!0:s.removeEventListener(C,t),0===i.loadingSourceTiles&&i.setState(x(i.errorTileKeys)?2:3)}};s.addEventListener(C,t),i.loadingSourceTiles++}0===o&&(s.extent=c.getTileCoordExtent(n),s.projection=this.projection,s.resolution=c.getResolution(n[0]),s.load())}),i.loadingSourceTiles||i.setState(i.sourceTiles.some(t=>3===t.getState())?3:2)}return i.sourceTiles}removeSourceTiles(t){const e=t.getKey(),i=t.sourceTiles;for(let t=0,n=i.length;t<n;++t){const n=i[t].getTileUrl();if(!this.tileKeysBySourceTileUrl_[n])return;const r=this.tileKeysBySourceTileUrl_[n].indexOf(e);-1!==r&&(this.tileKeysBySourceTileUrl_[n].splice(r,1),0===this.tileKeysBySourceTileUrl_[n].length&&(delete this.tileKeysBySourceTileUrl_[n],delete this.sourceTiles_[n]))}}getTile(t,e,i,n,r){const s=[t,e,i];let o=this.getTileCoordForTileUrlFunction(s,r);const a=this.getTileGrid().getExtent(),l=this.projection,h=this.getTileGridForProjection(r);if(o&&a){const e=h.getTileCoordExtent(o);K(e,-h.getResolution(t),e),wt(a,r&&l&&!Ye(r,l)?Ue(e,r,l):e)||(o=null)}let c=!0;if(null!==o){const e=this.tileGrid,i=h.getResolution(t),s=this.getSourceZ_(i,r,1),a=h.getTileCoordExtent(o);K(a,-i,a),e.forEachTileCoord(r&&l&&!Ye(r,l)?Ue(a,r,l):a,s,t=>{c=c&&!this.tileUrlFunction(t,n,l)})}const u=this.tileUrlFunction,d=new Kl(s,c?4:0,o,t=>this.getSourceTiles(n,r,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 n=this.projection;if(null!==n&&!Ye(n,t))return nh(t);const r=this.tileGrid,s=r.getResolutions().slice(),o=s.map(function(t,e){return r.getOrigin(e)}),a=s.map(function(t,e){return r.getTileSize(e)}),l=43;for(let t=s.length;t<l;++t)s.push(s[t-1]/2),o.push(o[t-1]),a.push(a[t-1]);i=new ih({extent:r.getExtent(),origins:o,resolutions:s,tileSizes:a}),this.tileGrids_[e]=i}return i}getTilePixelRatio(t){return t}getTilePixelSize(t,e,i){const n=us(this.getTileGridForProjection(i).getTileSize(t),this.tmpSize);return[Math.round(n[0]*e),Math.round(n[1]*e)]}setOverlaps(t){this.overlaps_=t,this.changed()}};function _h(t,e){t.setLoader(function(i,n,r){Et(e,t.getFormat(),i,n,r,t.onLoad.bind(t),t.onError.bind(t))})}function mh(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageBitmap?t:null}const yh=new Error("disposed"),xh=[256,256];var vh=class extends Vl{constructor(t){super(t.tileCoord,0,{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=mh(this.data_);return t?[t.width,t.height]:xh}getData(){return this.data_}getError(){return this.error_}load(){if(0!==this.state&&3!==this.state)return;this.state=1,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=2,t.changed()}).catch(function(e){t.error_=e,t.state=3,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(yh),this.controller_=null),super.disposeInternal()}},Sh=class extends Vl{constructor(t,e,i,n,r,s){super(t,e,s),this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.src_=i,this.key=i,this.image_,gn?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_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=2,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=3,this.unlistenImage_(),this.image_=function(){const t=_n(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}handleImageLoad_(){if(gn)this.state=2;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=2:this.state=4}this.unlistenImage_(),this.changed()}load(){3==this.state&&(this.state=0,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),0==this.state&&(this.state=1,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=function(t,e,i){const n=t;let r=!0,s=!1,o=!1;const a=[S(n,"load",function(){o=!0,s||e()})];return n.src&&pn?(s=!0,n.decode().then(function(){r&&e()}).catch(function(t){r&&(o?e():i())})):a.push(S(n,"error",i)),function(){r=!1,a.forEach(w)}}(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 wh;const Ch=[];function bh(t,e,i,n,r){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(n,r),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(i,r)),t.restore()}function Rh(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function Th(t,e,i,n){const r=Ve(i,e,t);let s=We(e,n,i);const o=e.getMetersPerUnit();void 0!==o&&(s*=o);const a=t.getMetersPerUnit();void 0!==a&&(s/=a);const l=t.getExtent();if(!l||q(l,r)){const e=We(t,s,r)/s;isFinite(e)&&e>0&&(s/=e)}return s}var Eh=class{constructor(t,e,i,n,r,s,o){this.sourceProj_=t,this.targetProj_=e;let a={};const l=o?(h=t=>ki(o,Ve(t,this.targetProj_,this.sourceProj_)),function(t,e,i,n){const r=t.length;i=void 0!==i?i:2,n=n??i,e=void 0!==e?e:new Array(r);for(let s=0;s<r;s+=n){const r=h(t.slice(s,s+i)),o=r.length;for(let i=0,a=n;i<a;++i)e[s+i]=i>=o?t[s+i]:r[i]}return e}):Ze(this.targetProj_,this.sourceProj_);var h;this.transformInv_=function(t){const e=t[0]+"/"+t[1];return a[e]||(a[e]=l(t)),a[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&St(n)>=St(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?St(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?St(this.targetProj_.getExtent()):null;const c=xt(i),u=vt(i),d=dt(i),f=ut(i),g=this.transformInv_(c),p=this.transformInv_(u),_=this.transformInv_(d),m=this.transformInv_(f),y=10+(s?Math.max(0,Math.ceil(Math.log2(ct(i)/(s*s*256*256)))):0);if(this.addQuad_(c,u,d,f,g,p,_,m,y),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach(function(e,i,n){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 n=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-n<this.sourceWorldWidth_/2&&(e.source=i)}})}a={}}addTriangle_(t,e,i,n,r,s){this.triangles_.push({source:[n,r,s],target:[t,e,i]})}addQuad_(t,e,i,n,r,s,o,a,l){const h=U([r,s,o,a]),c=this.sourceWorldWidth_?St(h)/this.sourceWorldWidth_:null,u=this.sourceWorldWidth_,d=this.sourceProj_.canWrapX()&&c>.5&&c<1;let f=!1;if(l>0&&(this.targetProj_.isGlobal()&&this.targetWorldWidth_&&(f=St(U([t,e,i,n]))/this.targetWorldWidth_>.25||f),!d&&this.sourceProj_.isGlobal()&&c&&(f=c>.25||f)),!f&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!wt(h,this.maxSourceExtent_))return;let g=0;if(!(f||isFinite(r[0])&&isFinite(r[1])&&isFinite(s[0])&&isFinite(s[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)f=!0;else if(g=(isFinite(r[0])&&isFinite(r[1])?0:8)+(isFinite(s[0])&&isFinite(s[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=g&&2!=g&&4!=g&&8!=g)return;if(l>0){if(!f){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],n=this.transformInv_(e);let s;s=d?(Dt(r[0],u)+Dt(o[0],u))/2-Dt(n[0],u):(r[0]+o[0])/2-n[0];const a=(r[1]+o[1])/2-n[1];f=s*s+a*a>this.errorThresholdSquared_}if(f){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const h=[(e[0]+i[0])/2,(e[1]+i[1])/2],c=this.transformInv_(h),u=[(n[0]+t[0])/2,(n[1]+t[1])/2],d=this.transformInv_(u);this.addQuad_(t,e,h,u,r,s,c,d,l-1),this.addQuad_(u,h,i,n,d,c,o,a,l-1)}else{const h=[(t[0]+e[0])/2,(t[1]+e[1])/2],c=this.transformInv_(h),u=[(i[0]+n[0])/2,(i[1]+n[1])/2],d=this.transformInv_(u);this.addQuad_(t,h,u,n,r,c,d,a,l-1),this.addQuad_(h,e,i,u,c,s,o,d,l-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}11&g||this.addTriangle_(t,i,n,r,o,a),14&g||this.addTriangle_(t,i,e,r,o,s),g&&(13&g||this.addTriangle_(e,n,t,s,a,r),7&g||this.addTriangle_(e,n,i,s,a,o))}calculateSourceExtent(){const t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach(function(e,i,n){const r=e.source;ot(t,r[0]),ot(t,r[1]),ot(t,r[2])}),t}getTriangles(){return this.triangles_}},Ih=class extends Vl{constructor(t,e,i,n,r,s,o,a,l,h,c,u){super(r,0,u),this.renderEdges_=void 0!==c&&c,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=n,this.wrappedTileCoord_=s||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const d=n.getTileCoordExtent(this.wrappedTileCoord_),f=this.targetTileGrid_.getExtent();let g=this.sourceTileGrid_.getExtent();const p=f?mt(d,f):d;if(0===ct(p))return void(this.state=4);const _=t.getExtent();_&&(g=g?mt(g,_):_);const m=n.getResolution(this.wrappedTileCoord_[0]),y=function(t,e,i,n){const r=ft(i);let s=Th(t,e,r,n);return(!isFinite(s)||s<=0)&&ht(i,function(i){return s=Th(t,e,i,n),isFinite(s)&&s>0}),s}(t,i,p,m);if(!isFinite(y)||y<=0)return void(this.state=4);const x=void 0!==h?h:.5;if(this.triangulation_=new Eh(t,i,p,g,y*x,m),0===this.triangulation_.getTriangles().length)return void(this.state=4);this.sourceZ_=e.getZForResolution(y);let v=this.triangulation_.calculateSourceExtent();if(g&&(t.canWrapX()?(v[1]=Ft(v[1],g[1],g[3]),v[3]=Ft(v[3],g[1],g[3])):v=mt(v,g)),ct(v)){let i=0,n=0;t.canWrapX()&&(i=St(_),n=Math.floor((v[0]-_[0])/i)),Rt(v.slice(),t,!0).forEach(t=>{const r=e.getTileRangeForExtentAndZ(t,this.sourceZ_);for(let t=r.minX;t<=r.maxX;t++)for(let e=r.minY;e<=r.maxY;e++){const r=n*i;this.sourceTiles_.push({getTile:()=>l(this.sourceZ_,t,e,o),offset:r})}++n}),0===this.sourceTiles_.length&&(this.state=4)}else this.state=4}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{const i=e.tile;if(i&&2==i.getState()){const n=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);n[0]+=e.offset,n[2]+=e.offset;const r=this.clipExtent_?.slice();r&&(r[0]+=e.offset,r[2]+=e.offset),t.push({extent:n,clipExtent:r,image:i.getImage()})}}),this.sourceTiles_.length=0,0===t.length)this.state=3;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],r="number"==typeof i?i:i[1],s=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=function(t,e,i,n,r,s,o,a,l,h,c,u,d,f){const g=_n(Math.round(i*t),Math.round(i*e),Ch);if(u||(g.imageSmoothingEnabled=!1),0===l.length)return g.canvas;function p(t){return Math.round(t*i)/i}g.scale(i,i),g.globalCompositeOperation="lighter";const _=[1/0,1/0,-1/0,-1/0];let m;l.forEach(function(t,e,i){st(_,t.extent)});const y=i/n,x=(u?1:1+Math.pow(2,-24))/y;if(!d||1!==l.length||0!==h){if(m=_n(Math.round(St(_)*y),Math.round(_t(_)*y),Ch),u||(m.imageSmoothingEnabled=!1),r&&f){const t=(r[0]-_[0])*y,e=-(r[3]-_[3])*y,i=St(r)*y,n=_t(r)*y;m.rect(t,e,i,n),m.clip()}l.forEach(function(t,e,i){if(t.image.width>0&&t.image.height>0){if(t.clipExtent){m.save();const e=(t.clipExtent[0]-_[0])*y,i=-(t.clipExtent[3]-_[3])*y,n=St(t.clipExtent)*y,r=_t(t.clipExtent)*y;m.rect(u?e:Math.round(e),u?i:Math.round(i),u?n:Math.round(e+n)-Math.round(e),u?r:Math.round(i+r)-Math.round(i)),m.clip()}const e=(t.extent[0]-_[0])*y,i=-(t.extent[3]-_[3])*y,n=St(t.extent)*y,r=_t(t.extent)*y;m.drawImage(t.image,h,h,t.image.width-2*h,t.image.height-2*h,u?e:Math.round(e),u?i:Math.round(i),u?n:Math.round(e+n)-Math.round(e),u?r:Math.round(i+r)-Math.round(i)),t.clipExtent&&m.restore()}})}const v=xt(o);return a.getTriangles().forEach(function(t,e,i){const n=t.source,r=t.target;let o=n[0][0],a=n[0][1],h=n[1][0],c=n[1][1],d=n[2][0],f=n[2][1];const y=p((r[0][0]-v[0])/s),S=p(-(r[0][1]-v[1])/s),w=p((r[1][0]-v[0])/s),C=p(-(r[1][1]-v[1])/s),b=p((r[2][0]-v[0])/s),R=p(-(r[2][1]-v[1])/s),T=o,E=a;o=0,a=0,h-=T,c-=E,d-=T,f-=E;const I=function(t){const e=t.length;for(let i=0;i<e;i++){let n=i,r=Math.abs(t[i][i]);for(let s=i+1;s<e;s++){const e=Math.abs(t[s][i]);e>r&&(r=e,n=s)}if(0===r)return null;const s=t[n];t[n]=t[i],t[i]=s;for(let n=i+1;n<e;n++){const r=-t[n][i]/t[i][i];for(let s=i;s<e+1;s++)i==s?t[n][s]=0:t[n][s]+=r*t[i][s]}}const i=new Array(e);for(let n=e-1;n>=0;n--){i[n]=t[n][e]/t[n][n];for(let r=n-1;r>=0;r--)t[r][e]-=t[r][n]*i[n]}return i}([[h,c,0,0,w-y],[d,f,0,0,b-y],[0,0,h,c,C-S],[0,0,d,f,R-S]]);if(!I)return;if(g.save(),g.beginPath(),function(){if(void 0===wh){const t=_n(6,6,Ch);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",bh(t,4,5,4,0),bh(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;wh=Rh(e,0)||Rh(e,4)||Rh(e,8),xn(t),Ch.push(t.canvas)}return wh}()||!u){g.moveTo(w,C);const t=4,e=y-w,i=S-C;for(let n=0;n<t;n++)g.lineTo(w+p((n+1)*e/t),C+p(n*i/(t-1))),n!=t-1&&g.lineTo(w+p((n+1)*e/t),C+p((n+1)*i/(t-1)));g.lineTo(b,R)}else g.moveTo(w,C),g.lineTo(y,S),g.lineTo(b,R);let M;if(g.clip(),g.transform(I[0],I[2],I[1],I[3],y,S),g.translate(_[0]-T,_[3]-E),m)M=m.canvas,g.scale(x,-x);else{const t=l[0],e=t.extent;M=t.image,g.scale(St(e)/M.width,-_t(e)/M.height)}g.drawImage(M,0,0),g.restore()}),m&&(xn(m),Ch.push(m.canvas)),c&&(g.save(),g.globalCompositeOperation="source-over",g.strokeStyle="black",g.lineWidth=1,a.getTriangles().forEach(function(t,e,i){const n=t.target,r=(n[0][0]-v[0])/s,o=-(n[0][1]-v[1])/s,a=(n[1][0]-v[0])/s,l=-(n[1][1]-v[1])/s,h=(n[2][0]-v[0])/s,c=-(n[2][1]-v[1])/s;g.beginPath(),g.moveTo(a,l),g.lineTo(r,o),g.lineTo(h,c),g.closePath(),g.stroke()}),g.restore()),g.canvas}(n,r,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),s,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=2}this.changed()}load(){for(const t of this.sourceTiles_)t.tile=t.getTile();if(0==this.state){this.state=1,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const i=e.getState();if(0==i||1==i){t++;const i=v(e,C,n=>{const r=e.getState();2!=r&&3!=r&&4!=r||(w(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){0==t.getState()&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(w),this.sourcesListenerKeys_=null}release(){this.canvas_&&(xn(this.canvas_.getContext("2d")),Ch.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},Mh=class{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 b&&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 V(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 V(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){V(!(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 Ph(t,e,i){if(!(i in t))return t[i]=new Set([e]),!0;const n=t[i],r=n.has(e);return r||n.add(e),!r}function Fh(t,e,i){const n=t[i];return!!n&&n.delete(e)}function Oh(t,e){const i=t.layerStatesArray[t.layerIndex];i.extent&&(e=mt(e,Qe(i.extent,t.viewState.projection)));const n=i.layer.getRenderSource();if(!n.getWrapX()){const i=n.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=mt(e,i))}return e}var kh=class extends js{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 Jl(0,0,0,0),this.tempTileCoord_=Ql(0,0,0);const i=void 0!==e.cacheSize?e.cacheSize:512;this.tileCache_=new Mh(i),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=.5*i}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Mh(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,n){const r=this.tileCache_,s=this.getLayer().getSource(),o=th(s,s.getKey(),t,e,i);let a;if(r.containsKey(o))a=r.get(o);else{const l=n.viewState.projection,h=s.getProjection();if(a=s.getTile(t,e,i,n.pixelRatio,l,!h||Ye(h,l)?void 0:this.getSourceTileCache()),!a)return null;r.set(o,a)}return a}getTile(t,e,i,n){return this.getOrCreateTile(t,e,i,n)||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=ki(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!q(r,n))return null;const s=e.viewState,o=i.getRenderSource(),a=o.getTileGridForProjection(s.projection),l=o.getTilePixelRatio(e.pixelRatio);for(let t=a.getZForResolution(s.resolution);t>=a.getMinZoom();--t){const i=a.getTileCoordForCoordAndZ(n,t),r=this.getTile(t,i[1],i[2],e);if(!r||2!==r.getState())continue;const h=a.getOrigin(t),c=us(a.getTileSize(t)),u=a.getResolution(t);let d;if(r instanceof Sh||r instanceof Ih)d=r.getImage();else{if(!(r instanceof vh))continue;if(d=mh(r.getData()),!d)continue}const f=Math.floor(l*((n[0]-h[0])/u-i[1]*c[0])),g=Math.floor(l*((h[1]-n[1])/u-i[2]*c[1])),p=Math.round(l*o.getGutterForProjection(s.projection));return this.getImageData(d,f+p,g+p)}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,n,r){const s=t.viewState,o=this.getLayer(),a=o.getRenderSource(),l=a.getTileGridForProjection(s.projection),h=X(a);h in t.wantedTiles||(t.wantedTiles[h]={});const c=t.wantedTiles[h],u=o.getMapInternal(),d=Math.max(i-r,l.getMinZoom(),l.getZForResolution(Math.min(o.getMaxResolution(),u?u.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):l.getResolution(0)),a.zDirection)),f=s.rotation,g=f?pt(s.center,s.resolution,f,t.size):void 0;for(let r=i;r>=d;--r){const i=l.getTileRangeForExtentAndZ(e,r,this.tempTileRange_),s=l.getResolution(r);for(let e=i.minX;e<=i.maxX;++e)for(let o=i.minY;o<=i.maxY;++o){if(f&&!l.tileCoordIntersectsViewport([r,e,o],g))continue;const i=this.getTile(r,e,o,t);if(!i)continue;if(!Ph(n,i,r))continue;const a=i.getKey();if(c[a]=!0,0===i.getState()&&!t.tileQueue.isKeyQueued(a)){const n=Ql(r,e,o,this.tempTileCoord_);t.tileQueue.enqueue([i,h,l.getTileCoordCenter(n),s])}}}}findStaleTile_(t,e){const i=this.tileCache_,n=t[0],r=t[1],s=t[2],o=this.getStaleKeys();for(let t=0;t<o.length;++t){const a=th(this.getLayer().getSource(),o[t],n,r,s);if(i.containsKey(a)){const t=i.peek(a);if(2===t.getState())return t.endTransition(X(this)),Ph(e,t,n),!0}}return!1}findAltTiles_(t,e,i,n){const r=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!r)return!1;let s=!0;const o=this.tileCache_,a=this.getLayer().getRenderSource(),l=a.getKey();for(let t=r.minX;t<=r.maxX;++t)for(let e=r.minY;e<=r.maxY;++e){const r=th(a,l,i,t,e);let h=!1;if(o.containsKey(r)){const t=o.peek(r);2===t.getState()&&(Ph(n,t,i),h=!0)}h||(s=!1)}return s}renderFrame(t,e){this.renderComplete=!0;const i=t.layerStatesArray[t.layerIndex],n=t.viewState,r=n.projection,s=n.resolution,o=n.center,a=t.pixelRatio,l=this.getLayer(),h=l.getSource(),c=h.getTileGridForProjection(r),u=c.getZForResolution(s,h.zDirection),d=c.getResolution(u);this.updateStaleKeys(h.getKey());let f=t.extent;const g=h.getTilePixelRatio(a);this.prepareContainer(t,e);const p=this.context.canvas.width,_=this.context.canvas.height;this.layerExtent=i.extent?Qe(i.extent):null,this.layerExtent&&(f=mt(f,this.layerExtent));const m=d*p/2/g,y=d*_/2/g,x=[o[0]-m,o[1]-y,o[0]+m,o[1]+y],v={};this.renderedTiles.length=0;const S=l.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const e=c.getZForResolution(n.nextResolution,h.zDirection),i=Oh(t,t.nextExtent);this.enqueueTiles(t,i,e,v,S)}const w=Oh(t,f);if(this.enqueueTiles(t,w,u,v,0),S>0&&setTimeout(()=>{this.enqueueTiles(t,w,u-1,v,S-1)},0),!(u in v))return this.container;const C=X(this),b=t.time;for(const e of v[u]){const i=e.getState();if(4===i)continue;const n=e.tileCoord;if(2===i&&1===e.getAlpha(C,b)){e.endTransition(C);continue}if(3!==i&&(this.renderComplete=!1),this.findStaleTile_(n,v)){Fh(v,e,u),t.animate=!0;continue}if(this.findAltTiles_(c,n,u+1,v))continue;const r=c.getMinZoom();for(let t=u-1;t>=r&&!this.findAltTiles_(c,n,t,v);--t);}const T=d/s*a/g,E=this.getRenderContext(t);Li(this.tempTransform,p/2,_/2,T,T,0,-p/2,-_/2),this.layerExtent&&this.clipUnrotated(E,t,this.layerExtent),h.getInterpolate()||(E.imageSmoothingEnabled=!1),this.preRender(E,t);const I=Object.keys(v).map(Number);I.sort(R);const M=[],P=[],F=[];for(let e=I.length-1;e>=0;--e){const i=I[e],n=h.getTilePixelSize(i,a,r),s=c.getResolution(i)/d,o=n[0]*s*T,l=n[1]*s*T,f=c.getTileCoordForCoordAndZ(xt(x),i),p=c.getTileCoordExtent(f),_=ki(this.tempTransform,[g*(p[0]-x[0])/d,g*(x[3]-p[3])/d]),m=g*h.getGutterForProjection(r);for(const e of v[i]){if(2!==e.getState())continue;const n=e.tileCoord,r=f[1]-n[1],s=Math.round(_[0]-(r-1)*o),a=f[2]-n[2],c=Math.round(_[1]-(a-1)*l),d=Math.round(_[0]-r*o),g=Math.round(_[1]-a*l),p=s-d,y=c-g,x=i===u;if(x&&e.inTransition(C)){F.push({tile:e,x:d,y:g,w:p,h:y,gutter:m}),this.renderedTiles.unshift(e),this.updateUsedTiles(t.usedTiles,h,e);continue}const v=[d,g,d+p,g+y],S=[];for(let t=0,e=M.length;t<e;++t)i<P[t]&&wt(v,M[t])&&S.push(M[t]);let w;S.length>0&&(w=Tt(v,S)),M.push(v),P.push(i),this.drawTile(e,t,d,g,p,y,m,x,w),this.renderedTiles.unshift(e),this.updateUsedTiles(t.usedTiles,h,e)}}for(let e=0,i=F.length;e<i;++e){const{tile:i,x:n,y:r,w:s,h:o,gutter:a}=F[e];this.drawTile(i,t,n,r,s,o,a,!0,void 0)}if(this.renderedResolution=d,this.extentChanged=!this.renderedExtent_||!rt(this.renderedExtent_,x),this.renderedExtent_=x,this.renderedPixelRatio=a,this.postRender(this.context,t),this.layerExtent&&E.restore(),E.imageSmoothingEnabled=!0,this.renderComplete){const e=(t,e)=>{const i=X(h),n=e.wantedTiles[i],r=n?Object.keys(n).length:0;this.updateCacheSize(r),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,n,r,s,o,a,l){let h;if(t instanceof vh){if(h=mh(t.getData()),!h)throw new Error("Rendering array data is not yet supported")}else h=this.getTileImage(t);if(!h)return;const c=this.getRenderContext(e),u=X(this),d=e.layerStatesArray[e.layerIndex],f=d.opacity*(a?t.getAlpha(u,e.time):1),g=f!==c.globalAlpha;g&&(c.save(),c.globalAlpha=f);const p=h.width-2*o,_=h.height-2*o;if(l){const t=p/r,e=_/s;for(let r=0,s=l.length;r<s;++r){const s=l[r],a=s[0],u=s[1],d=s[2]-s[0],f=s[3]-s[1];c.drawImage(h,o+(a-i)*t,o+(u-n)*e,d*t,f*e,a,u,d,f)}}else c.drawImage(h,o,o,p,_,i,n,r,s);g&&c.restore(),f!==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 n=X(e);n in t||(t[n]={}),t[n][i.getKey()]=!0}};const Ah={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},Lh={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};var Dh=class extends kh{constructor(t,e){super(t,e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=Mi(),this.tileClipContexts_=null}enqueueTilesForNextExtent(){return"vector"!==this.getLayer().getRenderMode()}drawTile(t,e,i,n,r,s,o,a,l){this.updateExecutorGroup_(t,e.pixelRatio,e.viewState.projection),this.tileImageNeedsRender_(t)&&this.renderTileImage_(t,e),super.drawTile(t,e,i,n,r,s,o,a,l)}getTile(t,e,i,n){const r=this.getOrCreateTile(t,e,i,n);if(!r)return null;const s=n.viewState,o=s.resolution,a=n.viewHints,l=this.getLayer().getSource(),h=l.getTileGridForProjection(s.projection),c=!(a[0]||a[1]),u=h.getZForResolution(o,l.zDirection)===t;return c&&u?r.wantedResolution=o:r.wantedResolution||(r.wantedResolution=h.getResolution(t)),r}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 n=this.getLayer(),r=n.getRevision(),s=n.getRenderOrder()||null,o=t.wantedResolution,a=t.getReplayState(n);if(!a.dirty&&a.renderedResolution===o&&a.renderedRevision==r&&a.renderedPixelRatio===e&&a.renderedRenderOrder==s)return;const l=n.getSource(),h=!!n.getDeclutter(),c=l.getTileGrid(),u=l.getTileGridForProjection(i).getTileCoordExtent(t.wrappedTileCoord),d=l.getSourceTiles(e,i,t),f=X(n);delete t.hitDetectionImageData[f],t.executorGroups[f]=[],a.dirty=!1;for(let r=0,g=d.length;r<g;++r){const g=d[r];if(2!=g.getState())continue;const p=l.getProjection(),_=g.tileCoord;let m=c.getTileCoordExtent(_);i&&p&&!Ye(i,p)&&(m=Ue(m,p,i,32));const y=mt(u,m),x=K(y,n.getRenderBuffer()*o,this.tempExtent),v=rt(m,y)?null:x,S=new Wr(0,y,o,e),w=Ms(o,e),C=function(t,e){let i;const r=t.getStyleFunction()||n.getStyleFunction();if(r&&(i=r(t,o)),i){const n=this.renderFeature(t,w,i,S,h,e);a.dirty=a.dirty||n}},b=g.getFeatures();s&&s!==a.renderedRenderOrder&&b.sort(s);for(let t=0,e=b.length;t<e;++t){let e=b[t];i&&g.projection&&!Ye(i,g.projection)&&(e=e.clone(),e.getGeometry().applyTransform(Ze(g.projection,i))),v&&!wt(v,e.getGeometry().getExtent())||C.call(this,e,t)}const R=S.finish(),T="vector"!==n.getRenderMode()&&h&&1===d.length?null:y,E=new cs(T,o,e,l.getOverlaps(),R,n.getRenderBuffer(),!0);t.executorGroups[f].push(E)}a.renderedRevision=r,a.renderedPixelRatio=e,a.renderedRenderOrder=s,a.renderedResolution=o}forEachFeatureAtCoordinate(t,e,i,n,r){const s=e.viewState.resolution,o=e.viewState.rotation;i=null==i?0:i;const a=this.getLayer(),l=a.getSource().getTileGridForProjection(e.viewState.projection),h=a.getRenderBuffer(),c=U([t]);K(c,s*(h+i),c);const u={},d=function(t,e,i){let s=t.getId();void 0===s&&(s=X(t));const o=u[s];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return u[s]=!0,r.splice(r.lastIndexOf(o),1),n(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return u[s]=!0,n(t,a,e);r.push(u[s]={feature:t,layer:a,geometry:e,distanceSq:i,callback:n})}},f=this.renderedTiles,g=X(a),p=a.getDeclutter(),_=p?e.declutter?.[p]?.all().map(t=>t.value):null;let m;t:for(let e=f.length-1;e>=0;--e){const n=f[e];if(!wt(l.getTileCoordExtent(n.wrappedTileCoord),c))continue;const r=n.executorGroups[g];for(let e=0,n=r.length;e<n;++e)if(m=r[e].forEachFeatureAtCoordinate(t,s,o,i,d,_),m)break t}return m}getFeatures(t){return 0===this.renderedTiles.length?Promise.resolve([]):new Promise((e,i)=>{const n=this.getLayer(),r=n.getSource(),s=this.renderedProjection,o=s.getExtent(),a=this.renderedResolution,l=r.getTileGridForProjection(s),h=ki(this.renderedPixelToCoordinateTransform_,t.slice()),c=l.getTileCoordForCoordAndResolution(h,a).toString(),u=this.renderedTiles.find(t=>t.tileCoord.toString()===c&&2===t.getState());if(!u||u.loadingSourceTiles>0)return void e([]);r.getWrapX()&&s.canWrapX()&&!H(o,l.getTileCoordExtent(u.tileCoord))&&Nt(h,s);const d=X(n),f=xt(l.getTileCoordExtent(u.wrappedTileCoord)),g=[(h[0]-f[0])/a,(f[1]-h[1])/a],p=u.getSourceTiles().reduce((t,e)=>t.concat(e.getFeatures()),[]);let _=u.hitDetectionImageData[d];if(!_){const t=us(l.getTileSize(l.getZForResolution(a,r.zDirection))),e=this.renderedRotation_;_=Rs(t,[this.getRenderTransform(l.getTileCoordCenter(u.wrappedTileCoord),a,0,bs,t[0]*bs,t[1]*bs,0)],p,n.getStyleFunction(),l.getTileCoordExtent(u.wrappedTileCoord),u.getReplayState(n).renderedResolution,e),u.hitDetectionImageData[d]=_}e(Ts(g,p,_))})}getFeaturesInExtent(t){const e=[],i=this.getTileCache();if(0===i.getCount())return e;const n=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),r=n.getZForResolution(this.renderedResolution),s={};return i.forEach(i=>{if(i.tileCoord[0]!==r||2!==i.getState())return;const o=i.getSourceTiles();for(let i=0,r=o.length;i<r;++i){const r=o[i],a=r.getKey();if(a in s)continue;s[a]=!0;const l=r.tileCoord;if(wt(t,n.getTileCoordExtent(l))){const i=r.getFeatures();if(i)for(let n=0,r=i.length;n<r;++n){const r=i[n],s=r.getGeometry();wt(t,s.getExtent())&&e.push(r)}}}}),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,n=i.globalAlpha;i.globalAlpha=e.opacity;const r=t.viewHints,s=!(r[0]||r[1]),o=[this.context.canvas.width,this.context.canvas.height],a=this.getLayer().getDeclutter(),l=a?t.declutter?.[a]:void 0,h=X(this.getLayer()),c=this.renderedTiles;for(let e=0,i=c.length;e<i;++e){const i=c[e],n=i.executorGroups[h];if(n)for(let e=n.length-1;e>=0;--e)n[e].execute(this.context,o,this.getTileRenderTransform(i,t),t.viewState.rotation,s,ss,l)}i.globalAlpha=n}renderDeferredInternal(t){const e=this.renderedTiles,i=X(this.getLayer()),n=e.reduce((t,e,n)=>(e.executorGroups[i].forEach(e=>t.push({executorGroup:e,index:n})),t),[]),r=n.map(({executorGroup:t})=>t.getDeferredZIndexContexts()),s={};for(let t=0,e=n.length;t<e;++t){const e=n[t].executorGroup.getDeferredZIndexContexts();for(const t in e)s[t]=!0}const o=Object.keys(s).map(Number).sort(R);this.layerExtent&&this.clipUnrotated(this.context,t,this.layerExtent),o.forEach(t=>{r.forEach((e,i)=>{e[t]&&(e[t].forEach(t=>{const{executorGroup:e,index:r}=n[i],s=e.getRenderedContext(),o=s.globalAlpha;s.globalAlpha=this.renderedOpacity_;const a=this.tileClipContexts_[r];a&&a.draw(s),t.draw(s),a&&s.restore(),s.globalAlpha=o,t.clear()}),e[t].length=0)})}),this.layerExtent&&this.context.restore()}getTileRenderTransform(t,e){const i=e.pixelRatio,n=e.viewState,r=n.center,s=n.resolution,o=n.rotation,a=e.size,l=Math.round(a[0]*i),h=Math.round(a[1]*i),c=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),u=t.tileCoord,d=c.getTileCoordExtent(t.wrappedTileCoord),f=c.getTileCoordExtent(u,this.tempExtent)[0]-d[0];return Fi(Ai(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(r,s,o,i,l,h,f))}clipTileContext_(t,e,i,n,r,s){const o=[];for(let t=0,s=i.length;t<s;++t)r<n[t]&&wt(e,i[t])&&o.push(i[t]);if(0===o.length)return!1;const a=Tt(e,o);t.save(),t.beginPath();for(let e=0,i=a.length;e<i;++e){const i=a[e],n=ki(s,[i[0],i[1]]),r=ki(s,[i[0],i[3]]),o=ki(s,[i[2],i[3]]),l=ki(s,[i[2],i[1]]);t.moveTo(n[0],n[1]),t.lineTo(r[0],r[1]),t.lineTo(o[0],o[1]),t.lineTo(l[0],l[1]),t.closePath()}return t.clip(),!0}postRender(t,e){const i=e.viewHints,n=!(i[0]||i[1]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation,this.renderedOpacity_=e.layerStatesArray[e.layerIndex].opacity;const r=this.getLayer(),s=r.getRenderMode(),o=t.globalAlpha;t.globalAlpha=this.renderedOpacity_;const a=r.getDeclutter(),l=a?Lh[s].filter(t=>!ss.includes(t)):Lh[s],h=e.viewState,c=h.rotation;this.layerExtent&&this.clipUnrotated(t,e,this.layerExtent);const u=r.getSource(),d=u.getTileGridForProjection(h.projection).getZForResolution(h.resolution,u.zDirection),f=this.renderedTiles,g=[],p=[],_=[],m=X(r);let y=!0;for(let i=f.length-1;i>=0;--i){const s=f[i];y=y&&!s.getReplayState(r).dirty;const o=s.executorGroups[m].filter(t=>t.hasExecutors(l));if(0===o.length)continue;const h=this.getTileRenderTransform(s,e),u=s.tileCoord[0];let x=!1;const v=o[0].getClipCoords(Ei);let S,w=t;if(v){const t=[v[0],v[1],v[4],v[5]];S=new Vr,w=S.getContext(),d!==u&&(x=this.clipTileContext_(w,t,g,p,u,h)),g.push(t),p.push(u)}for(let i=0,r=o.length;i<r;++i)o[i].execute(t,[t.canvas.width,t.canvas.height],h,c,n,l,e.declutter?.[a]);x&&(w===t?w.restore():_[i]=S)}this.layerExtent&&t.restore(),t.globalAlpha=o,this.ready=y,this.tileClipContexts_=_,e.declutter||this.renderDeferredInternal(e),super.postRender(t,e)}renderFeature(t,e,i,n,r,s){if(!i)return!1;let o=!1;if(Array.isArray(i))for(let a=0,l=i.length;a<l;++a)o=Fs(n,t,i[a],e,this.boundHandleStyleImageChange_,void 0,r,s)||o;else o=Fs(n,t,i,e,this.boundHandleStyleImageChange_,void 0,r,s);return o}tileImageNeedsRender_(t){const e=this.getLayer();if("vector"===e.getRenderMode())return!1;const i=t.getReplayState(e),n=e.getRevision(),r=t.wantedResolution;return i.renderedTileResolution!==r||i.renderedTileRevision!==n}renderTileImage_(t,e){const i=this.getLayer(),n=t.getReplayState(i),r=i.getRevision(),s=t.executorGroups[X(i)];n.renderedTileRevision=r;const o=t.wrappedTileCoord,a=o[0],l=i.getSource();let h=e.pixelRatio;const c=e.viewState.projection,u=l.getTileGridForProjection(c),d=u.getResolution(t.tileCoord[0]),f=e.pixelRatio/t.wantedResolution*d,g=u.getResolution(a),p=t.getContext();h=Math.round(Math.max(h,f/h));const _=l.getTilePixelSize(a,h,c);p.canvas.width=_[0],p.canvas.height=_[1];const m=h/f;if(1!==m){const t=Pi(this.tmpTransform_);Ai(t,m,m),p.setTransform.apply(p,t)}const y=u.getTileCoordExtent(o,this.tempExtent),x=f/g,v=Pi(this.tmpTransform_);Ai(v,x,-x),function(t,e,i){Fi(t,Oi(Ii,1,0,0,1,e,i))}(v,-y[0],-y[3]);for(let t=0,e=s.length;t<e;++t)s[t].execute(p,[p.canvas.width*m,p.canvas.height*m],v,0,!0,Ah[i.getRenderMode()],null);n.renderedTileResolution=t.wantedResolution}},jh="preload",Gh="useInterimTilesOnError",Wh=class extends Bl{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 n=t.renderMode||"hybrid";V("hybrid"==n||"vector"==n,"`renderMode` must be `'hybrid'` or `'vector'`"),this.renderMode_=n,this.setPreload(t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError),this.getBackground,this.setBackground}createRenderer(){return new Dh(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(jh)}getUseInterimTilesOnError(){return this.get(Gh)}setPreload(t){this.set(jh,t)}setUseInterimTilesOnError(t){this.set(Gh,t)}};class Xh extends Y{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 Xh,e=this.geometryName_;t.setGeometryName(e);const i=this.getPropertiesInternal();if(i){const n=this.getGeometry();for(const r in i)r===e&&n?t.set(r,n.clone()):t.set(r,i[r],!0)}const n=this.getStyle();return n&&t.setStyle(n),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_&&(w(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=v(t,C,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;return Array.isArray(t)?e=t:(V("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[t]),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_())}}var zh=Xh;class Yh extends xs{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(w),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,i=t.length;e<i;++e)this.changeEventsKeys_.push(v(t[e],C,this.changed,this))}clone(){const t=new Yh(Nh(this.geometries_));return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<$(this.getExtent(),t,e))return n;const r=this.geometries_;for(let s=0,o=r.length;s<o;++s)n=r[s].closestPointXY(t,e,i,n);return n}containsXY(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)if(i[n].containsXY(t,e))return!0;return!1}computeExtent(t){et(t);const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)st(t,e[i].getExtent());return t}getGeometries(){return Nh(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const e=this.geometries_;for(let i=0,n=e.length;i<n;++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 n=!1;for(let r=0,s=i.length;r<s;++r){const s=i[r],o=s.getSimplifiedGeometry(t);e.push(o),o!==s&&(n=!0)}return n?new Yh(e):(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getType(){return"GeometryCollection"}intersectsExtent(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++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 n=0,r=i.length;n<r;++n)i[n].rotate(t,e);this.changed()}scale(t,e,i){i||(i=ft(this.getExtent()));const n=this.geometries_;for(let r=0,s=n.length;r<s;++r)n[r].scale(t,e,i);this.changed()}setGeometries(t){this.setGeometriesArray(Nh(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].applyTransform(t);this.changed()}translate(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)i[n].translate(t,e);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function Nh(t){return t.map(t=>t.clone())}var Bh=Yh;class Zh extends ws{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){M(this.flatCoordinates,t),this.changed()}clone(){const t=new Zh(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<$(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(sl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),al(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,n))}forEachSegment(t){return dl(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,di(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return qn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return ui(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return Xr(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=vi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Zh(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return fl(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=hl(this.flatCoordinates,0,t,this.stride),this.changed()}}var Vh=Zh;class Uh extends ws{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=[],n=[];for(let t=0,r=e.length;t<r;++t)M(i,e[t].getFlatCoordinates()),n.push(i.length);const r=0===e.length?this.getLayout():e[0].getLayout();this.setFlatCoordinates(r,i),this.ends_=n}}appendLineString(t){M(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Uh(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<$(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ol(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ll(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,i,n))}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,n,r,s,o){if(o)return di(t,e,i[i.length-1],n,r,s);let a;if(r<t[n-1])return s?(a=t.slice(0,n),a[n-1]=r,a):null;if(t[t.length-1]<r)return s?(a=t.slice(t.length-n),a[n-1]=r,a):null;for(let s=0,o=i.length;s<o;++s){const o=i[s];if(e!=o){if(r<t[e+n-1])return null;if(r<=t[o-1])return di(t,e,o,n,r,!1);e=o}}return null}(this.flatCoordinates,0,this.ends_,this.stride,t,e,i))}getCoordinates(){return Hn(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new Vh(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,n=[];let r=0;for(let s=0,o=e.length;s<o;++s){const o=e[s],a=new Vh(t.slice(r,o),i);n.push(a),r=o}return n}getLength(){const t=this.ends_;let e=0,i=0;for(let n=0,r=t.length;n<r;++n)i+=Xr(this.flatCoordinates,e,t[n],this.stride),e=t[n];return i}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let i=0;const n=this.ends_,r=this.stride;for(let s=0,o=n.length;s<o;++s){const o=n[s];M(t,ui(e,i,o,r,.5)),i=o}return t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Si(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,i),new Uh(e,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(t){return function(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){if(fl(t,e,i[s],n,r))return!0;e=i[s]}return!1}(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=cl(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}var Kh=Uh;class $h extends ws{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){M(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new $h(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<$(this.getExtent(),t,e))return n;const r=this.flatCoordinates,s=this.stride;for(let o=0,a=r.length;o<a;o+=s){const a=kt(t,e,r[o],r[o+1]);if(a<n){n=a;for(let t=0;t<s;++t)i[t]=r[o+t];i.length=s}}return n}getCoordinates(){return qn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new xl(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,i=this.stride,n=[];for(let r=0,s=t.length;r<s;r+=i){const s=new xl(t.slice(r,r+i),e);n.push(s)}return n}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,i=this.stride;for(let n=0,r=e.length;n<r;n+=i)if(J(t,e[n],e[n+1]))return!0;return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=hl(this.flatCoordinates,0,t,this.stride),this.changed()}}var qh=$h;class Hh extends ws{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 n=t,r=[],s=[];for(let t=0,e=n.length;t<e;++t){const e=n[t],i=r.length,o=e.getEnds();for(let t=0,e=o.length;t<e;++t)o[t]+=i;M(r,e.getFlatCoordinates()),s.push(o)}e=0===n.length?this.getLayout():n[0].getLayout(),t=r,i=s}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;M(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let t=0,n=e.length;t<n;++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 Hh(this.flatCoordinates.slice(),this.layout,e);return i.applyProperties(this),i}closestPointXY(t,e,i,n){return n<$(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(function(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];r=ol(t,e,o,n,r),e=o[o.length-1]}return r}(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),function(t,e,i,n,r,s,o,a,l,h,c){c=c||[NaN,NaN];for(let s=0,u=i.length;s<u;++s){const u=i[s];h=ll(t,e,u,n,r,true,o,a,l,h,c),e=u[u.length-1]}return h}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,0,t,e,i,n))}containsXY(t,e){return function(t,e,i,n,r,s){if(0===i.length)return!1;for(let o=0,a=i.length;o<a;++o){const a=i[o];if(li(t,e,a,n,r,s))return!0;e=a[a.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return function(t,e,i,n){let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s];r+=nl(t,e,o,n),e=o[o.length-1]}return r}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),yi(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,Jn(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=si(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=ci(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new qh(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;_i(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=yi(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,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l],c=[];o=bi(t,e,h,n,r,s,o,c),a.push(c),e=h[h.length-1]}return o}(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new Hh(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(),n=i[i.length-1];if(0!==e)for(let t=0,n=i.length;t<n;++t)i[t]-=e;return new Sl(this.flatCoordinates.slice(e,n),this.layout,i)}getPolygons(){const t=this.layout,e=this.flatCoordinates,i=this.endss_,n=[];let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s].slice(),a=o[o.length-1];if(0!==r)for(let t=0,e=o.length;t<e;++t)o[t]-=r;const l=new Sl(e.slice(r,a),t,o);n.push(l),r=a}return n}getType(){return"MultiPolygon"}intersectsExtent(t){return function(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];if(pl(t,e,o,n,r))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=ul(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()}}var Jh=Hh,Qh=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=zh,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let i=e.dataProjection?Ge(e.dataProjection):this.readProjection(t);e.extent&&i&&"tile-pixels"===i.getUnits()&&(i=Ge(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 G()}readFeature(t,e){return G()}readFeatures(t,e){return G()}readGeometry(t,e){return G()}readProjection(t){return G()}writeFeature(t,e){return G()}writeFeatures(t,e){return G()}writeGeometry(t,e){return G()}};function tc(t,e,i){const n=i?Ge(i.featureProjection):null,r=i?Ge(i.dataProjection):null;let s=t;if(n&&r&&!Ye(n,r)){e&&(s=t.clone());const i=e?n:r,o=e?r:n;"tile-pixels"===i.getUnits()?s.transform(i,o):s.applyTransform(Ze(i,o))}if(e&&i&&void 0!==i.decimals){const e=Math.pow(10,i.decimals),n=function(t){for(let i=0,n=t.length;i<n;++i)t[i]=Math.round(t[i]*e)/e;return t};s===t&&(s=t.clone()),s.applyTransform(n)}return s}const ec={Point:xl,LineString:Vh,Polygon:Sl,MultiPoint:qh,MultiLineString:Kh,MultiPolygon:Jh};function ic(t,e){const i=t.geometry;if(!i)return[];if(Array.isArray(i))return i.map(e=>ic({...t,geometry:e})).flat();const n="MultiPolygon"===i.type?"Polygon":i.type;if("GeometryCollection"===n||"Circle"===n)throw new Error("Unsupported geometry type: "+n);const r=i.layout.length;return tc(new Xi(n,"Polygon"===n?function(t,e,i){return Array.isArray(e[0])?(_i(t,0,e,i)||yi(t=t.slice(),0,e,i),t):(pi(t,0,e,i)||mi(t=t.slice(),0,e,i),t)}(i.flatCoordinates,i.ends,r):i.flatCoordinates,i.ends?.flat(),r,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function nc(t,e){if(!t)return null;if(Array.isArray(t)){const i=t.map(t=>nc(t,e));return new Bh(i)}return tc(new(0,ec[t.type])(t.flatCoordinates,t.layout||"XY",t.ends),!1,e)}function rc(t){if("string"==typeof t){return JSON.parse(t)||null}return null!==t?t:null}var sc=class extends Qh{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(rc(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(rc(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return G()}readFeaturesFromObject(t,e){return G()}readGeometry(t,e){return this.readGeometryFromObject(rc(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return G()}readProjection(t){return this.readProjectionFromObject(rc(t))}readProjectionFromObject(t){return G()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return G()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return G()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return G()}};function oc(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:vs(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:vs(e[0]?.length||2)}}(t);break;case"Polygon":i=function(t){const e=t.coordinates,i=[],n=e[0]?.[0]?.length;return{type:"Polygon",flatCoordinates:i,ends:cl(i,0,e,n),layout:vs(n)}}(t);break;case"MultiPoint":i=function(t){const e=t.coordinates;return{type:"MultiPoint",flatCoordinates:e.flat(),layout:vs(e[0]?.length||2)}}(t);break;case"MultiLineString":i=function(t){const e=t.coordinates,i=e[0]?.[0]?.length||2,n=[];return{type:"MultiLineString",flatCoordinates:n,ends:cl(n,0,e,i),layout:vs(i)}}(t);break;case"MultiPolygon":i=function(t){const e=t.coordinates,i=[],n=e[0]?.[0]?.[0].length||2;return{type:"MultiPolygon",flatCoordinates:i,ends:ul(i,0,e,n),layout:vs(n)}}(t);break;case"GeometryCollection":i=function(t){const e=t.geometries.map(function(t){return oc(t)});return e}(t);break;default:throw new Error("Unsupported GeoJSON type: "+t.type)}return i}function ac(t,e){const i=(t=tc(t,!0,e)).getType();let n;switch(i){case"Point":n=function(t){return{type:"Point",coordinates:t.getCoordinates()}}(t);break;case"LineString":n=function(t){return{type:"LineString",coordinates:t.getCoordinates()}}(t);break;case"Polygon":n=function(t,e){let i;return e&&(i=e.rightHanded),{type:"Polygon",coordinates:t.getCoordinates(i)}}(t,e);break;case"MultiPoint":n=function(t){return{type:"MultiPoint",coordinates:t.getCoordinates()}}(t);break;case"MultiLineString":n=function(t){return{type:"MultiLineString",coordinates:t.getCoordinates()}}(t);break;case"MultiPolygon":n=function(t,e){let i;return e&&(i=e.rightHanded),{type:"MultiPolygon",coordinates:t.getCoordinates(i)}}(t,e);break;case"GeometryCollection":n=function(t,e){delete(e=Object.assign({},e)).featureProjection;return{type:"GeometryCollection",geometries:t.getGeometriesArray().map(function(t){return ac(t,e)})}}(t,e);break;case"Circle":n={type:"GeometryCollection",geometries:[]};break;default:throw new Error("Unsupported geometry type: "+i)}return n}const lc=4294967296,hc="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class cc{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 n;for(;n=this.nextField(i);)t(n,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)*lc;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*lc;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 n,r=127&i;return n=e[this.pos++],r|=(127&n)<<7,n<128?r:(n=e[this.pos++],r|=(127&n)<<14,n<128?r:(n=e[this.pos++],r|=(127&n)<<21,n<128?r:(n=e[this.pos],r|=(15&n)<<28,function(t,e,i){const n=i.buf;let r,s;if(s=n[i.pos++],r=(112&s)>>4,s<128)return uc(t,r,e);if(s=n[i.pos++],r|=(127&s)<<3,s<128)return uc(t,r,e);if(s=n[i.pos++],r|=(127&s)<<10,s<128)return uc(t,r,e);if(s=n[i.pos++],r|=(127&s)<<17,s<128)return uc(t,r,e);if(s=n[i.pos++],r|=(127&s)<<24,s<128)return uc(t,r,e);if(s=n[i.pos++],r|=(1&s)<<31,s<128)return uc(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(r,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&&hc?hc.decode(this.buf.subarray(e,t)):function(t,e,i){let n="",r=e;for(;r<i;){const e=t[r];let s,o,a,l=null,h=e>239?4:e>223?3:e>191?2:1;if(r+h>i)break;1===h?e<128&&(l=e):2===h?(s=t[r+1],128==(192&s)&&(l=(31&e)<<6|63&s,l<=127&&(l=null))):3===h?(s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&(l=(15&e)<<12|(63&s)<<6|63&o,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===h&&(s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&e)<<18|(63&s)<<12|(63&o)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,h=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),r+=h}return n}(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 uc(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function dc(t,e,i){if(3===t){const t={keys:[],values:[],features:[]},n=i.readVarint()+i.pos;i.readFields(fc,t,n),t.length=t.features.length,t.length&&(e[t.name]=t)}}function fc(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 n=null;const r=i.readVarint()+i.pos;for(;i.pos<r;)n=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(n)}}function gc(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()],n=e.layer.values[i.readVarint()];e.properties[t]=n}}else 3==t?e.type=i.readVarint():4==t&&(e.geometry=i.pos)}function pc(t,e,i){t.pos=e.features[i];const n=t.readVarint()+t.pos,r={layer:e,type:0,properties:{}};return t.readFields(gc,r,n),r}var _c=class extends Qh{constructor(t){super(),t=t||{},this.dataProjection=new Zt({code:"",units:"tile-pixels"}),this.featureClass=t.featureClass?t.featureClass:Xi,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,n){t.pos=e.geometry;const r=t.readVarint()+t.pos;let s=1,o=0,a=0,l=0,h=0,c=0;for(;t.pos<r;){if(!o){const e=t.readVarint();s=7&e,o=e>>3}if(o--,1===s||2===s)a+=t.readSVarint(),l+=t.readSVarint(),1===s&&h>c&&(n.push(h),c=h),i.push(a,l),h+=2;else{if(7!==s)throw new Error("Invalid command found in the PBF");h>c&&(i.push(i[c],i[c+1]),h+=2)}}h>c&&(n.push(h),c=h)}createFeature_(t,e,i){const n=e.type;if(0===n)return null;let r;const s=e.properties;let o;this.idProperty_?(o=s[this.idProperty_],delete s[this.idProperty_]):o=e.id,s[this.layerName_]=e.layer.name;const a=[],l=[];this.readRawGeometry_(t,e,a,l);const h=function(t,e){let i;return 1===t?i=1===e?"Point":"MultiPoint":2===t?i=1===e?"LineString":"MultiLineString":3===t&&(i="Polygon"),i}(n,l.length);if(this.featureClass===Xi)r=new this.featureClass(h,a,l,2,s,o),r.transform(i.dataProjection);else{let t;if("Polygon"==h){const e=xi(a,l);t=e.length>1?new Jh(a,"XY",e):new Sl(a,"XY",l)}else t="Point"===h?new xl(a,"XY"):"LineString"===h?new Vh(a,"XY"):"MultiPoint"===h?new qh(a,"XY"):"MultiLineString"===h?new Kh(a,"XY",l):null;r=new(0,this.featureClass),this.geometryName_&&r.setGeometryName(this.geometryName_);const e=tc(t,!1,i);r.setGeometry(e),void 0!==o&&r.setId(o),r.setProperties(s,!0)}return r}getType(){return"arraybuffer"}readFeatures(t,e){const i=this.layers_,n=Ge((e=this.adaptOptions(e)).dataProjection);n.setWorldExtent(e.extent),e.dataProjection=n;const r=new cc(t),s=r.readFields(dc,{}),o=[];for(const t in s){if(i&&!i.includes(t))continue;const a=s[t],l=a?[0,0,a.extent,a.extent]:null;n.setExtent(l);for(let t=0,i=a.length;t<i;++t){const i=pc(r,a,t),n=this.createFeature_(r,i,e);null!==n&&o.push(n)}}return o}readProjection(t){return this.dataProjection}setLayers(t){this.layers_=t}},mc=i(619),yc=function(t,e){if(t.hasStroke)return new xa({color:(0,r.o)(t.style.stroke,e),width:t.style.strokeWidth,lineDash:t.style.strokeDashArray})};function xc(t){return xc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xc(t)}function vc(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function Sc(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?vc(Object(i),!0).forEach(function(e){wc(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):vc(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function wc(t,e,i){return(e=function(t){var e=function(t){if("object"!=xc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=xc(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==xc(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var Cc="EPSG:27700",bc=new class extends sc{constructor(t){t=t||{},super(),this.dataProjection=Ge(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=Ge(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 n=oc(i.geometry);if(this.featureClass===Xi)return ic({geometry:n,id:i.id,properties:i.properties},e);const r=new(0,this.featureClass);return this.geometryName_?r.setGeometryName(this.geometryName_):this.extractGeometryName_&&i.geometry_name&&r.setGeometryName(i.geometry_name),r.setGeometry(nc(n,e)),"id"in i&&r.setId(i.id),i.properties&&r.setProperties(i.properties,!0),r}readFeaturesFromObject(t,e){let i=null;if("FeatureCollection"===t.type){i=[];const n=t.features;for(let t=0,r=n.length;t<r;++t){const r=this.readFeatureFromObject(n[t],e);r&&i.push(r)}}else i=[this.readFeatureFromObject(t,e)];return i.flat()}readGeometryFromObject(t,e){return function(t,e){return nc(oc(t),e)}(t,e)}readProjectionFromObject(t){const e=t.crs;let i;if(e)if("name"==e.type)i=Ge(e.properties.name);else{if("EPSG"!==e.type)throw new Error("Unknown SRS type");i=Ge("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},n=t.getId();if(void 0!==n&&(i.id=n),!t.hasProperties())return i;const r=t.getProperties(),s=t.getGeometry();return s&&(i.geometry=ac(s,e),delete r[t.getGeometryName()]),x(r)||(i.properties=r),i}writeFeaturesObject(t,e){e=this.adaptOptions(e);const i=[];for(let n=0,r=t.length;n<r;++n)i.push(this.writeFeatureObject(t[n],e));return{type:"FeatureCollection",features:i}}writeGeometryObject(t,e){return ac(t,this.adaptOptions(e))}}({dataProjection:Cc,featureProjection:Cc}),Rc=1e-6,Tc=13e5,Ec=[0,0,Tc,Tc],Ic=new ih({extent:Ec,origin:[Ec[0],Ec[3]],resolutions:Array.from({length:25},function(t,e){return(Ec[2]-Ec[0])/(256*Math.pow(2,e))}),tileSize:256}),Mc=function(t,e){if(!e)return bc.readFeatures(t);var i=Sc(Sc({},t),{},{features:t.features.map(function(t){var i,n;return Sc(Sc({},t),{},{id:null!==(i=null===(n=t.properties)||void 0===n?void 0:n[e])&&void 0!==i?i:t.id})})});return bc.readFeatures(i)},Pc=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.hasPattern?function(t,e){var i=e.mapStyleId,n=e.pixelRatio,r=e.patternRegistry,s=e.getPatternFill,o=e.buildFilterEvaluator,a=r.getPatternImageId(t.style,i,n),l=a&&s(a),h=l?new ba({fill:l,stroke:yc(t,i)}):void 0,c=o(t.filter);return function(t){if(h&&(!c||c(t)))return h}}(t,e):t.getFlatStyle(e)};function Fc(t){return Fc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fc(t)}function Oc(){var t,e,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",r=i.toStringTag||"@@toStringTag";function s(i,n,r,s){var l=n&&n.prototype instanceof a?n:a,h=Object.create(l.prototype);return kc(h,"_invoke",function(i,n,r){var s,a,l,h=0,c=r||[],u=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return s=e,a=0,l=t,d.n=i,o}};function f(i,n){for(a=i,l=n,e=0;!u&&h&&!r&&e<c.length;e++){var r,s=c[e],f=d.p,g=s[2];i>3?(r=g===n)&&(l=s[(a=s[4])?5:(a=3,3)],s[4]=s[5]=t):s[0]<=f&&((r=i<2&&f<s[1])?(a=0,d.v=n,d.n=s[1]):f<g&&(r=i<3||s[0]>n||n>g)&&(s[4]=i,s[5]=n,d.n=g,a=0))}if(r||i>1)return o;throw u=!0,n}return function(r,c,g){if(h>1)throw TypeError("Generator is already running");for(u&&1===c&&f(c,g),a=c,l=g;(e=a<2?t:l)||!u;){s||(a?a<3?(a>1&&(d.n=-1),f(a,l)):d.n=l:d.v=l);try{if(h=2,s){if(a||(r="next"),e=s[r]){if(!(e=e.call(s,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,a<2&&(a=0)}else 1===a&&(e=s.return)&&e.call(s),a<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),a=1);s=t}else if((e=(u=d.n<0)?l:i.call(n,d))!==o)break}catch(e){s=t,a=1,l=e}finally{h=1}}return{value:e,done:u}}}(i,r,s),!0),h}var o={};function a(){}function l(){}function h(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(kc(e={},n,function(){return this}),e),u=h.prototype=a.prototype=Object.create(c);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,kc(t,r,"GeneratorFunction")),t.prototype=Object.create(u),t}return l.prototype=h,kc(u,"constructor",h),kc(h,"constructor",l),l.displayName="GeneratorFunction",kc(h,r,"GeneratorFunction"),kc(u),kc(u,r,"Generator"),kc(u,n,function(){return this}),kc(u,"toString",function(){return"[object Generator]"}),(Oc=function(){return{w:s,m:d}})()}function kc(t,e,i,n){var r=Object.defineProperty;try{r({},"",{})}catch(t){r=0}kc=function(t,e,i,n){function s(e,i){kc(t,e,function(t){return this._invoke(e,i,t)})}e?r?r(t,e,{value:i,enumerable:!n,configurable:!n,writable:!n}):t[e]=i:(s("next",0),s("throw",1),s("return",2))},kc(t,e,i,n)}function Ac(t,e,i,n,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,r)}function Lc(t){return function(){var e=this,i=arguments;return new Promise(function(n,r){var s=t.apply(e,i);function o(t){Ac(s,n,r,o,a,"next",t)}function a(t){Ac(s,n,r,o,a,"throw",t)}o(void 0)})}}function Dc(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,jc(n.key),n)}}function jc(t){var e=function(t){if("object"!=Fc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=Fc(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Fc(e)?e:e+""}function Gc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Gc=function(){return!!t})()}function Wc(t){return Wc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wc(t)}function Xc(t,e){return Xc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Xc(t,e)}var zc=function(t){function e(t,i,n,r){var s;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(s=function(t,e,i){return e=Wc(e),function(t,e){if(e&&("object"==Fc(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Gc()?Reflect.construct(e,i||[],Wc(t).constructor):e.apply(t,i))}(this,e,[t,i,n,r]))._sourcesById=new Map,s._layersById=new Map,s.createDataset=s.createDataset.bind(s),s}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Xc(t,e)}(e,t),i=e,n=[{key:"createDataset",value:function(t,e){return new f(t,e)}},{key:"_styleContext",get:function(){var t,e=this;return{mapStyleId:null===(t=this._datasetRegistry.mapStyle)||void 0===t?void 0:t.id,pixelRatio:this._pixelRatio,patternRegistry:this._patternRegistry,symbolRegistry:this._symbolRegistry,getSymbolDataUri:function(t){return e._mapProvider.getSymbolDataUri(t)},getPatternFill:function(t){return e._mapProvider.getPatternFill(t)},buildFilterEvaluator:function(t){return e._mapProvider.buildFilterEvaluator(t)}}}},{key:"init",value:(h=Lc(Oc().m(function t(){var e=this;return Oc().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,Promise.all([this._registerPatterns(),this._registerSymbols()]);case 1:this._datasetRegistry.forEachDataset(function(t){return e._addLayers(t)});case 2:return t.a(2)}},t,this)})),function(){return h.apply(this,arguments)})},{key:"destroy",value:function(){var t=this;this._layersById.forEach(function(e){return t._map.removeLayer(e)}),this._layersById.clear(),this._sourcesById.clear()}},{key:"onMapStyleChange",value:(l=Lc(Oc().m(function t(){var e=this;return Oc().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,Promise.all([this._registerPatterns(),this._registerSymbols()]);case 1:this._datasetRegistry.forEachDataset(function(t){return e._forEachLeafDataset(t,function(t){e._setLayerStyle(t)})}),this._reapplyHighlights();case 2:return t.a(2)}},t,this)})),function(){return l.apply(this,arguments)})},{key:"onMapSizeChange",value:(a=Lc(Oc().m(function t(){var e,i=this;return Oc().w(function(t){for(;;)switch(t.n){case 0:return e=this._pixelRatio,t.n=1,Promise.all([this._registerPatterns(),this._registerSymbols()]);case 1:if(this._pixelRatio===e){t.n=2;break}return t.a(2);case 2:this._datasetRegistry.forEachDataset(function(t){return i._forEachLeafDataset(t,function(t){(t.hasPattern||t.hasSymbol)&&i._setLayerStyle(t)})}),this._reapplyHighlights();case 3:return t.a(2)}},t,this)})),function(){return a.apply(this,arguments)})},{key:"_reapplyHighlights",value:function(){this._mapProvider.reapplyHighlights()}},{key:"_registerPatternsAndSymbols",value:function(t){return Promise.all([this._registerPatterns([t]),this._registerSymbols([t])])}},{key:"removeDataset",value:function(t){var e=this,i=this._datasetRegistry.getDataset(t);if(i){i.layerIds.forEach(function(t){var i=e._layersById.get(t);i&&(e._map.removeLayer(i),e._layersById.delete(t))});var n=i.sourceId;this._datasetRegistry.topLevelDatasets().some(function(e){return e.id!==t&&e.sourceId===n})||this._sourcesById.delete(n)}}},{key:"applyStyle",value:(o=Lc(Oc().m(function t(e){var i,n=this;return Oc().w(function(t){for(;;)switch(t.n){case 0:if(i=this._datasetRegistry.getDataset(e)){t.n=1;break}return t.a(2);case 1:return t.n=2,this._registerPatternsAndSymbols(i);case 2:this._forEachLeafDataset(i,function(t){n._layersById.has(t.id)?n._setLayerStyle(t):n._addLayers(t)});case 3:return t.a(2)}},t,this)})),function(t){return o.apply(this,arguments)})},{key:"_setLayerOpacity",value:function(t,e){var i;null===(i=this._layersById.get(t))||void 0===i||i.setOpacity(e)}},{key:"_setLayerVisibility",value:function(t,e){var i;null===(i=this._layersById.get(t))||void 0===i||i.setVisible("visible"===e)}},{key:"applyFeatureFilter",value:function(t){var e=this,i=this._datasetRegistry.getDataset(t);i&&this._forEachLeafDataset(i,function(t){e._setLayerStyle(t)})}},{key:"setData",value:function(t,e){var i,n=this._datasetRegistry.getDataset(t),r=n&&this._sourcesById.get(n.sourceId);r&&(r.clear(),null!=e&&null!==(i=e.features)&&void 0!==i&&i.length&&r.addFeatures(Mc(e,n.idStrategy)))}},{key:"_registerPatterns",value:(s=Lc(Oc().m(function t(){var e,i,n,r=this,s=arguments;return Oc().w(function(t){for(;;)switch(t.n){case 0:if(e=s.length>0&&void 0!==s[0]?s[0]:this._datasetRegistry.topLevelDatasets(),i=[],e.forEach(function(t){return r._forEachLeafDataset(t,function(t){t.hasPattern&&i.push(t.style)})}),!i.length){t.n=1;break}return t.n=1,this._mapProvider.addPatternsToMap(i,null===(n=this._datasetRegistry.mapStyle)||void 0===n?void 0:n.id,this._patternRegistry,this._pixelRatio);case 1:return t.a(2)}},t,this)})),function(){return s.apply(this,arguments)})},{key:"_registerSymbols",value:(r=Lc(Oc().m(function t(){var e,i,n=this,r=arguments;return Oc().w(function(t){for(;;)switch(t.n){case 0:if(e=r.length>0&&void 0!==r[0]?r[0]:this._datasetRegistry.topLevelDatasets(),i=[],e.forEach(function(t){return n._forEachLeafDataset(t,function(t){t.hasSymbol&&i.push(t.style)})}),!i.length){t.n=1;break}return t.n=1,this._mapProvider.addSymbolsToMap(i,this._datasetRegistry.mapStyle,this._symbolRegistry,this._pixelRatio);case 1:return t.a(2)}},t,this)})),function(){return r.apply(this,arguments)})},{key:"_setLayerStyle",value:function(t){var e=this._layersById.get(t.id);if(e)try{e.setStyle(Pc(t,this._styleContext)),t.hasSymbol&&e.set("symbolMeta",t.getSymbolMeta(this._styleContext))}catch(e){mc.v.warn('OpenLayers datasets adapter: failed to build a style for dataset "'.concat(t.id,'" — ').concat(e.message))}}},{key:"_forEachLeafDataset",value:function(t,e){var i=this;t.hasSublayers?t.sublayers.forEach(function(t){return i._forEachLeafDataset(t,e)}):e(t)}},{key:"_getOrCreateSource",value:function(t){var e,i=t.sourceId;if(this._sourcesById.has(i))return this._sourcesById.get(i);try{e=function(t){var e=t.source,i=t.id,n=t.idStrategy;if(!e)return null;if("geojson"===e.type){var r,s=new dn;return"string"==typeof e.data?function(t,e,i,n){fetch(e).then(function(t){if(!t.ok)throw new Error("".concat(t.status," ").concat(t.statusText));return t.json()}).then(function(e){return t.addFeatures(Mc(e,i))}).catch(function(t){return mc.v.warn('OpenLayers datasets adapter: failed to fetch geojson for dataset "'.concat(n,'" — ').concat(t.message))})}(s,e.data,n,i):null!==(r=e.data)&&void 0!==r&&null!==(r=r.features)&&void 0!==r&&r.length&&s.addFeatures(Mc(e.data,n)),s}if("vector"===e.type){var o=Array.isArray(e.tiles)?e.tiles:[e.tiles];return new ph({format:new _c({featureClass:zh,idProperty:n||void 0}),urls:o,projection:Cc,tileGrid:Ic})}return mc.v.warn('OpenLayers datasets adapter: unsupported source type "'.concat(e.type,'" (dataset "').concat(i,'")')),null}(t)}catch(e){return mc.v.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}},{key:"_addLayers",value:function(t){var e=this;if(t.hasSublayers)return this._getOrCreateSource(t),void t.sublayers.forEach(function(t){return e._addLayers(t)});if(t.leafLayerIds.length){var i=this._getOrCreateSource(t);if(i){var n;try{n=function(t,e,i){var n,r,s=e instanceof ph,o=new(s?Wh:Zl)(Sc({source:e,style:Pc(t,i),opacity:t.opacity,visible:"visible"===t.visibility,minZoom:(r=t.minZoom,void 0===r?void 0:r-Rc),maxZoom:(n=t.maxZoom,void 0===n?void 0:n-Rc),zIndex:t.hasSymbol?1:0},s?{renderMode:"vector"}:{}));return o.set("layerType",s?"vectorTile":"vector"),o.set("layerId",t.id),t.filter&&o.set("filter",t.filter),t.hasSymbol&&o.set("symbolMeta",t.getSymbolMeta(i)),o}(t,i,this._styleContext)}catch(e){return void mc.v.warn('OpenLayers datasets adapter: failed to build a style for dataset "'.concat(t.id,'" — ').concat(e.message))}this._map.addLayer(n),this._layersById.set(t.id,n)}}}}],n&&Dc(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,n,r,s,o,a,l,h}(g.h)},416:function(t,e,i){i.d(e,{f:function(){return f}});var n=i(428);function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}var s=function(t){var e,i=0,n=2166136261,s=function(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return r(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?r(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,s=function(){};return{s:s,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return a=t.done,t},e:function(t){l=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(l)throw o}}}}(t);try{for(s.s();!(e=s.n()).done;){var o=e.value.codePointAt(0);i=Math.imul(i,31)+o,n=Math.imul(n^o,16777619)}}catch(t){s.e(t)}finally{s.f()}return(i>>>0).toString(36)+(n>>>0).toString(36)};function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function l(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,h(n.key),n)}}function h(t){var e=function(t){if("object"!=o(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=o(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==o(e)?e:e+""}function c(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(c=function(){return!!t})()}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}function d(t,e){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},d(t,e)}var f=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,i){return e=u(e),function(t,e){if(e&&("object"==o(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,c()?Reflect.construct(e,i||[],u(t).constructor):e.apply(t,i))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e)}(e,t),i=e,n=[{key:"_hiddenFeaturesIdExpression",get:function(){return this.hasDynamicGeoJSON?this.dynamicGeoJSON.hiddenFeaturesIdExpression:this.idProperty?["to-string",["get",this.idProperty]]:["to-string",["id"]]}},{key:"_hiddenFeaturesFilter",get:function(){var t,e=null===(t=this.hiddenFeatures)||void 0===t?void 0:t.filter(function(t){return-1!==t});return null!=e&&e.length?["!",["in",this._hiddenFeaturesIdExpression,["literal",e.map(String)]]]:null}},{key:"filter",get:function(){var t,e=["all"];null!==(t=this.parent)&&void 0!==t&&t.filter&&e.push(this.parent.filter),this._datasetDefinition.filter&&e.push(this._datasetDefinition.filter);var i=this._hiddenFeaturesFilter;return i&&e.push(i),1===e.length?null:e.length>2?e:e[1]}},{key:"leafLayerIds",get:function(){return[]}},{key:"layerIds",get:function(){return this.hasSublayers?this.sublayers.flatMap(function(t){return t.layerIds}).filter(Boolean):this.leafLayerIds}},{key:"getLayersWithValue",value:function(t){var e,i,n,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=[];if(!1===r||this[r]){var o=this.leafLayerIds;if(o.length){var l=this[t];s.push((e={layerIds:o},n=l,(i=h(i=t))in e?Object.defineProperty(e,i,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[i]=n,e))}}return this.hasSublayers&&this.sublayers.forEach(function(e){if(!1===r||e[r]){var i=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return a(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?a(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(e.getLayersWithValue(t),1)[0];i&&s.push(i)}}),s}},{key:"getLayersWithVisibility",value:function(){return this.getLayersWithValue("visibility")}},{key:"getLayersWithOpacity",value:function(){return this.getLayersWithValue("opacity")}},{key:"getLayersWithFilters",value:function(){return this.getLayersWithValue("filter","hasHiddenFeatures")}},{key:"sourceId",get:function(){if(this.isSublayer)return this.parent.sourceId;if(this.hasDynamicGeoJSON)return this.dynamicGeoJSON.sourceId;if(this.tiles){var t=Array.isArray(this.tiles)?this.tiles.join(","):this.tiles;return"tiles-".concat(s(t))}return this.geojson?"string"==typeof this.geojson?"geojson-".concat(s(this.geojson)):"geojson-".concat(this.id):"source-".concat(this.id)}}],n&&l(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,n}(n.j)},247:function(t,e,i){function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}i.d(e,{o:function(){return r}});var r=function(t,e){if("number"==typeof t)return t;if(!t)return null;if("string"==typeof t)return t.trim();if("object"===n(t)){if(e&&null!=t[e])return t[e];var i=Object.values(t)[0];return null!=i?i:null}return null}}}]);