@defra/interactive-map 0.0.22-alpha → 0.0.24-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 (242) hide show
  1. package/assets/images/light-raster-thumb.jpg +0 -0
  2. package/assets/images/outdoor-raster-thumb.jpg +0 -0
  3. package/assets/images/road-raster-thumb.jpg +0 -0
  4. package/dist/css/index.css +1 -1
  5. package/dist/esm/im-core.js +1 -1
  6. package/dist/esm/im-shell.js +1 -1
  7. package/dist/umd/im-core.js +1 -1
  8. package/dist/umd/index.js +1 -1
  9. package/docs/api/button-definition.md +39 -0
  10. package/docs/api/context.md +4 -4
  11. package/docs/api/map-style-config.md +11 -2
  12. package/docs/api/marker-config.md +38 -7
  13. package/docs/api/panel-definition.md +7 -3
  14. package/docs/api/symbol-config.md +10 -26
  15. package/docs/api/symbol-registry.md +28 -13
  16. package/docs/api.md +24 -2
  17. package/docs/assets/css/{docusaurus.css → docusaurus.scss} +18 -12
  18. package/docs/assets/images/toggle-marker-label.jpg +0 -0
  19. package/docs/examples/index.mdx +12 -0
  20. package/docs/examples/toggle-marker-label.mdx +89 -0
  21. package/docs/plugins/interact.md +4 -11
  22. package/docs/plugins/search.md +70 -0
  23. package/docusaurus.config.cjs +2 -1
  24. package/package.json +23 -9
  25. package/plugins/beta/datasets/dist/adapters/maplibre/esm/im-datasets-ml-adapter.js +1 -1
  26. package/plugins/beta/datasets/dist/css/index.css +2 -2
  27. package/plugins/beta/datasets/dist/esm/im-datasets-plugin.js +1 -1
  28. package/plugins/beta/datasets/dist/umd/maplibre/im-datasets-maplibre-adapter.js +1 -1
  29. package/plugins/beta/datasets/dist/umd/maplibre/im-datasets-plugin.js +1 -1
  30. package/plugins/beta/datasets/dist/umd/maplibre/index.js +1 -1
  31. package/plugins/beta/datasets/src/adapters/maplibre/layerBuilders.js +5 -5
  32. package/plugins/beta/datasets/src/adapters/maplibre/maplibreLayerAdapter.js +24 -29
  33. package/plugins/beta/datasets/src/adapters/maplibre/patternImages.js +2 -2
  34. package/plugins/beta/datasets/src/adapters/maplibre/symbolImages.js +3 -3
  35. package/plugins/beta/datasets/src/components/KeySvg.jsx +2 -2
  36. package/plugins/beta/datasets/src/components/KeySvgPattern.jsx +1 -2
  37. package/plugins/beta/datasets/src/components/svgProperties.js +2 -2
  38. package/plugins/beta/datasets/src/panels/Key.module.scss +2 -2
  39. package/plugins/beta/draw-es/dist/esm/im-draw-es-plugin.js +1 -1
  40. package/plugins/beta/draw-ml/dist/css/index.css +1 -21
  41. package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +1 -1
  42. package/plugins/beta/draw-ml/dist/umd/im-draw-ml-plugin.js +1 -1
  43. package/plugins/beta/draw-ml/src/api/editFeature.js +9 -4
  44. package/plugins/beta/draw-ml/src/modes/createDrawMode.js +11 -3
  45. package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +1 -1
  46. package/plugins/beta/map-styles/dist/umd/im-map-styles-plugin.js +1 -1
  47. package/plugins/beta/map-styles/dist/umd/index.js +1 -1
  48. package/plugins/beta/use-location/dist/esm/im-use-location-plugin.js +1 -1
  49. package/plugins/beta/use-location/dist/umd/im-use-location-plugin.js +1 -1
  50. package/plugins/beta/use-location/src/manifest.js +1 -0
  51. package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
  52. package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
  53. package/plugins/interact/dist/umd/index.js +1 -1
  54. package/plugins/interact/src/InteractInit.jsx +23 -55
  55. package/plugins/interact/src/InteractInit.test.js +58 -80
  56. package/plugins/interact/src/defaults.js +1 -3
  57. package/plugins/interact/src/hooks/useAttachEvents.js +46 -0
  58. package/plugins/interact/src/hooks/useAttachEvents.test.js +68 -0
  59. package/plugins/interact/src/hooks/useCrossHairVisibility.js +47 -0
  60. package/plugins/interact/src/hooks/useCrossHairVisibility.test.js +54 -0
  61. package/plugins/interact/src/hooks/useHighlightSync.js +30 -8
  62. package/plugins/interact/src/hooks/useHighlightSync.test.js +127 -80
  63. package/plugins/interact/src/hooks/useInteractionHandlers.js +18 -17
  64. package/plugins/interact/src/hooks/useInteractionHandlers.test.js +22 -61
  65. package/plugins/interact/src/hooks/useMapItemList.js +187 -0
  66. package/plugins/interact/src/hooks/useMapItemList.test.js +584 -0
  67. package/plugins/interact/src/index.js +0 -2
  68. package/plugins/interact/src/index.test.js +0 -2
  69. package/plugins/interact/src/manifest.js +37 -6
  70. package/plugins/interact/src/reducer.js +8 -4
  71. package/plugins/interact/src/reducer.test.js +18 -3
  72. package/plugins/interact/src/utils/buildStylesMap.js +21 -10
  73. package/plugins/interact/src/utils/buildStylesMap.test.js +29 -29
  74. package/plugins/interact/src/utils/spatial.js +0 -15
  75. package/plugins/interact/src/utils/spatial.test.js +1 -13
  76. package/plugins/search/dist/css/index.css +1 -1
  77. package/plugins/search/dist/esm/im-search-plugin.js +1 -1
  78. package/plugins/search/dist/esm/index.js +1 -1
  79. package/plugins/search/dist/umd/im-search-plugin.js +1 -1
  80. package/plugins/search/dist/umd/index.js +1 -1
  81. package/plugins/search/src/Search.jsx +2 -1
  82. package/plugins/search/src/components/CloseButton/CloseButton.module.scss +2 -0
  83. package/plugins/search/src/components/Form/Form.jsx +11 -7
  84. package/plugins/search/src/components/Form/Form.test.jsx +23 -1
  85. package/plugins/search/src/components/OpenButton/OpenButton.jsx +1 -1
  86. package/plugins/search/src/components/OpenButton/OpenButton.module.scss +3 -0
  87. package/plugins/search/src/datasets.js +2 -2
  88. package/plugins/search/src/datasets.test.js +1 -1
  89. package/plugins/search/src/defaults.js +7 -1
  90. package/plugins/search/src/events/fetchSuggestions.js +13 -10
  91. package/plugins/search/src/events/fetchSuggestions.test.js +14 -1
  92. package/plugins/search/src/events/formHandlers.js +2 -4
  93. package/plugins/search/src/events/formHandlers.test.js +3 -3
  94. package/plugins/search/src/events/inputHandlers.js +1 -1
  95. package/plugins/search/src/events/inputHandlers.test.js +1 -1
  96. package/plugins/search/src/events/suggestionHandlers.js +2 -1
  97. package/plugins/search/src/events/suggestionHandlers.test.js +7 -1
  98. package/plugins/search/src/index.js +3 -7
  99. package/plugins/search/src/reducer.js +10 -5
  100. package/plugins/search/src/reducer.test.js +2 -1
  101. package/plugins/search/src/search.scss +1 -0
  102. package/plugins/search/src/utils/parseOsNamesResults.js +3 -3
  103. package/providers/beta/esri/dist/esm/im-esri-provider.js +1 -1
  104. package/providers/beta/esri/src/esriProvider.js +4 -0
  105. package/providers/beta/openlayers/dist/esm/im-openlayers-provider.js +1 -0
  106. package/providers/beta/openlayers/dist/esm/index.js +1 -0
  107. package/providers/beta/openlayers/dist/umd/im-openlayers-provider.js +2 -0
  108. package/providers/beta/openlayers/dist/umd/im-openlayers-provider.js.LICENSE.txt +1 -0
  109. package/providers/beta/openlayers/dist/umd/index.js +2 -0
  110. package/providers/beta/openlayers/dist/umd/index.js.LICENSE.txt +1 -0
  111. package/providers/beta/openlayers/src/appEvents.js +50 -0
  112. package/providers/beta/openlayers/src/appEvents.test.js +140 -0
  113. package/providers/beta/openlayers/src/defaults.js +36 -0
  114. package/providers/beta/openlayers/src/index.js +21 -0
  115. package/providers/beta/openlayers/src/mapEvents.js +132 -0
  116. package/providers/beta/openlayers/src/mapEvents.test.js +197 -0
  117. package/providers/beta/openlayers/src/openlayersProvider.js +234 -0
  118. package/providers/beta/openlayers/src/openlayersProvider.test.js +331 -0
  119. package/providers/beta/openlayers/src/utils/spatial.js +142 -0
  120. package/providers/beta/openlayers/src/utils/spatial.test.js +117 -0
  121. package/providers/beta/openlayers/src/utils/zoom.js +26 -0
  122. package/providers/beta/openlayers/src/utils/zoom.test.js +23 -0
  123. package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
  124. package/providers/maplibre/dist/esm/index.js +1 -1
  125. package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
  126. package/providers/maplibre/dist/umd/index.js +1 -1
  127. package/providers/maplibre/src/index.js +1 -1
  128. package/providers/maplibre/src/index.test.js +9 -14
  129. package/providers/maplibre/src/mapEvents.js +11 -5
  130. package/providers/maplibre/src/mapEvents.test.js +14 -3
  131. package/providers/maplibre/src/maplibreProvider.js +18 -11
  132. package/providers/maplibre/src/maplibreProvider.test.js +43 -36
  133. package/providers/maplibre/src/utils/highlightFeatures.js +112 -57
  134. package/providers/maplibre/src/utils/highlightFeatures.test.js +179 -51
  135. package/providers/maplibre/src/utils/maplibreFixes.js +10 -0
  136. package/providers/maplibre/src/utils/maplibreFixes.test.js +31 -0
  137. package/providers/maplibre/src/utils/patternImages.js +22 -19
  138. package/providers/maplibre/src/utils/patternImages.test.js +146 -167
  139. package/providers/maplibre/src/utils/rasteriseToImageData.js +1 -4
  140. package/providers/maplibre/src/utils/rasteriseToImageData.test.js +23 -24
  141. package/providers/maplibre/src/utils/symbolImages.js +23 -86
  142. package/providers/maplibre/src/utils/symbolImages.test.js +60 -105
  143. package/rollup.esm.mjs +14 -3
  144. package/src/App/components/Actions/Actions.module.scss +1 -0
  145. package/src/App/components/Actions/Actions.test.jsx +17 -4
  146. package/src/App/components/Hints/Hints.jsx +52 -0
  147. package/src/App/components/Hints/Hints.module.scss +37 -0
  148. package/src/App/components/Hints/Hints.test.jsx +104 -0
  149. package/src/App/components/KeyboardHelp/KeyboardHelp.jsx +57 -19
  150. package/src/App/components/KeyboardHelp/KeyboardHelp.module.scss +10 -0
  151. package/src/App/components/KeyboardHelp/KeyboardHelp.test.jsx +140 -31
  152. package/src/App/components/Markers/LabelMarker.jsx +14 -0
  153. package/src/App/components/Markers/LabelMarker.test.jsx +36 -0
  154. package/src/App/components/Markers/Markers.jsx +44 -75
  155. package/src/App/components/Markers/Markers.module.scss +58 -0
  156. package/src/App/components/Markers/Markers.test.jsx +90 -113
  157. package/src/App/components/Markers/SymbolLabelMarker.jsx +43 -0
  158. package/src/App/components/Markers/SymbolLabelMarker.test.jsx +56 -0
  159. package/src/App/components/Markers/SymbolMarker.jsx +31 -0
  160. package/src/App/components/Markers/SymbolMarker.test.jsx +72 -0
  161. package/src/App/components/Panel/Panel.jsx +1 -1
  162. package/src/App/components/Panel/Panel.module.scss +1 -0
  163. package/src/App/components/PopupMenu/PopupMenu.test.jsx +117 -1
  164. package/src/App/components/PopupMenu/usePopupMenu.js +132 -85
  165. package/src/App/components/Tabs/Tabs.jsx +68 -0
  166. package/src/App/components/Tabs/Tabs.module.scss +57 -0
  167. package/src/App/components/Tabs/Tabs.test.jsx +121 -0
  168. package/src/App/components/Tooltip/Tooltip.module.scss +1 -1
  169. package/src/App/components/Viewport/Features.jsx +35 -0
  170. package/src/App/components/Viewport/Features.module.scss +31 -0
  171. package/src/App/components/Viewport/Features.test.jsx +124 -0
  172. package/src/App/components/Viewport/MapStatus.jsx +0 -4
  173. package/src/App/components/Viewport/Viewport.jsx +35 -29
  174. package/src/App/components/Viewport/Viewport.module.scss +7 -21
  175. package/src/App/components/Viewport/Viewport.test.jsx +108 -65
  176. package/src/App/controls/keyboardActions.js +9 -3
  177. package/src/App/controls/keyboardActions.test.js +122 -87
  178. package/src/App/controls/keyboardShortcuts.js +1 -14
  179. package/src/App/hooks/useFeatureFocus.js +199 -0
  180. package/src/App/hooks/useFeatureFocus.test.js +635 -0
  181. package/src/App/hooks/useFeatureItems.js +30 -0
  182. package/src/App/hooks/useFeatureItems.test.js +98 -0
  183. package/src/App/hooks/useFocusVisible.js +4 -7
  184. package/src/App/hooks/useFocusVisible.test.js +6 -6
  185. package/src/App/hooks/useKeyboardHint.js +9 -34
  186. package/src/App/hooks/useKeyboardHint.test.js +34 -84
  187. package/src/App/hooks/useKeyboardShortcuts.js +8 -5
  188. package/src/App/hooks/useKeyboardShortcuts.test.js +16 -12
  189. package/src/App/hooks/useLayoutMeasurements.js +10 -4
  190. package/src/App/hooks/useLayoutMeasurements.test.js +30 -1
  191. package/src/App/hooks/useMarkerCursor.js +33 -0
  192. package/src/App/hooks/useMarkerCursor.test.js +87 -0
  193. package/src/App/hooks/useMarkersAPI.js +32 -9
  194. package/src/App/hooks/useMarkersAPI.test.js +163 -94
  195. package/src/App/hooks/useModalPanelBehaviour.test.js +2 -1
  196. package/src/App/layout/Layout.jsx +2 -0
  197. package/src/App/layout/Layout.test.jsx +3 -0
  198. package/src/App/registry/keyboardShortcutRegistry.js +3 -2
  199. package/src/App/registry/keyboardShortcutRegistry.test.js +6 -8
  200. package/src/App/renderer/mapButtons.js +5 -1
  201. package/src/App/renderer/mapButtons.test.js +37 -1
  202. package/src/App/store/AppProvider.test.jsx +5 -0
  203. package/src/App/store/MapProvider.test.jsx +8 -1
  204. package/src/App/store/ServiceProvider.jsx +4 -1
  205. package/src/App/store/ServiceProvider.test.jsx +11 -0
  206. package/src/App/store/appActionsMap.js +5 -1
  207. package/src/App/store/appActionsMap.test.js +13 -0
  208. package/src/App/store/appReducer.js +1 -0
  209. package/src/App/store/mapActionsMap.js +2 -1
  210. package/src/InteractiveMap/InteractiveMap.js +12 -0
  211. package/src/InteractiveMap/InteractiveMap.test.js +2 -0
  212. package/src/config/appConfig.js +3 -1
  213. package/src/config/appConfig.test.js +4 -0
  214. package/src/config/defaults.js +1 -1
  215. package/src/config/events.js +8 -0
  216. package/src/config/mapTheme.js +8 -4
  217. package/src/config/symbolConfig.js +23 -16
  218. package/src/scss/main.scss +3 -0
  219. package/src/scss/tools/_border-focus.scss +0 -1
  220. package/src/services/announcer.test.js +5 -7
  221. package/src/services/eventBus.js +15 -0
  222. package/src/services/eventBus.test.js +11 -0
  223. package/src/services/hints.js +47 -0
  224. package/src/services/hints.test.js +110 -0
  225. package/src/services/patternRegistry.js +69 -1
  226. package/src/services/patternRegistry.test.js +112 -1
  227. package/src/services/reverseGeocode.js +4 -0
  228. package/src/services/reverseGeocode.test.js +11 -1
  229. package/src/services/symbolRegistry.js +152 -17
  230. package/src/services/symbolRegistry.test.js +141 -31
  231. package/src/types.js +71 -14
  232. package/src/utils/constrainKeyboardFocus.js +5 -5
  233. package/src/utils/detectInterfaceType.js +27 -5
  234. package/src/utils/detectInterfaceType.test.js +29 -3
  235. package/src/utils/patternUtils.js +4 -67
  236. package/src/utils/patternUtils.test.js +1 -123
  237. package/src/utils/symbolUtils.js +11 -13
  238. package/src/utils/symbolUtils.test.js +18 -26
  239. package/webpack.dev.mjs +6 -1
  240. package/webpack.umd.mjs +1 -0
  241. package/plugins/interact/dist/css/index.css +0 -1
  242. package/plugins/interact/src/interact.scss +0 -24
@@ -0,0 +1,2 @@
1
+ /*! For license information please see im-openlayers-provider.js.LICENSE.txt */
2
+ "use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[142],{107(t,e,i){i.r(e),i.d(e,{default:()=>Od});const s="add",n="remove",r="propertychange";function o(t){for(const e in t)delete t[e]}function a(t){let e;for(e in t)return!1;return!e}function h(t,e,i,s,n){if(n){const n=i;i=function(r){return t.removeEventListener(e,i),n.call(s??this,r)}}else s&&s!==t&&(i=i.bind(s));const r={target:t,type:e,listener:i};return t.addEventListener(e,i),r}function l(t,e,i,s){return h(t,e,i,s,!0)}function c(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),o(t))}const u="change",d="contextmenu",g="click",f="keydown",_="keypress",p="touchmove",m="wheel",y=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function v(t,e){return t>e?1:t<e?-1:0}function M(t,e,i){if(t[0]<=e)return 0;const s=t.length;if(e<=t[s-1])return s-1;if("function"==typeof i){for(let n=1;n<s;++n){const s=t[n];if(s===e)return n;if(s<e)return i(e,t[n-1],s)>0?n-1:n}return s-1}if(i>0){for(let i=1;i<s;++i)if(t[i]<e)return i-1;return s-1}if(i<0){for(let i=1;i<s;++i)if(t[i]<=e)return i;return s-1}for(let i=1;i<s;++i){if(t[i]==e)return i;if(t[i]<e)return t[i-1]-e<e-t[i]?i-1:i}return s-1}function w(t,e){const i=t.length;if(i!==e.length)return!1;for(let s=0;s<i;s++)if(t[s]!==e[s])return!1;return!0}function x(){return!0}function E(){return!1}function S(){}const b=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},P=class extends y{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),s=i[t]||(i[t]=[]);s.includes(e)||s.push(e)}dispatchEvent(t){const e="string"==typeof t,i=e?t:t.type,s=this.listeners_&&this.listeners_[i];if(!s)return;const n=e?new b(t):t;n.target||(n.target=this.eventTarget_||this);const r=this.dispatching_||(this.dispatching_={}),o=this.pendingRemovals_||(this.pendingRemovals_={});let a;i in r||(r[i]=0,o[i]=0),++r[i];for(let t=0,e=s.length;t<e;++t)if(a="handleEvent"in s[t]?s[t].handleEvent(n):s[t].call(this,n),!1===a||n.propagationStopped){a=!1;break}if(0===--r[i]){let t=o[i];for(delete o[i];t--;)this.removeEventListener(i,S);delete r[i]}return a}disposeInternal(){this.listeners_&&o(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return!!this.listeners_&&(t?t in this.listeners_:Object.keys(this.listeners_).length>0)}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const s=i.indexOf(e);-1!==s&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[s]=S,++this.pendingRemovals_[t]):(i.splice(s,1),0===i.length&&delete this.listeners_[t]))}};class C extends P{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(u)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,s=new Array(i);for(let n=0;n<i;++n)s[n]=h(this,t[n],e);return s}return h(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const s=t.length;i=new Array(s);for(let n=0;n<s;++n)i[n]=l(this,t[n],e)}else i=l(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)c(t[e]);else c(t)}(i);else if(Array.isArray(t))for(let i=0,s=t.length;i<s;++i)this.removeEventListener(t[i],e);else this.removeEventListener(t,e)}}C.prototype.on,C.prototype.once,C.prototype.un;const R=C;function I(){throw new Error("Unimplemented abstract method.")}let G=0;function A(t){return t.ol_uid||(t.ol_uid=String(++G))}class T extends b{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}const O=class extends R{constructor(t){super(),this.on,this.once,this.un,A(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 T(i,t,e)),i=r,this.hasListener(i)&&this.dispatchEvent(new T(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const s=this.values_||(this.values_={});if(i)s[t]=e;else{const i=s[t];s[t]=e,i!==e&&this.notify(t,i)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],a(this.values_)&&(this.values_=null),e||this.notify(t,i)}}},L="length";class N extends b{constructor(t,e,i){super(t),this.element=e,this.index=i}}const k=class extends O{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t??[],this.unique_)for(let t=1,e=this.array_.length;t<e;++t)this.assertUnique_(this.array_[t],t);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let i=0,s=e.length;i<s;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(L)}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 N(s,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,s=e.length;i<s;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new N(n,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 N(n,i,t)),this.dispatchEvent(new N(s,e,t))}updateLength_(){this.set(L,this.array_.length)}assertUnique_(t,e){const i=this.array_;for(let s=0,n=i.length;s<n;++s)if(i[s]===t&&s!==e)throw new Error("Duplicate item added to a unique collection")}},F=class extends b{constructor(t,e,i){super(t),this.map=e,this.frameState=void 0!==i?i:null}},z=class extends F{constructor(t,e,i,s,n,r){super(t,e,n),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=void 0!==s&&s,this.activePointers=r}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}},D={SINGLECLICK:"singleclick",CLICK:g,DBLCLICK:"dblclick",POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},j="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",q=(j.includes("safari")&&!j.includes("chrom")&&(j.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(j)),j.includes("webkit")&&!j.includes("edge")),U=j.includes("macintosh"),B="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,K="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,X="undefined"!=typeof Image&&Image.prototype.decode,W=function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}return t}(),Z="pointerdown",V=class extends P{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=void 0===e?1:e,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=h(i,Z,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=h(i,"pointermove",this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(p,this.boundHandleTouchMove_,!!W&&{passive:!1})}emulateClick_(t){let e=new z(D.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new z(D.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const e=new z(D.SINGLECLICK,this.map_,t);this.dispatchEvent(e)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==D.POINTERUP||e.type==D.POINTERCANCEL){delete this.trackedTouches_[i];for(const t in this.trackedTouches_)if(this.trackedTouches_[t].target!==e.target){delete this.trackedTouches_[t];break}}else e.type!=D.POINTERDOWN&&e.type!=D.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new z(D.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),0===this.activePointers_.length&&(this.dragListenerKeys_.forEach(c),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return 0===t.button}handlePointerDown_(t){this.emulateClicks_=0===this.activePointers_.length,this.updateActivePointers_(t);const e=new z(D.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),0===this.dragListenerKeys_.length){const t=this.map_.getOwnerDocument();this.dragListenerKeys_.push(h(t,D.POINTERMOVE,this.handlePointerMove_,this),h(t,D.POINTERUP,this.handlePointerUp_,this),h(this.element_,D.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==t&&this.dragListenerKeys_.push(h(this.element_.getRootNode(),D.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new z(D.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!(!this.down_||!this.isMoving_(t));this.dispatchEvent(new z(D.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;e&&!e.defaultPrevented||"boolean"==typeof t.cancelable&&!0!==t.cancelable||t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(c(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(p,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(c(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(c),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},Y="postrender",H="loadstart",$="loadend",Q="layergroup",J="size",tt="target",et="view";function it(t,e){if(!t)throw new Error(e)}const st=1/0,nt=class{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,o(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const s=this.keyFunction_(i);return delete this.queuedElements_[s],i}enqueue(t){it(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=st&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(t){return 2*t+1}getRightChildIndex_(t){return 2*t+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return 0===this.elements_.length}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,s=e.length,n=e[t],r=i[t],o=t;for(;t<s>>1;){const n=this.getLeftChildIndex_(t),r=this.getRightChildIndex_(t),o=r<s&&i[r]<i[n]?r:n;e[t]=e[o],i[t]=i[o],t=o}e[t]=n,i[t]=r,this.siftDown_(o,t)}siftDown_(t,e){const i=this.elements_,s=this.priorities_,n=i[e],r=s[e];for(;e>t;){const t=this.getParentIndex_(e);if(!(s[t]>r))break;i[e]=i[t],s[e]=s[t],e=t}i[e]=n,s[e]=r}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let s=0;const n=e.length;let r,o,a;for(o=0;o<n;++o)r=e[o],a=t(r),a==st?delete this.queuedElements_[this.keyFunction_(r)]:(i[s]=a,e[s++]=r);e.length=s,i.length=s,this.heapify_()}},rt=class extends nt{constructor(t,e){super(e=>t.apply(null,e),t=>t[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);return e&&t[0].addEventListener(u,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(2===i||3===i||4===i){3!==i&&e.removeEventListener(u,this.boundHandleTileChange_);const t=e.getKey();t in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[t],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_<t&&i<e&&this.getCount()>0;){const t=this.dequeue()[0],e=t.getKey();0!==t.getState()||e in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[e]=!0,++this.tilesLoading_,++i,t.load())}}},ot={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function at(t,e,i){return Math.min(Math.max(t,e),i)}function ht(t,e,i,s,n,r){const o=n-i,a=r-s;if(0!==o||0!==a){const h=((t-i)*o+(e-s)*a)/(o*o+a*a);h>1?(i=n,s=r):h>0&&(i+=o*h,s+=a*h)}return lt(t,e,i,s)}function lt(t,e,i,s){const n=i-t,r=s-e;return n*n+r*r}function ct(t){return 180*t/Math.PI}function ut(t){return t*Math.PI/180}function dt(t,e){const i=t%e;return i*e<0?i+e:i}function gt(t,e,i){return t+i*(e-t)}function ft(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function _t(t,e){return Math.floor(ft(t,e))}function pt(t,e){return Math.ceil(ft(t,e))}function mt(t,e,i){if(t>=e&&t<i)return t;const s=i-e;return((t-e)%s+s)%s+e}function yt(t,e,i){return function(s,n,r,o,a){if(!s)return;if(!n&&!e)return s;const h=e?0:r[0]*n,l=e?0:r[1]*n,c=a?a[0]:0,u=a?a[1]:0;let d=t[0]+h/2+c,g=t[2]-h/2+c,f=t[1]+l/2+u,_=t[3]-l/2+u;d>g&&(d=(g+d)/2,g=d),f>_&&(f=(_+f)/2,_=f);let p=at(s[0],d,g),m=at(s[1],f,_);if(o&&i&&n){const t=30*n;p+=-t*Math.log(1+Math.max(0,d-s[0])/t)+t*Math.log(1+Math.max(0,s[0]-g)/t),m+=-t*Math.log(1+Math.max(0,f-s[1])/t)+t*Math.log(1+Math.max(0,s[1]-_)/t)}return[p,m]}}function vt(t){return t}function Mt(t){const e=[1/0,1/0,-1/0,-1/0];for(let i=0,s=t.length;i<s;++i)Rt(e,t[i]);return e}function wt(t,e,i){let s,n;return s=e<t[0]?t[0]-e:t[2]<e?e-t[2]:0,n=i<t[1]?t[1]-i:t[3]<i?i-t[3]:0,s*s+n*n}function xt(t,e){return Et(t,e[0],e[1])}function Et(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function St(t,e){const i=t[0],s=t[1],n=t[2],r=t[3],o=e[0],a=e[1];let h=0;return o<i?h|=16:o>n&&(h|=4),a<s?h|=8:a>r&&(h|=2),0===h&&(h=1),h}function bt(t,e,i,s,n){return n?(n[0]=t,n[1]=e,n[2]=i,n[3]=s,n):[t,e,i,s]}function Pt(t){return bt(1/0,1/0,-1/0,-1/0,t)}function Ct(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function Rt(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 It(t,e,i,s,n){for(;i<s;i+=n)Gt(t,e[i],e[i+1]);return t}function Gt(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 At(t,e){let i;return i=e(Ot(t)),i||(i=e(Lt(t)),i||(i=e(Ut(t)),i||(i=e(qt(t)),i||!1)))}function Tt(t){let e=0;return Xt(t)||(e=Bt(t)*Dt(t)),e}function Ot(t){return[t[0],t[1]]}function Lt(t){return[t[2],t[1]]}function Nt(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function kt(t,e){let i;if("bottom-left"===e)i=Ot(t);else if("bottom-right"===e)i=Lt(t);else if("top-left"===e)i=qt(t);else{if("top-right"!==e)throw new Error("Invalid corner");i=Ut(t)}return i}function Ft(t,e,i,s,n){const[r,o,a,h,l,c,u,d]=zt(t,e,i,s);return bt(Math.min(r,a,l,u),Math.min(o,h,c,d),Math.max(r,a,l,u),Math.max(o,h,c,d),n)}function zt(t,e,i,s){const n=e*s[0]/2,r=e*s[1]/2,o=Math.cos(i),a=Math.sin(i),h=n*o,l=n*a,c=r*o,u=r*a,d=t[0],g=t[1];return[d-h+u,g-l-c,d-h-u,g-l+c,d+h-u,g+l+c,d+h+u,g+l-c,d-h+u,g-l-c]}function Dt(t){return t[3]-t[1]}function jt(t,e,i){const s=i||[1/0,1/0,-1/0,-1/0];return Kt(t,e)?(t[0]>e[0]?s[0]=t[0]:s[0]=e[0],t[1]>e[1]?s[1]=t[1]:s[1]=e[1],t[2]<e[2]?s[2]=t[2]:s[2]=e[2],t[3]<e[3]?s[3]=t[3]:s[3]=e[3]):Pt(s),s}function qt(t){return[t[0],t[3]]}function Ut(t){return[t[2],t[3]]}function Bt(t){return t[2]-t[0]}function Kt(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Xt(t){return t[2]<t[0]||t[3]<t[1]}function Wt(t,e){let i=!0;for(let s=t.length-1;s>=0;--s)if(t[s]!=e[s]){i=!1;break}return i}function Zt(t,e){const i=Math.cos(e),s=Math.sin(e),n=t[0]*i-t[1]*s,r=t[1]*i+t[0]*s;return t[0]=n,t[1]=r,t}function Vt(t,e,i){const s=e.getExtent();let n=0;return e.canWrapX()&&(t[0]<s[0]||t[0]>s[2])&&(i=i||Bt(s),n=Math.floor((t[0]-s[0])/i)),n}function Yt(t){return Math.pow(t,3)}function Ht(t){return 1-Yt(1-t)}function $t(t){return 3*t*t-2*t*t*t}function Qt(t){return t}const Jt=2;let te=1;function ee(...t){te>Jt||console.warn(...t)}const ie={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937},se=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_||ie[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_}},ne=6378137,re=Math.PI*ne,oe=[-re,-re,re,re],ae=[-180,-85,180,85],he=ne*Math.log(Math.tan(Math.PI/2));class le extends se{constructor(t){super({code:t,units:"m",extent:oe,global:!0,worldExtent:ae,getPointResolution:function(t,e){return t/Math.cosh(e[1]/ne)}})}}const ce=[new le("EPSG:3857"),new le("EPSG:102100"),new le("EPSG:102113"),new le("EPSG:900913"),new le("http://www.opengis.net/def/crs/EPSG/0/3857"),new le("http://www.opengis.net/gml/srs/epsg.xml#3857")];const ue=[-180,-90,180,90],de=6378137*Math.PI/180;class ge extends se{constructor(t,e){super({code:t,units:"degrees",extent:ue,axisOrientation:e,global:!0,metersPerUnit:de,worldExtent:ue})}}const fe=[new ge("CRS:84"),new ge("EPSG:4326","neu"),new ge("urn:ogc:def:crs:OGC:1.3:CRS84"),new ge("urn:ogc:def:crs:OGC:2:84"),new ge("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new ge("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new ge("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let _e={};function pe(t){return _e[t]||_e[t.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}let me={};function ye(t,e,i){const s=t.getCode(),n=e.getCode();s in me||(me[s]={}),me[s][n]=i}function ve(t,e){return t in me&&e in me[t]?me[t][e]:null}const Me=.9996,we=.00669438,xe=we*we,Ee=xe*we,Se=we/(1-we),be=Math.sqrt(1-we),Pe=(1-be)/(1+be),Ce=Pe*Pe,Re=Ce*Pe,Ie=Re*Pe,Ge=Ie*Pe,Ae=.9983242984503243,Te=15*xe/256+45*Ee/1024,Oe=35*Ee/3072,Le=1.5*Pe-27/32*Re+269/512*Ge,Ne=21/16*Ce-55/32*Ie,ke=151/96*Re-417/128*Ge,Fe=1097/512*Ie,ze=6378137;function De(t,e,i){const s=t-5e5,n=(i.north?e:e-1e7)/Me/(ze*Ae),r=n+Le*Math.sin(2*n)+Ne*Math.sin(4*n)+ke*Math.sin(6*n)+Fe*Math.sin(8*n),o=Math.sin(r),a=o*o,h=Math.cos(r),l=o/h,c=l*l,u=c*c,d=1-we*a,g=Math.sqrt(1-we*a),f=Se*h**2,_=f*f,p=s/(ze/g*Me),m=p*p,y=m*p,v=y*p,M=v*p,w=r-l/((1-we)/d)*(m/2-v/24*(5+3*c+10*f-4*_-9*Se))+M*p/720*(61+90*c+298*f+45*u-252*Se-3*_);let x=(p-y/6*(1+2*c+f)+M/120*(5-2*f+28*c-3*_+8*Se+24*u))/h;return x=mt(x+ut(qe(i.number)),-Math.PI,Math.PI),[ct(x),ct(w)]}function je(t,e,i){t=mt(t,-180,180),e<-80?e=-80:e>84&&(e=84);const s=ut(e),n=Math.sin(s),r=Math.cos(s),o=n/r,a=o*o,h=a*a,l=ut(t),c=ut(qe(i.number)),u=ze/Math.sqrt(1-we*n**2),d=Se*r**2,g=r*mt(l-c,-Math.PI,Math.PI),f=g*g,_=f*g,p=_*g,m=p*g,y=m*g,v=ze*(Ae*s-.002514607064228144*Math.sin(2*s)+Te*Math.sin(4*s)-Oe*Math.sin(6*s)),M=Me*u*(g+_/6*(1-a+d)+m/120*(5-18*a+h+72*d-58*Se))+5e5;let w=Me*(v+u*o*(f/2+p/24*(5-a+9*d+4*d**2)+y/720*(61-58*a+h+600*d-330*Se)));return i.north||(w+=1e7),[M,w]}function qe(t){return 6*(t-1)-180+3}const Ue=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function Be(t){let e=0;for(const i of Ue){const s=t.match(i);if(s){e=parseInt(s[1]);break}}if(!e)return null;let i=0,s=!1;return e>32700&&e<32761?i=e-32700:e>32600&&e<32661&&(s=!0,i=e-32600),i?{number:i,north:s}:null}function Ke(t,e){return function(i,s,n,r){const o=i.length;n=n>1?n:2,r=r??n,s||(s=n>2?i.slice():new Array(o));for(let n=0;n<o;n+=r){const r=i[n],o=i[n+1],a=t(r,o,e);s[n]=a[0],s[n+1]=a[1]}return s}}function Xe(t,e,i){i=i||6371008.8;const s=ut(t[1]),n=ut(e[1]),r=(n-s)/2,o=ut(e[0]-t[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(s)*Math.cos(n);return 2*i*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}const We=[function(t){const e=Be(t.getCode());return e?{forward:Ke(je,e),inverse:Ke(De,e)}:null}],Ze=[function(t){return Be(t)?new se({code:t,units:"m"}):null}];let Ve=!0;function Ye(t,e){if(void 0!==e)for(let i=0,s=t.length;i<s;++i)e[i]=t[i];else e=t.slice();return e}function He(t){!function(t,e){_e[t]=e}(t.getCode(),t),ye(t,t,Ye)}function $e(t){if("string"!=typeof t)return t;const e=pe(t);if(e)return e;for(const e of Ze){const i=e(t);if(i)return i}return null}function Qe(t,e,i,s){let n;const r=(t=$e(t)).getPointResolutionFunc();if(r){if(n=r(e,i),s&&s!==t.getUnits()){const e=t.getMetersPerUnit();e&&(n=n*e/ie[s])}}else{const r=t.getUnits();if("degrees"==r&&!s||"degrees"==s)n=e;else{const o=ni(t,$e("EPSG:4326"));if(o||"degrees"===r){let t=[i[0]-e/2,i[1],i[0]+e/2,i[1],i[0],i[1]-e/2,i[0],i[1]+e/2];t=o(t,t,2),n=(Xe(t.slice(0,2),t.slice(2,4))+Xe(t.slice(4,6),t.slice(6,8)))/2}else n=e*t.getMetersPerUnit();const a=s?ie[s]:t.getMetersPerUnit();void 0!==a&&(n/=a)}}return n}function Je(t){!function(t){t.forEach(He)}(t),t.forEach(function(e){t.forEach(function(t){e!==t&&ye(e,t,Ye)})})}function ti(t,e){return t?"string"==typeof t?$e(t):t:$e(e)}function ei(t){return function(e,i,s,n){const r=e.length;s=void 0!==s?s:2,n=n??s,i=void 0!==i?i:new Array(r);for(let o=0;o<r;o+=n){const r=t(e.slice(o,o+s)),a=r.length;for(let t=0,s=n;t<s;++t)i[o+t]=t>=a?e[o+t]:r[t]}return i}}function ii(t,e,i,s){const n=$e(t),r=$e(e);ye(n,r,ei(i)),ye(r,n,ei(s))}function si(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();return(t.getCode()===e.getCode()||ni(t,e)===Ye)&&i}function ni(t,e){const i=t.getCode(),s=e.getCode();let n=ve(i,s);if(n)return n;let r=null,o=null;for(const i of We)r||(r=i(t)),o||(o=i(e));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)n=ri(r.inverse,o.forward);else{const t=ve(i,a);t&&(n=ri(t,o.forward))}else{const t=ve(a,s);t&&(n=ri(r.inverse,t))}return n&&(He(t),He(e),ye(t,e,n)),n}function ri(t,e){return function(i,s,n,r){return s=t(i,s,n,r),e(s,s,n,r)}}function oi(t,e){return ni($e(t),$e(e))}function ai(t,e,i){const s=oi(e,i);if(!s){const t=$e(e).getCode(),s=$e(i).getCode();throw new Error(`No transform available between ${t} and ${s}`)}return s(t,void 0,t.length)}function hi(t,e,i,s){return function(t,e,i,s){if(Xt(t))return Pt(i);let n=[];if(s>1){const e=t[2]-t[0],i=t[3]-t[1];for(let r=0;r<s;++r)n.push(t[0]+e*r/s,t[1],t[2],t[1]+i*r/s,t[2]-e*r/s,t[3],t[0],t[3]-i*r/s)}else n=[t[0],t[1],t[2],t[1],t[2],t[3],t[0],t[3]];e(n,n,2);const r=[],o=[];for(let t=0,e=n.length;t<e;t+=2)r.push(n[t]),o.push(n[t+1]);return function(t,e,i){return bt(Math.min.apply(null,t),Math.min.apply(null,e),Math.max.apply(null,t),Math.max.apply(null,e),i)}(r,o,i)}(t,oi(e,i),void 0,s)}let li=null;function ci(){return li}function ui(t,e){return t}function di(t,e){return Ve&&!Wt(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(Ve=!1,ee("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t}function gi(t,e){return t}function fi(t,e,i){return function(s){let n,r;if(t.canWrapX()){const e=t.getExtent(),o=Bt(e);r=Vt(s=s.slice(0),t,o),r&&(s[0]=s[0]-r*o),s[0]=at(s[0],e[0],e[2]),s[1]=at(s[1],e[1],e[3]),n=i(s)}else n=i(s);return r&&e.canWrapX()&&(n[0]+=r*Bt(e.getExtent())),n}}var _i,pi,mi;function yi(t,e){const i=e[0],s=e[1];return e[0]=t[0]*i+t[2]*s+t[4],e[1]=t[1]*i+t[3]*s+t[5],e}function vi(t,e,i,s,n,r,o,a){const h=Math.sin(r),l=Math.cos(r);return t[0]=s*l,t[1]=n*h,t[2]=-s*h,t[3]=n*l,t[4]=o*s*l-a*s*h+e,t[5]=o*n*h+a*n*l+i,t}function Mi(t,e){const i=(s=e)[0]*s[3]-s[1]*s[2];var s;it(0!==i,"Transformation matrix cannot be inverted");const n=e[0],r=e[1],o=e[2],a=e[3],h=e[4],l=e[5];return t[0]=a/i,t[1]=-r/i,t[2]=-o/i,t[3]=n/i,t[4]=(o*l-a*h)/i,t[5]=-(n*l-r*h)/i,t}Je(ce),Je(fe),_i=ce,pi=function(t,e,i,s){const n=t.length;i=i>1?i:2,s=s??i,void 0===e&&(e=i>2?t.slice():new Array(n));for(let i=0;i<n;i+=s){e[i]=re*t[i]/180;let s=ne*Math.log(Math.tan(Math.PI*(+t[i+1]+90)/360));s>he?s=he:s<-he&&(s=-he),e[i+1]=s}return e},mi=function(t,e,i,s){const n=t.length;i=i>1?i:2,s=s??i,void 0===e&&(e=i>2?t.slice():new Array(n));for(let i=0;i<n;i+=s)e[i]=180*t[i]/re,e[i+1]=360*Math.atan(Math.exp(t[i+1]/ne))/Math.PI-90;return e},fe.forEach(function(t){_i.forEach(function(e){ye(t,e,pi),ye(e,t,mi)})}),new Array(6);const wi=[1e5,1e5,1e5,1e5,2,2];function xi(t){return t.substring(7,t.length-1).split(",").map(parseFloat)}const Ei=[1,0,0,1,0,0],Si=[NaN,NaN],bi=class extends O{constructor(){super(),this.extent_=[1/0,1/0,-1/0,-1/0],this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=function(t){let e,i,s;return function(){const n=Array.prototype.slice.call(arguments);return i&&this===s&&w(n,i)||(s=this,i=n,e=t.apply(this,arguments)),e}}((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const s=this.clone();return s.applyTransform(i),s.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return I()}closestPointXY(t,e,i,s){return I()}containsXY(t,e){return 0===this.closestPointXY(t,e,Si,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 I()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&Pt(t),this.extentRevision_=this.getRevision()}return function(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}(this.extent_,t)}rotate(t,e){I()}scale(t,e,i){I()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return I()}getType(){return I()}applyTransform(t){I()}intersectsExtent(t){return I()}translate(t,e){I()}transform(t,e){const i=$e(t),s="tile-pixels"==i.getUnits()?function(t,s,n){const r=i.getExtent(),o=i.getWorldExtent(),a=Dt(o)/Dt(r);vi(Ei,o[0],o[3],a,-a,0,0,0);const h=function(t,e,i,s,n,r,o){r=r||[],o=o||2;let a=0;for(let e=0;e<i;e+=s){const i=t[e],s=t[e+1];r[a++]=n[0]*i+n[2]*s+n[4],r[a++]=n[1]*i+n[3]*s+n[5];for(let i=2;i<o;i++)r[a++]=t[e+i]}return r&&r.length!=a&&(r.length=a),r}(t,0,t.length,n,Ei,s),l=oi(i,e);return l?l(h,h,n):h}:oi(i,e);return this.applyTransform(s),this}};function Pi(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}const Ci=class extends bi{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return e=this.flatCoordinates,i=this.flatCoordinates.length,s=this.stride,It(Pt(t),e,0,i,s);var e,i,s}getCoordinates(){return I()}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=Pi(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){I()}setLayout(t,e,i){let s;if(t)s=Pi(t);else{for(let t=0;t<i;++t){if(0===e.length)return this.layout="XY",void(this.stride=2);e=e[0]}s=e.length,t=function(t){let e;return 2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM"),e}(s)}this.layout=t,this.stride=s}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();!function(t,e,i,s,n,r,o){o=o||[];const a=Math.cos(n),h=Math.sin(n),l=r[0],c=r[1];let u=0;for(let e=0;e<i;e+=s){const i=t[e]-l,n=t[e+1]-c;o[u++]=l+i*a-n*h,o[u++]=c+i*h+n*a;for(let i=e+2;i<e+s;++i)o[u++]=t[i]}o&&o.length!=u&&(o.length=u)}(i,0,i.length,s,t,e,i),this.changed()}}scale(t,e,i){void 0===e&&(e=t),i||(i=Nt(this.getExtent()));const s=this.getFlatCoordinates();if(s){const n=this.getStride();!function(t,e,i,s,n,r,o,a){a=a||[];const h=o[0],l=o[1];let c=0;for(let e=0;e<i;e+=s){const i=t[e]-h,o=t[e+1]-l;a[c++]=h+n*i,a[c++]=l+r*o;for(let i=e+2;i<e+s;++i)a[c++]=t[i]}a&&a.length!=c&&(a.length=c)}(s,0,s.length,n,t,e,i,s),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();!function(t,e,i,s,n,r,o){o=o||[];let a=0;for(let e=0;e<i;e+=s){o[a++]=t[e]+n,o[a++]=t[e+1]+r;for(let i=e+2;i<e+s;++i)o[a++]=t[i]}o&&o.length!=a&&(o.length=a)}(i,0,i.length,s,t,e,i),this.changed()}}};function Ri(t,e,i,s){let n=0;const r=t[i-s],o=t[i-s+1];let a=0,h=0;for(;e<i;e+=s){const i=t[e]-r,s=t[e+1]-o;n+=h*i-a*s,a=i,h=s}return n/2}function Ii(t,e,i,s,n,r,o){const a=t[e],h=t[e+1],l=t[i]-a,c=t[i+1]-h;let u;if(0===l&&0===c)u=e;else{const d=((n-a)*l+(r-h)*c)/(l*l+c*c);if(d>1)u=i;else{if(d>0){for(let n=0;n<s;++n)o[n]=gt(t[e+n],t[i+n],d);return void(o.length=s)}u=e}}for(let e=0;e<s;++e)o[e]=t[u+e];o.length=s}function Gi(t,e,i,s,n){let r=t[e],o=t[e+1];for(e+=s;e<i;e+=s){const i=t[e],s=t[e+1],a=lt(r,o,i,s);a>n&&(n=a),r=i,o=s}return n}function Ai(t,e,i,s,n,r,o,a,h,l,c){if(e==i)return l;let u,d;if(0===n){if(d=lt(o,a,t[e],t[e+1]),d<l){for(u=0;u<s;++u)h[u]=t[e+u];return h.length=s,d}return l}c=c||[NaN,NaN];let g=e+s;for(;g<i;)if(Ii(t,g-s,g,s,o,a,c),d=lt(o,a,c[0],c[1]),d<l){for(l=d,u=0;u<s;++u)h[u]=c[u];h.length=s,g+=s}else g+=s*Math.max((Math.sqrt(d)-Math.sqrt(l))/n|0,1);if(r&&(Ii(t,i-s,e,s,o,a,c),d=lt(o,a,c[0],c[1]),d<l)){for(l=d,u=0;u<s;++u)h[u]=c[u];h.length=s}return l}function Ti(t,e,i,s){for(let n=0,r=i.length;n<r;++n){const r=i[n];for(let i=0;i<s;++i)t[e++]=r[i]}return e}function Oi(t,e,i,s,n){n=void 0!==n?n:[];let r=0;for(let o=e;o<i;o+=s)n[r++]=t.slice(o,o+s);return n.length=r,n}function Li(t,e){return e*Math.round(t/e)}function Ni(t,e,i,s,n,r,o){if(e==i)return o;let a,h,l=Li(t[e],n),c=Li(t[e+1],n);e+=s,r[o++]=l,r[o++]=c;do{if(a=Li(t[e],n),h=Li(t[e+1],n),(e+=s)==i)return r[o++]=a,r[o++]=h,o}while(a==l&&h==c);for(;e<i;){const i=Li(t[e],n),u=Li(t[e+1],n);if(e+=s,i==a&&u==h)continue;const d=a-l,g=h-c,f=i-l,_=u-c;d*_==g*f&&(d<0&&f<d||d==f||d>0&&f>d)&&(g<0&&_<g||g==_||g>0&&_>g)?(a=i,h=u):(r[o++]=a,r[o++]=h,l=a,c=h,a=i,h=u)}return r[o++]=a,r[o++]=h,o}class ki extends Ci{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 ki(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,s){return s<wt(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Gi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ai(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,s))}getArea(){return Ri(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Oi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=function(t,e,i,s,n,r,o){const a=(i-e)/s;if(a<3){for(;e<i;e+=s)r[o++]=t[e],r[o++]=t[e+1];return o}const h=new Array(a);h[0]=1,h[a-1]=1;const l=[e,i-s];let c=0;for(;l.length>0;){const i=l.pop(),r=l.pop();let o=0;const a=t[r],u=t[r+1],d=t[i],g=t[i+1];for(let e=r+s;e<i;e+=s){const i=ht(t[e],t[e+1],a,u,d,g);i>o&&(c=e,o=i)}o>n&&(h[(c-e)/s]=1,r+s<c&&l.push(r,c),c+s<i&&l.push(c,i))}for(let i=0;i<a;++i)h[i]&&(r[o++]=t[e+i*s],r[o++]=t[e+i*s+1]);return o}(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new ki(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ti(this.flatCoordinates,0,t,this.stride),this.changed()}}const Fi=ki;class zi extends Ci{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new zi(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){const n=this.flatCoordinates,r=lt(t,e,n[0],n[1]);if(r<s){const t=this.stride;for(let e=0;e<t;++e)i[e]=n[e];return i.length=t,r}return s}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return function(t,e){const i=t[0],s=t[1];return bt(i,s,i,s,e)}(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Et(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=function(t,e,i){for(let s=0,n=i.length;s<n;++s)t[e++]=i[s];return e}(this.flatCoordinates,0,t,this.stride),this.changed()}}const Di=zi;function ji(t,e,i,s,n){return!At(n,function(n){return!qi(t,e,i,s,n[0],n[1])})}function qi(t,e,i,s,n,r){let o=0,a=t[i-s],h=t[i-s+1];for(;e<i;e+=s){const i=t[e],s=t[e+1];h<=r?s>r&&(i-a)*(r-h)-(n-a)*(s-h)>0&&o++:s<=r&&(i-a)*(r-h)-(n-a)*(s-h)<0&&o--,a=i,h=s}return 0!==o}function Ui(t,e,i,s,n,r){if(0===i.length)return!1;if(!qi(t,e,i[0],s,n,r))return!1;for(let e=1,o=i.length;e<o;++e)if(qi(t,i[e-1],i[e],s,n,r))return!1;return!0}function Bi(t,e,i,s,n,r){return r=r??It([1/0,1/0,-1/0,-1/0],t,e,i,s),!!Kt(n,r)&&(r[0]>=n[0]&&r[2]<=n[2]||r[1]>=n[1]&&r[3]<=n[3]||function(t,e,i,s,n){let r;for(e+=s;e<i;e+=s)if(r=n(t.slice(e-s,e),t.slice(e,e+s)),r)return r;return!1}(t,e,i,s,function(t,e){return function(t,e,i){let s=!1;const n=St(t,e),r=St(t,i);if(1===n||1===r)s=!0;else{const o=t[0],a=t[1],h=t[2],l=t[3],c=e[0],u=e[1],d=i[0],g=i[1],f=(g-u)/(d-c);let _,p;2&r&&!(2&n)&&(_=d-(g-l)/f,s=_>=o&&_<=h),s||!(4&r)||4&n||(p=g-(d-h)*f,s=p>=a&&p<=l),s||!(8&r)||8&n||(_=d-(g-a)/f,s=_>=o&&_<=h),s||!(16&r)||16&n||(p=g-(d-o)*f,s=p>=a&&p<=l)}return s}(n,t,e)}))}function Ki(t,e,i,s,n){return!!(Bi(t,e,i,s,n)||qi(t,e,i,s,n[0],n[1])||qi(t,e,i,s,n[0],n[3])||qi(t,e,i,s,n[2],n[1])||qi(t,e,i,s,n[2],n[3]))}function Xi(t,e,i,s){for(;e<i-s;){for(let n=0;n<s;++n){const r=t[e+n];t[e+n]=t[i-s+n],t[i-s+n]=r}e+=s,i-=s}}function Wi(t,e,i,s){let n=0,r=t[i-s],o=t[i-s+1];for(;e<i;e+=s){const i=t[e],s=t[e+1];n+=(i-r)*(s+o),r=i,o=s}return 0===n?void 0:n>0}function Zi(t,e,i,s,n){n=void 0!==n&&n;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=Wi(t,e,o,s);(0===r?n&&a||!n&&!a:n&&!a||!n&&a)&&Xi(t,e,o,s),e=o}return e}class Vi extends Ci{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?function(t,e){const i=Array.isArray(e)?e:[e],s=i.length;for(let e=0;e<s;e++)t[t.length]=i[e]}(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Vi(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<wt(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(function(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r){const o=i[r];n=Gi(t,e,o,s,n),e=o}return n}(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),function(t,e,i,s,n,r,o,a,h,l,c){c=c||[NaN,NaN];for(let u=0,d=i.length;u<d;++u){const d=i[u];l=Ai(t,e,d,s,n,r,o,a,h,l,c),e=d}return l}(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,s))}containsXY(t,e){return Ui(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return function(t,e,i,s){let n=0;for(let r=0,o=i.length;r<o;++r){const o=i[r];n+=Ri(t,e,o,s),e=o}return n}(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),Zi(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,function(t,e,i,s,n){n=void 0!==n?n:[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];n[r++]=Oi(t,e,a,s,n[r]),e=a}return n.length=r,n}(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=Nt(this.getExtent());this.flatInteriorPoint_=function(t,e,i,s,n,r,o){let a,h,l,c,u,d,g;const f=n[r+1],_=[];for(let n=0,r=i.length;n<r;++n){const r=i[n];for(c=t[r-s],d=t[r-s+1],a=e;a<r;a+=s)u=t[a],g=t[a+1],(f<=d&&g<=f||d<=f&&f<=g)&&(l=(f-d)/(g-d)*(u-c)+c,_.push(l)),c=u,d=g}let p=NaN,m=-1/0;for(_.sort(v),c=_[0],a=1,h=_.length;a<h;++a){u=_[a];const n=Math.abs(u-c);n>m&&(l=(c+u)/2,Ui(t,e,i,s,l,f)&&(p=l,m=n)),c=u}return isNaN(p)&&(p=n[r]),o?(o.push(p,f,m),o):[p,f,m]}(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Di(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new Fi(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,s=[];let n=0;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=new Fi(e.slice(n,o),t);s.push(a),n=o}return s}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;!function(t,e,i,s,n){n=void 0!==n&&n;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=Wi(t,e,o,s);if(0===r){if(n&&a||!n&&!a)return!1}else if(n&&!a||!n&&a)return!1;e=o}return!0}(t,0,this.ends_,this.stride)?(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Zi(this.orientedFlatCoordinates_,0,this.ends_,this.stride)):this.orientedFlatCoordinates_=t,this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=function(t,e,i,s,n,r,o,a){for(let h=0,l=i.length;h<l;++h){const l=i[h];o=Ni(t,e,l,s,n,r,o),a.push(o),e=l}return o}(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new Vi(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return function(t,e,i,s,n){if(!Ki(t,e,i[0],s,n))return!1;if(1===i.length)return!0;for(let e=1,r=i.length;e<r;++e)if(ji(t,i[e-1],i[e],s,n)&&!Bi(t,i[e-1],i[e],s,n))return!1;return!0}(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=function(t,e,i,s,n){n=n||[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=Ti(t,e,i[o],s);n[r++]=a,e=a}return n.length=r,n}(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}const Yi=Vi;function Hi(t){if(Xt(t))throw new Error("Cannot create polygon from empty extent");const e=t[0],i=t[1],s=t[2],n=t[3],r=[e,i,e,n,s,n,s,i,e,i];return new Vi(r,"XY",[r.length])}function $i(t,e,i,s){const n=Bt(e)/i[0],r=Dt(e)/i[1];return s?Math.min(t,Math.max(n,r)):Math.min(t,Math.min(n,r))}function Qi(t,e,i){let s=Math.min(t,e);return s*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(s=Math.max(s,i),s/=Math.log(1+50*Math.max(0,i/t-1))/50+1),at(s,i/2,2*e)}function Ji(t,e,i,s,n){return i=void 0===i||i,function(r,o,a,h){if(void 0!==r){const o=s?$i(t,s,a,n):t;return i&&h?Qi(r,o,e):at(r,e,o)}}}function ts(t){if(void 0!==t)return 0}function es(t){if(void 0!==t)return t}function is(t,e){setTimeout(function(){t(e)},0)}function ss(t){return!(t.sourceCenter&&t.targetCenter&&!Wt(t.sourceCenter,t.targetCenter))&&t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation}function ns(t,e,i,s,n){const r=Math.cos(-n);let o=Math.sin(-n),a=t[0]*r-t[1]*o,h=t[1]*r+t[0]*o;return a+=(e[0]/2-i[0])*s,h+=(i[1]-e[1]/2)*s,o=-o,[a*r-h*o,h*r+a*o]}const rs=class extends O{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=ti(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){Ve=!(void 0===t||t)}(),t.center&&(t.center=di(t.center,this.projection_)),t.extent&&(t.extent=gi(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const t in ot)delete e[t];this.setProperties(e,!0);const i=function(t){let e,i,s;let n=void 0!==t.minZoom?t.minZoom:0,r=void 0!==t.maxZoom?t.maxZoom:28;const o=void 0!==t.zoomFactor?t.zoomFactor:2,a=void 0!==t.multiWorld&&t.multiWorld,h=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,l=void 0!==t.showFullExtent&&t.showFullExtent,c=ti(t.projection,"EPSG:3857"),u=c.getExtent();let d=t.constrainOnlyCenter,g=t.extent;if(a||g||!c.isGlobal()||(d=!1,g=u),void 0!==t.resolutions){const o=t.resolutions;i=o[n],s=void 0!==o[r]?o[r]:o[o.length-1],e=t.constrainResolution?function(t,e,i,s){return e=void 0===e||e,function(n,r,o,a){if(void 0!==n){const h=t[0],l=t[t.length-1],c=i?$i(h,i,o,s):h;if(a)return e?Qi(n,c,l):at(n,l,c);const u=Math.min(c,n),d=Math.floor(M(t,u,r));return t[d]>c&&d<t.length-1?t[d+1]:t[d]}}}(o,h,!d&&g,l):Ji(i,s,h,!d&&g,l)}else{const a=(u?Math.max(Bt(u),Dt(u)):360*ie.degrees/c.getMetersPerUnit())/256/Math.pow(2,0),f=a/Math.pow(2,28);i=t.maxResolution,void 0!==i?n=0:i=a/Math.pow(o,n),s=t.minResolution,void 0===s&&(s=void 0!==t.maxZoom?void 0!==t.maxResolution?i/Math.pow(o,r):a/Math.pow(o,r):f),r=n+Math.floor(Math.log(i/s)/Math.log(o)),s=i/Math.pow(o,r-n),e=t.constrainResolution?function(t,e,i,s,n,r){return s=void 0===s||s,i=void 0!==i?i:0,function(o,a,h,l){if(void 0!==o){const c=n?$i(e,n,h,r):e;if(l)return s?Qi(o,c,i):at(o,i,c);const u=1e-9,d=Math.ceil(Math.log(e/c)/Math.log(t)-u),g=-a*(.5-u)+.5,f=Math.min(c,o),_=Math.floor(Math.log(e/f)/Math.log(t)+g),p=Math.max(d,_);return at(e/Math.pow(t,p),i,c)}}}(o,i,s,h,!d&&g,l):Ji(i,s,h,!d&&g,l)}return{constraint:e,maxResolution:i,minResolution:s,minZoom:n,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 s=function(t){if(void 0!==t.extent){const e=void 0===t.smoothExtentConstraint||t.smoothExtentConstraint;return yt(t.extent,t.constrainOnlyCenter,e)}const e=ti(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,yt(t,!1,!1)}return vt}(t),n=i.constraint,r=function(t){if(void 0===t.enableRotation||t.enableRotation){const e=t.constrainRotation;return void 0===e||!0===e?function(){const t=ut(5);return function(e,i){return i||void 0===e?e:Math.abs(e)<=t?0:e}}():!1===e?es:"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):es}return ts}(t);this.constraints_={center:s,resolution:n,rotation:r},this.setRotation(void 0!==t.rotation?t.rotation:0),this.setCenterInternal(void 0!==t.center?t.center:null),void 0!==t.resolution?this.setResolution(t.resolution):void 0!==t.zoom&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const s=t||[0,0,0,0];e=e||[0,0,0,0];const n=this.getResolution(),r=n/2*(s[3]-e[3]+e[1]-s[1]),o=n/2*(s[0]-e[0]+e[2]-s[2]);this.setCenterInternal([i[0]+r,i[1]-o])}}getUpdatedOptions_(t){const e=this.getProperties();return void 0!==e.resolution?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let t=0;t<e.length;++t){let i=arguments[t];i.center&&(i=Object.assign({},i),i.center=di(i.center,this.getProjection())),i.anchor&&(i=Object.assign({},i),i.anchor=di(i.anchor,this.getProjection())),e[t]=i}this.animateInternal.apply(this,e)}animateInternal(t){let e,i=arguments.length;i>1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let s=0;for(;s<i&&!this.isDef();++s){const t=arguments[s];t.center&&this.setCenterInternal(t.center),void 0!==t.zoom?this.setZoom(t.zoom):t.resolution&&this.setResolution(t.resolution),void 0!==t.rotation&&this.setRotation(t.rotation)}if(s===i)return void(e&&is(e,!0));let n=Date.now(),r=this.targetCenter_.slice(),o=this.targetResolution_,a=this.targetRotation_;const h=[];for(;s<i;++s){const t=arguments[s],i={start:n,complete:!1,anchor:t.anchor,duration:void 0!==t.duration?t.duration:1e3,easing:t.easing||$t,callback:e};if(t.center&&(i.sourceCenter=r,i.targetCenter=t.center.slice(),r=i.targetCenter),void 0!==t.zoom?(i.sourceResolution=o,i.targetResolution=this.getResolutionForZoom(t.zoom),o=i.targetResolution):t.resolution&&(i.sourceResolution=o,i.targetResolution=t.resolution,o=i.targetResolution),void 0!==t.rotation){i.sourceRotation=a;const e=dt(t.rotation-a+Math.PI,2*Math.PI)-Math.PI;i.targetRotation=a+e,a=i.targetRotation}ss(i)?i.complete=!0:n+=i.duration,h.push(i)}this.animations_.push(h),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&&is(i[0].callback,!1),!t)for(let e=0,s=i.length;e<s;++e){const s=i[e];if(!s.complete){t=s.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(void 0!==this.updateAnimationKey_&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const s=this.animations_[i];let n=!0;for(let i=0,r=s.length;i<r;++i){const r=s[i];if(r.complete)continue;const o=t-r.start;let a=r.duration>0?o/r.duration:1;a>=1?(r.complete=!0,a=1):n=!1;const h=r.easing(a);if(r.sourceCenter){const t=r.sourceCenter[0],e=r.sourceCenter[1],i=r.targetCenter[0],s=r.targetCenter[1];this.nextCenter_=r.targetCenter;const n=t+h*(i-t),o=e+h*(s-e);this.targetCenter_=[n,o]}if(r.sourceResolution&&r.targetResolution){const t=1===h?r.targetResolution:r.sourceResolution+h*(r.targetResolution-r.sourceResolution);if(r.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,r.anchor)}this.nextResolution_=r.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==r.sourceRotation&&void 0!==r.targetRotation){const t=1===h?dt(r.targetRotation+Math.PI,2*Math.PI)-Math.PI:r.sourceRotation+h*(r.targetRotation-r.sourceRotation);if(r.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,r.anchor)}this.nextRotation_=r.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!r.complete)break}if(n){this.animations_[i]=null,this.setHint(0,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=s[0].callback;t&&is(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const s=this.getCenterInternal();var n,r;return void 0!==s&&(i=[s[0]-e[0],s[1]-e[1]],Zt(i,t-this.getRotation()),r=e,(n=i)[0]+=+r[0],n[1]+=+r[1]),i}calculateCenterZoom(t,e){let i;const s=this.getCenterInternal(),n=this.getResolution();return void 0!==s&&void 0!==n&&(i=[e[0]-t*(e[0]-s[0])/n,e[1]-t*(e[1]-s[1])/n]),i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],s=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(s*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(s*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?ui(t,this.getProjection()):t}getCenterInternal(){return this.get(ot.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 e=this.calculateExtentInternal(t),this.getProjection(),e;var e}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();it(e,"The view center is not defined");const i=this.getResolution();it(void 0!==i,"The view resolution is not defined");const s=this.getRotation();return it(void 0!==s,"The view rotation is not defined"),Ft(e,i,s,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(ot.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(gi(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=Bt(t)/e[0],s=Dt(t)/e[1];return Math.max(i,s)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,s=Math.log(e/i)/Math.log(t);return function(i){return e/Math.pow(t,i*s)}}getRotation(){return this.get(ot.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),s=this.minResolution_,n=Math.log(i/s)/e;return function(t){return Math.log(i/t)/e/n}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let s=this.getCenterInternal();const n=this.padding_;if(n){const t=this.getViewportSizeMinusPadding_();s=ns(s,this.getViewportSize_(),[t[0]/2+n[3],t[1]/2+n[0]],e,i)}return{center:s.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,s=this.minZoom_||0;if(this.resolutions_){const n=M(this.resolutions_,t,1);s=n,e=this.resolutions_[n],i=n==this.resolutions_.length-1?2:e/this.resolutions_[n+1]}else e=this.maxResolution_,i=this.zoomFactor_;return s+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=at(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,at(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(it(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t))it(!Xt(t),"Cannot fit empty extent provided as `geometry`"),i=Hi(gi(t,this.getProjection()));else if("Circle"===t.getType()){const e=gi(t.getExtent(),this.getProjection());i=Hi(e),i.rotate(this.getRotation(),Nt(e))}else{const e=ci();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),s=Math.sin(-e),n=t.getFlatCoordinates(),r=t.getStride();let o=1/0,a=1/0,h=-1/0,l=-1/0;for(let t=0,e=n.length;t<e;t+=r){const e=n[t]*i-n[t+1]*s,r=n[t]*s+n[t+1]*i;o=Math.min(o,e),a=Math.min(a,r),h=Math.max(h,e),l=Math.max(l,r)}return[o,a,h,l]}fitInternal(t,e){let i=(e=e||{}).size;i||(i=this.getViewportSizeMinusPadding_());const s=void 0!==e.padding?e.padding:[0,0,0,0],n=void 0!==e.nearest&&e.nearest;let r;r=void 0!==e.minResolution?e.minResolution:void 0!==e.maxZoom?this.getResolutionForZoom(e.maxZoom):0;const o=this.rotatedExtentForGeometry(t);let a=this.getResolutionForExtentInternal(o,[i[0]-s[1]-s[3],i[1]-s[0]-s[2]]);a=isNaN(a)?r:Math.max(a,r),a=this.getConstrainedResolution(a,n?0:1);const h=this.getRotation(),l=Math.sin(h),c=Math.cos(h),u=Nt(o);u[0]+=(s[1]-s[3])/2*a,u[1]+=(s[0]-s[2])/2*a;const d=u[0]*c-u[1]*l,g=u[1]*c+u[0]*l,f=this.getConstrainedCenter([d,g],a),_=e.callback?e.callback:S;void 0!==e.duration?this.animateInternal({resolution:a,center:f,duration:e.duration,easing:e.easing},_):(this.targetResolution_=a,this.targetCenter_=f,this.applyTargetState_(!1,!0),is(_,!0))}centerOn(t,e,i){this.centerOnInternal(di(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(ns(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,s){let n;const r=this.padding_;if(r&&t){const o=this.getViewportSizeMinusPadding_(-i),a=ns(t,s,[o[0]/2+r[3],o[1]/2+r[0]],e,i);n=[t[0]-a[0],t[1]-a[1]]}return n}isDef(){return!!this.getCenterInternal()&&void 0!==this.getResolution()}adjustCenter(t){const e=ui(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&&di(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),s=this.getViewportSize_(this.getRotation()),n=this.constraints_.resolution(this.targetResolution_*t,0,s,i);e&&(this.targetCenter_=this.calculateCenterZoom(n,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=di(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),s=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(s,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t?di(t,this.getProjection()):t)}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,s=this.constraints_.rotation(this.targetRotation_,i),n=this.getViewportSize_(s),r=this.constraints_.resolution(this.targetResolution_,0,n,i),o=this.constraints_.center(this.targetCenter_,r,n,i,this.calculateCenterShift(this.targetCenter_,r,s,n));this.get(ot.ROTATION)!==s&&this.set(ot.ROTATION,s),this.get(ot.RESOLUTION)!==r&&(this.set(ot.RESOLUTION,r),this.set("zoom",this.getZoom(),!0)),o&&this.get(ot.CENTER)&&Wt(this.get(ot.CENTER),o)||this.set(ot.CENTER,o),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=void 0!==t?t:200;const s=e||0,n=this.constraints_.rotation(this.targetRotation_),r=this.getViewportSize_(n),o=this.constraints_.resolution(this.targetResolution_,s,r),a=this.constraints_.center(this.targetCenter_,o,r,!1,this.calculateCenterShift(this.targetCenter_,o,n,r));if(0===t&&!this.cancelAnchor_)return this.targetResolution_=o,this.targetRotation_=n,this.targetCenter_=a,void this.applyTargetState_();i=i||(0===t?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,this.getResolution()===o&&this.getRotation()===n&&this.getCenterInternal()&&Wt(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:n,center:a,resolution:o,duration:t,easing:Ht,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(1,1)}endInteraction(t,e,i){i=i&&di(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)}},os="ol-hidden",as="ol-unselectable",hs="ol-control",ls="ol-collapsed";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");function cs(t,e,i,s){let n;return n=i&&i.length?i.shift():K?new class extends OffscreenCanvas{style={}}(t??300,e??150):document.createElement("canvas"),t&&(n.width=t),e&&(n.height=e),n.getContext("2d",s)}let us;function ds(){return us||(us=cs(1,1)),us}function gs(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function fs(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}function _s(){return new Proxy({childNodes:[],appendChild:function(t){return this.childNodes.push(t),t},remove:function(){},removeChild:function(t){const e=this.childNodes.indexOf(t);if(-1===e)throw new Error("Node to remove was not found");return this.childNodes.splice(e,1),t},insertBefore:function(t,e){const i=this.childNodes.indexOf(e);if(-1===i)throw new Error("Reference node not found");return this.childNodes.splice(i,0,t),t},style:{}},{get:(t,e,i)=>"firstElementChild"===e?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,i)})}function ps(t){return"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas}const ms=class extends O{constructor(t){super();const e=t.element;!e||t.target||e.style.pointerEvents||(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&this.element?.remove();for(let t=0,e=this.listenerKeys.length;t<e;++t)c(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=t,t){const e=this.target_??t.getOverlayContainerStopEvent();this.element&&e.appendChild(this.element),this.render!==S&&this.listenerKeys.push(h(t,Y,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_="string"==typeof t?document.getElementById(t):t}},ys=class extends ms{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=void 0===t.collapsed||t.collapsed,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=void 0!==t.collapsible,this.collapsible_=void 0===t.collapsible||t.collapsible,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;const e=void 0!==t.className?t.className:"ol-attribution",i=void 0!==t.tipLabel?t.tipLabel:"Attributions",s=void 0!==t.expandClassName?t.expandClassName:e+"-expand",n=void 0!==t.collapseLabel?t.collapseLabel:"›",r=void 0!==t.collapseClassName?t.collapseClassName:e+"-collapse";"string"==typeof n?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=n,this.collapseLabel_.className=r):this.collapseLabel_=n;const o=void 0!==t.label?t.label:"i";"string"==typeof o?(this.label_=document.createElement("span"),this.label_.textContent=o,this.label_.className=s):this.label_=o;const a=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(a),this.toggleButton_.addEventListener(g,this.handleClick_.bind(this),!1);const h=e+" "+as+" "+hs+(this.collapsed_&&this.collapsible_?" "+ls:"")+(this.collapsible_?"":" ol-uncollapsible"),l=this.element;l.className=h,l.appendChild(this.toggleButton_),l.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=this.getMap().getAllLayers(),i=new Set(e.flatMap(e=>e.getAttributions(t)));if(void 0!==this.attributions_&&(Array.isArray(this.attributions_)?this.attributions_.forEach(t=>i.add(t)):i.add(this.attributions_)),!this.overrideCollapsible_){const t=!e.some(t=>!1===t.getSource()?.getAttributionsCollapsible());this.setCollapsible(t)}return Array.from(i)}async updateElement_(t){if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=await Promise.all(this.collectSourceAttributions_(t).map(t=>{return e=()=>t,function(){let t;try{t=e()}catch(t){return Promise.reject(t)}return t instanceof Promise?t:Promise.resolve(t)}();var e})),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!w(e,this.renderedAttributions_)){!function(t){for(;t.lastChild;)t.lastChild.remove()}(this.ulElement_);for(let t=0,i=e.length;t<i;++t){const i=document.createElement("li");i.innerHTML=e[t],this.ulElement_.appendChild(i)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(ls),this.collapsed_?fs(this.collapseLabel_,this.label_):fs(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}},vs=class extends ms{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=void 0!==t.className?t.className:"ol-rotate",i=void 0!==t.label?t.label:"⇧",s=void 0!==t.compassClassName?t.compassClassName:"ol-compass";this.label_=null,"string"==typeof i?(this.label_=document.createElement("span"),this.label_.className=s,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(s));const n=t.tipLabel?t.tipLabel:"Reset rotation",r=document.createElement("button");r.className=e+"-reset",r.setAttribute("type","button"),r.title=n,r.appendChild(this.label_),r.addEventListener(g,this.handleClick_.bind(this),!1);const o=e+" "+as+" "+hs,a=this.element;a.className=o,a.appendChild(r),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=void 0!==t.duration?t.duration:250,this.autoHide_=void 0===t.autoHide||t.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(os)}handleClick_(t){t.preventDefault(),void 0!==this.callResetNorth_?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const t=this.getMap().getView();if(!t)return;const e=t.getRotation();void 0!==e&&(this.duration_>0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:Ht}):t.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const t="rotate("+i+"rad)";if(this.autoHide_){const t=this.element.classList.contains(os);t||0!==i?t&&0!==i&&this.element.classList.remove(os):this.element.classList.add(os)}this.label_.style.transform=t}this.rotation_=i}},Ms=class extends ms{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=void 0!==t.className?t.className:"ol-zoom",i=void 0!==t.delta?t.delta:1,s=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",n=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",r=void 0!==t.zoomInLabel?t.zoomInLabel:"+",o=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",a=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",h=void 0!==t.zoomOutTipLabel?t.zoomOutTipLabel:"Zoom out",l=document.createElement("button");l.className=s,l.setAttribute("type","button"),l.title=a,l.appendChild("string"==typeof r?document.createTextNode(r):r),l.addEventListener(g,this.handleClick_.bind(this,i),!1);const c=document.createElement("button");c.className=n,c.setAttribute("type","button"),c.title=h,c.appendChild("string"==typeof o?document.createTextNode(o):o),c.addEventListener(g,this.handleClick_.bind(this,-i),!1);const u=e+" "+as+" "+hs,d=this.element;d.className=u,d.appendChild(l),d.appendChild(c),this.duration_=void 0!==t.duration?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const e=this.getMap().getView();if(!e)return;const i=e.getZoom();if(void 0!==i){const s=e.getConstrainedZoom(i+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:s,duration:this.duration_,easing:Ht})):e.setZoom(s)}}},ws=class{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let i=e-3;for(;i>0&&this.points_[i+2]>t;)i-=3;const s=this.points_[e+2]-this.points_[i+2];if(s<1e3/60)return!1;const n=this.points_[e]-this.points_[i],r=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(r,n),this.initialVelocity_=Math.sqrt(n*n+r*r)/s,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},xs="active";function Es(t,e,i,s){const n=t.getZoom();if(void 0===n)return;const r=t.getConstrainedZoom(n+e),o=t.getResolutionForZoom(r);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:i,duration:void 0!==s?s:250,easing:Ht})}const Ss=class extends O{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(xs)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(xs,t)}setMap(t){this.map_=t}},bs=class extends Ss{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:250}handleEvent(t){let e=!1;if(t.type==D.DBLCLICK){const i=t.originalEvent,s=t.map,n=t.coordinate,r=i.shiftKey?-this.delta_:this.delta_;Es(s.getView(),r,n,this.duration_),i.preventDefault(),e=!0}return!e}};function Ps(t){const e=arguments;return function(t){let i=!0;for(let s=0,n=e.length;s<n&&(i=i&&e[s](t),i);++s);return i}}const Cs=function(t){const e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Rs=function(t){const e=t.map.getTargetElement(),i=e.getRootNode();return!(i instanceof ShadowRoot?i.host:e).hasAttribute("tabindex")||function(t){const e=t.map.getTargetElement(),i=e.getRootNode(),s=t.map.getOwnerDocument().activeElement;return i instanceof ShadowRoot?i.host.contains(s):e.contains(s)}(t)},Is=x,Gs=function(t){const e=t.originalEvent;return"pointerId"in e&&0==e.button&&!(q&&U&&e.ctrlKey)},As=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},Ts=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Os=function(t){const e=t.originalEvent,i=e.target.tagName;return"INPUT"!==i&&"SELECT"!==i&&"TEXTAREA"!==i&&!e.target.isContentEditable},Ls=function(t){const e=t.originalEvent;return"pointerId"in e&&"mouse"==e.pointerType},Ns=function(t){const e=t.originalEvent;return"pointerId"in e&&e.isPrimary&&0===e.button};function ks(t){const e=t.length;let i=0,s=0;for(let n=0;n<e;n++)i+=t[n].clientX,s+=t[n].clientY;return{clientX:i/e,clientY:s/e}}const Fs=class extends Ss{constructor(t){super(t=t||{}),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==D.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==D.POINTERUP){const e=this.handleUpEvent(t);this.handlingDownUpSequence=e&&this.targetPointers.length>0}}else if(t.type==D.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==D.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}},zs=class extends Fs{constructor(t){super({stopDown:E}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:Ps(As,Ns);this.condition_=t.onFocusOnly?Ps(Rs,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const i=this.targetPointers,s=e.getEventPixel(ks(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(s[0],s[1]),this.lastCentroid){const e=[this.lastCentroid[0]-s[0],s[1]-this.lastCentroid[1]],i=t.map.getView();n=e,r=i.getResolution(),n[0]*=r,n[1]*=r,Zt(e,i.getRotation()),i.adjustCenterInternal(e)}}else this.kinetic_&&this.kinetic_.begin();var n,r;this.lastCentroid=s,this.lastPointersCount_=i.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,i=e.getView();if(0===this.targetPointers.length){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const t=this.kinetic_.getDistance(),s=this.kinetic_.getAngle(),n=i.getCenterInternal(),r=e.getPixelFromCoordinateInternal(n),o=e.getCoordinateFromPixelInternal([r[0]-t*Math.cos(s),r[1]-t*Math.sin(s)]);i.animateInternal({center:i.getConstrainedCenter(o),duration:500,easing:Ht})}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){const e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},Ds=class extends Fs{constructor(t){t=t||{},super({stopDown:E}),this.condition_=t.condition?t.condition:Cs,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!Ls(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===ts)return;const s=e.getSize(),n=t.pixel,r=Math.atan2(s[1]/2-n[1],n[0]-s[0]/2);if(void 0!==this.lastAngle_){const t=r-this.lastAngle_;i.adjustRotationInternal(-t)}this.lastAngle_=r}handleUpEvent(t){return!Ls(t)||(t.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(t){return!!Ls(t)&&(!(!Gs(t)||!this.condition_(t))&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0))}},js=class extends y{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,i="px",s=this.element_.style;s.left=Math.min(t[0],e[0])+i,s.top=Math.min(t[1],e[1])+i,s.width=Math.abs(e[0]-t[0])+i,s.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const t=this.startPixel_,e=this.endPixel_,i=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);i[4]=i[0].slice(),this.geometry_?this.geometry_.setCoordinates([i]):this.geometry_=new Yi([i])}getGeometry(){return this.geometry_}},qs="boxcancel";class Us extends b{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}const Bs=class extends Fs{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new js(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??Gs,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const s=i[0]-e[0],n=i[1]-e[1];return s*s+n*n>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new Us("boxdrag",t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new Us(e?"boxend":qs,t.coordinate,t)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Us("boxstart",t.coordinate,t)),!0)}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Us(qs,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Us(qs,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}},Ks=class extends Bs{constructor(t){super({condition:(t=t||{}).condition?t.condition:Ts,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=void 0!==t.duration?t.duration:200,this.out_=void 0!==t.out&&t.out}onBoxEnd(t){const e=this.getMap().getView();let i=this.getGeometry();if(this.out_){const t=e.rotatedExtentForGeometry(i),s=e.getResolutionForExtentInternal(t),n=e.getResolution()/s;i=i.clone(),i.scale(n*n)}e.fitInternal(i,{duration:this.duration_,easing:Ht})}},Xs="ArrowLeft",Ws="ArrowRight",Zs="ArrowDown",Vs=class extends Ss{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return As(t)&&Os(t)},this.condition_=void 0!==t.condition?t.condition:this.defaultCondition_,this.duration_=void 0!==t.duration?t.duration:100,this.pixelDelta_=void 0!==t.pixelDelta?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==f){const i=t.originalEvent,s=i.key;if(this.condition_(t)&&(s==Zs||s==Xs||s==Ws||"ArrowUp"==s)){const n=t.map.getView(),r=n.getResolution()*this.pixelDelta_;let o=0,a=0;s==Zs?a=-r:s==Xs?o=-r:s==Ws?o=r:a=r;const h=[o,a];Zt(h,n.getRotation()),function(t,e,i){const s=t.getCenterInternal();if(s){const n=[s[0]+e[0],s[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:Qt,center:t.getConstrainedCenter(n)})}}(n,h,this.duration_),i.preventDefault(),e=!0}}return!e}},Ys=class extends Ss{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!function(t){const e=t.originalEvent;return U?e.metaKey:e.ctrlKey}(t)&&Os(t)},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:100}handleEvent(t){let e=!1;if(t.type==f||t.type==_){const i=t.originalEvent,s=i.key;if(this.condition_(t)&&("+"===s||"-"===s)){const n=t.map,r="+"===s?this.delta_:-this.delta_;Es(n.getView(),r,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}},Hs=class extends Ss{constructor(t){super(t=t||{}),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=void 0!==t.maxDelta?t.maxDelta:1,this.duration_=void 0!==t.duration?t.duration:250,this.timeout_=void 0!==t.timeout?t.timeout:80,this.useAnchor_=void 0===t.useAnchor||t.useAnchor,this.constrainResolution_=void 0!==t.constrainResolution&&t.constrainResolution;const e=t.condition?t.condition:Is;this.condition_=t.onFocusOnly?Ps(Rs,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300,this.ctrlKeyPressed_=!1,this.ctrlKeyListenerKeys_=[]}setMap(t){if(this.ctrlKeyListenerKeys_.forEach(c),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(t),t){const e=t.getOwnerDocument();this.ctrlKeyListenerKeys_.push(h(e,"keydown",t=>{"Control"===t.key&&(this.ctrlKeyPressed_=!0)}),h(e,"keyup",t=>{"Control"===t.key&&(this.ctrlKeyPressed_=!1)}))}}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;const e=t.getView(),i=this.lastDelta_?this.lastDelta_>0?1:-1:0;e.endInteraction(this.constrainResolution_||e.getConstrainResolution()?100:void 0,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(t){if(!this.condition_(t))return!0;if(t.type!==m)return!0;const e=t.map,i=t.originalEvent;i.preventDefault();const s=i.ctrlKey&&!this.ctrlKeyPressed_;i.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=t.pixel);let n=i.deltaY;switch(i.deltaMode){case WheelEvent.DOM_DELTA_LINE:n*=40;break;case WheelEvent.DOM_DELTA_PAGE:n*=300}if(0===n)return!1;this.lastDelta_=n;const r=Date.now();void 0===this.startTime_&&(this.startTime_=r),(!this.mode_||r-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(n)<4?"trackpad":"wheel");const o=e.getView();if("trackpad"===this.mode_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(o.getAnimating()&&o.cancelAnimations(),o.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),s&&(n*=3),o.adjustZoom(-n/this.deltaPerZoom_,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=r,!1;this.totalDelta_+=n;const a=Math.max(this.timeout_-(r-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,e),a),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-at(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),Es(e,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}},$s=class extends Fs{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=E),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==t.threshold?t.threshold:.3,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],s=this.targetPointers[1],n=Math.atan2(s.clientY-i.clientY,s.clientX-i.clientX);if(void 0!==this.lastAngle_){const t=n-this.lastAngle_;this.rotationDelta_+=t,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=t}this.lastAngle_=n;const r=t.map,o=r.getView();o.getConstraints().rotation!==ts&&(this.anchor_=r.getCoordinateFromPixelInternal(r.getEventPixel(ks(this.targetPointers))),this.rotating_&&(r.render(),o.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){return!(this.targetPointers.length<2)||(t.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}},Qs=class extends Fs{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=E),super(e),this.anchor_=null,this.duration_=void 0!==t.duration?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],s=this.targetPointers[1],n=i.clientX-s.clientX,r=i.clientY-s.clientY,o=Math.sqrt(n*n+r*r);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;const a=t.map,h=a.getView();1!=e&&(this.lastScaleDelta_=e),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(ks(this.targetPointers))),a.render(),h.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map.getView(),i=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,i),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}};function Js(t){t=t||{};const e=new k,i=new ws(-.005,.05,100);return(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new Ds),(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new bs({delta:t.zoomDelta,duration:t.zoomDuration})),(void 0===t.dragPan||t.dragPan)&&e.push(new zs({onFocusOnly:t.onFocusOnly,kinetic:i})),(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new $s),(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new Qs({duration:t.zoomDuration})),(void 0===t.keyboard||t.keyboard)&&(e.push(new Vs),e.push(new Ys({delta:t.zoomDelta,duration:t.zoomDuration}))),(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new Hs({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration})),(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new Ks({duration:t.zoomDuration})),e}const tn="opacity",en="visible",sn="extent",nn="zIndex",rn="maxResolution",on="minResolution",an="maxZoom",hn="minZoom",ln="source",cn=class extends O{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[tn]=void 0!==t.opacity?t.opacity:1,it("number"==typeof e[tn],"Layer opacity must be a number"),e[en]=void 0===t.visible||t.visible,e[nn]=t.zIndex,e[rn]=void 0!==t.maxResolution?t.maxResolution:1/0,e[on]=void 0!==t.minResolution?t.minResolution:0,e[hn]=void 0!==t.minZoom?t.minZoom:-1/0,e[an]=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=at(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 I()}getLayerStatesArray(t){return I()}getExtent(){return this.get(sn)}getMaxResolution(){return this.get(rn)}getMinResolution(){return this.get(on)}getMinZoom(){return this.get(hn)}getMaxZoom(){return this.get(an)}getOpacity(){return this.get(tn)}getSourceState(){return I()}getVisible(){return this.get(en)}getZIndex(){return this.get(nn)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(sn,t)}setMaxResolution(t){this.set(rn,t)}setMinResolution(t){this.set(on,t)}setMaxZoom(t){this.set(an,t)}setMinZoom(t){this.set(hn,t)}setOpacity(t){it("number"==typeof t,"Layer opacity must be a number"),this.set(tn,t)}setVisible(t){this.set(en,t)}setZIndex(t){this.set(nn,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},un="addlayer",dn="removelayer";class gn extends b{constructor(t,e){super(t),this.layer=e}}const fn="layers";class _n extends cn{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(fn,this.handleLayersChanged_),i?Array.isArray(i)?i=new k(i.slice(),{unique:!0}):it("function"==typeof i.getArray,"Expected `layers` to be an array or a `Collection`"):i=new k(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(c),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(h(t,s,this.handleLayersAdd_,this),h(t,n,this.handleLayersRemove_,this));for(const t in this.listenerKeys_)this.listenerKeys_[t].forEach(c);o(this.listenerKeys_);const e=t.getArray();for(let t=0,i=e.length;t<i;t++){const i=e[t];this.registerLayerListeners_(i),this.dispatchEvent(new gn(un,i))}this.changed()}registerLayerListeners_(t){const e=[h(t,r,this.handleLayerChange_,this),h(t,u,this.handleLayerChange_,this)];t instanceof _n&&e.push(h(t,un,this.handleLayerGroupAdd_,this),h(t,dn,this.handleLayerGroupRemove_,this)),this.listenerKeys_[A(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new gn(un,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new gn(dn,t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new gn(un,e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=A(e);this.listenerKeys_[i].forEach(c),delete this.listenerKeys_[i],this.dispatchEvent(new gn(dn,e)),this.changed()}getLayers(){return this.get(fn)}setLayers(t){const e=this.getLayers();if(e){const t=e.getArray();for(let e=0,i=t.length;e<i;++e)this.dispatchEvent(new gn(dn,t[e]))}this.set(fn,t)}getLayersArray(t){return t=void 0!==t?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=void 0!==t?t:[],i=e.length;this.getLayers().forEach(function(t){t.getLayerStatesArray(e)});const s=this.getLayerState();let n=s.zIndex;t||void 0!==s.zIndex||(n=0);for(let t=i,r=e.length;t<r;t++){const i=e[t];i.opacity*=s.opacity,i.visible=i.visible&&s.visible,i.maxResolution=Math.min(i.maxResolution,s.maxResolution),i.minResolution=Math.max(i.minResolution,s.minResolution),i.minZoom=Math.max(i.minZoom,s.minZoom),i.maxZoom=Math.min(i.maxZoom,s.maxZoom),void 0!==s.extent&&(void 0!==i.extent?i.extent=jt(i.extent,s.extent):i.extent=s.extent),void 0===i.zIndex&&(i.zIndex=n)}return e}getSourceState(){return"ready"}}const pn=_n,mn="prerender",yn="postrender",vn="precompose",Mn="rendercomplete";function wn(t,e){if(!t.visible)return!1;const i=e.resolution;if(i<t.minResolution||i>=t.maxResolution)return!1;const s=e.zoom;return s>t.minZoom&&s<=t.maxZoom}const xn=class extends cn{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(ln,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(ln)||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_&&(c(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=h(t,u,this.handleSourceChange_,this),"ready"===t.getState()&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const i=this.getMapInternal();let s;if(!t&&i&&(t=i.getView()),e=t instanceof rs?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),e.layerStatesArray){if(s=e.layerStatesArray.find(t=>t.layer===this),!s)return!1}else s=this.getLayerState();const n=this.getExtent();return wn(s,e.viewState)&&(!n||Kt(n,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];let i=e(t instanceof rs?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_&&(c(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(c(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=h(t,vn,this.handlePrecompose_,this),this.mapRenderKey_=h(this,u,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);it(!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(ln,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()}};function En(t,e,i=0,s=t.length-1,n=bn){for(;s>i;){if(s-i>600){const r=s-i+1,o=e-i+1,a=Math.log(r),h=.5*Math.exp(2*a/3),l=.5*Math.sqrt(a*h*(r-h)/r)*(o-r/2<0?-1:1);En(t,e,Math.max(i,Math.floor(e-o*h/r+l)),Math.min(s,Math.floor(e+(r-o)*h/r+l)),n)}const r=t[e];let o=i,a=s;for(Sn(t,i,e),n(t[s],r)>0&&Sn(t,i,s);o<a;){for(Sn(t,o,a),o++,a--;n(t[o],r)<0;)o++;for(;n(t[a],r)>0;)a--}0===n(t[i],r)?Sn(t,i,a):(a++,Sn(t,a,s)),a<=e&&(i=a+1),e<=a&&(s=a-1)}}function Sn(t,e,i){const s=t[e];t[e]=t[i],t[i]=s}function bn(t,e){return t<e?-1:t>e?1:0}class Pn{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(!zn(t,e))return i;const s=this.toBBox,n=[];for(;e;){for(let r=0;r<e.children.length;r++){const o=e.children[r],a=e.leaf?s(o):o;zn(t,a)&&(e.leaf?i.push(o):Fn(t,a)?this._all(o,i):n.push(o))}e=n.pop()}return i}collides(t){let e=this.data;if(!zn(t,e))return!1;const i=[];for(;e;){for(let s=0;s<e.children.length;s++){const n=e.children[s],r=e.leaf?this.toBBox(n):n;if(zn(t,r)){if(e.leaf||Fn(t,r))return!0;i.push(n)}}e=i.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(let e=0;e<t.length;e++)this.insert(t[e]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Dn([]),this}remove(t,e){if(!t)return this;let i=this.data;const s=this.toBBox(t),n=[],r=[];let o,a,h;for(;i||n.length;){if(i||(i=n.pop(),a=n[n.length-1],o=r.pop(),h=!0),i.leaf){const s=Cn(t,i.children,e);if(-1!==s)return i.children.splice(s,1),n.push(i),this._condense(n),this}h||i.leaf||!Fn(i,s)?a?(o++,i=a.children[o],h=!1):i=null:(n.push(i),r.push(o),o=0,a=i,i=i.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,s){const n=i-e+1;let r,o=this._maxEntries;if(n<=o)return r=Dn(t.slice(e,i+1)),Rn(r,this.toBBox),r;s||(s=Math.ceil(Math.log(n)/Math.log(o)),o=Math.ceil(n/Math.pow(o,s-1))),r=Dn([]),r.leaf=!1,r.height=s;const a=Math.ceil(n/o),h=a*Math.ceil(Math.sqrt(o));jn(t,e,i,h,this.compareMinX);for(let n=e;n<=i;n+=h){const e=Math.min(n+h-1,i);jn(t,n,e,a,this.compareMinY);for(let i=n;i<=e;i+=a){const n=Math.min(i+a-1,e);r.children.push(this._build(t,i,n,s-1))}}return Rn(r,this.toBBox),r}_chooseSubtree(t,e,i,s){for(;s.push(e),!e.leaf&&s.length-1!==i;){let i,s=1/0,n=1/0;for(let r=0;r<e.children.length;r++){const o=e.children[r],a=On(o),h=Nn(t,o)-a;h<n?(n=h,s=a<s?a:s,i=o):h===n&&a<s&&(s=a,i=o)}e=i||e.children[0]}return e}_insert(t,e,i){const s=i?t:this.toBBox(t),n=[],r=this._chooseSubtree(s,this.data,e,n);for(r.children.push(t),Gn(r,s);e>=0&&n[e].children.length>this._maxEntries;)this._split(n,e),e--;this._adjustParentBBoxes(s,n,e)}_split(t,e){const i=t[e],s=i.children.length,n=this._minEntries;this._chooseSplitAxis(i,n,s);const r=this._chooseSplitIndex(i,n,s),o=Dn(i.children.splice(r,i.children.length-r));o.height=i.height,o.leaf=i.leaf,Rn(i,this.toBBox),Rn(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=Dn([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Rn(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let s,n=1/0,r=1/0;for(let o=e;o<=i-e;o++){const e=In(t,0,o,this.toBBox),a=In(t,o,i,this.toBBox),h=kn(e,a),l=On(e)+On(a);h<n?(n=h,s=o,r=l<r?l:r):h===n&&l<r&&(r=l,s=o)}return s||i-e}_chooseSplitAxis(t,e,i){const s=t.leaf?this.compareMinX:An,n=t.leaf?this.compareMinY:Tn;this._allDistMargin(t,e,i,s)<this._allDistMargin(t,e,i,n)&&t.children.sort(s)}_allDistMargin(t,e,i,s){t.children.sort(s);const n=this.toBBox,r=In(t,0,e,n),o=In(t,i-e,i,n);let a=Ln(r)+Ln(o);for(let s=e;s<i-e;s++){const e=t.children[s];Gn(r,t.leaf?n(e):e),a+=Ln(r)}for(let s=i-e-1;s>=e;s--){const e=t.children[s];Gn(o,t.leaf?n(e):e),a+=Ln(o)}return a}_adjustParentBBoxes(t,e,i){for(let s=i;s>=0;s--)Gn(e[s],t)}_condense(t){for(let e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children,e.splice(e.indexOf(t[i]),1)):this.clear():Rn(t[i],this.toBBox)}}function Cn(t,e,i){if(!i)return e.indexOf(t);for(let s=0;s<e.length;s++)if(i(t,e[s]))return s;return-1}function Rn(t,e){In(t,0,t.children.length,e,t)}function In(t,e,i,s,n){n||(n=Dn(null)),n.minX=1/0,n.minY=1/0,n.maxX=-1/0,n.maxY=-1/0;for(let r=e;r<i;r++){const e=t.children[r];Gn(n,t.leaf?s(e):e)}return n}function Gn(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 An(t,e){return t.minX-e.minX}function Tn(t,e){return t.minY-e.minY}function On(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Ln(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Nn(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 kn(t,e){const i=Math.max(t.minX,e.minX),s=Math.max(t.minY,e.minY),n=Math.min(t.maxX,e.maxX),r=Math.min(t.maxY,e.maxY);return Math.max(0,n-i)*Math.max(0,r-s)}function Fn(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function zn(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function Dn(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function jn(t,e,i,s,n){const r=[e,i];for(;r.length;){if((i=r.pop())-(e=r.pop())<=s)continue;const o=e+Math.ceil((i-e)/s/2)*s;En(t,o,e,i,n),r.push(e,o,o,i)}}const qn=[NaN,NaN,NaN,0];let Un;const Bn=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Kn=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Xn=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Wn=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Zn(t,e){return t.endsWith("%")?Number(t.substring(0,t.length-1))/e:Number(t)}function Vn(t){throw new Error('failed to parse "'+t+'" as color')}function Yn(t){if(t.toLowerCase().startsWith("rgb")){const e=t.match(Kn)||t.match(Bn)||t.match(Xn);if(e){const t=e[4],i=100/255;return[at(Zn(e[1],i)+.5|0,0,255),at(Zn(e[2],i)+.5|0,0,255),at(Zn(e[3],i)+.5|0,0,255),void 0!==t?at(Zn(t,100),0,1):1]}Vn(t)}if(t.startsWith("#")){if(Wn.test(t)){const e=t.substring(1),i=e.length<=4?1:2,s=[0,0,0,255];for(let t=0,n=e.length;t<n;t+=i){let n=parseInt(e.substring(t,t+i),16);1===i&&(n+=n<<4),s[t/i]=n}return s[3]=s[3]/255,s}Vn(t)}const e=(Un||(Un=cs(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),Un);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&&Vn(t));const s=e.fillStyle;if(s.startsWith("#")||s.startsWith("rgba"))return Yn(s);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);const n=Array.from(e.getImageData(0,0,1,1).data);return n[3]=ft(n[3]/255,3),n}const Hn={};let $n=0;function Qn(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function Jn(t){return t>.0031308?269.025*Math.pow(t,1/2.4)-14.025:3294.6*t}function tr(t){return t>.2068965?Math.pow(t,3):108/841*(t-4/29)}function er(t){return t>10.314724?Math.pow((t+14.025)/269.025,2.4):t/3294.6}function ir(t){return t>.0088564?Math.pow(t,1/3):t/(108/841)+4/29}function sr(t){const e=er(t[0]),i=er(t[1]),s=er(t[2]),n=ir(.222488403*e+.716873169*i+.06060791*s),r=500*(ir(.452247074*e+.399439023*i+.148375274*s)-n),o=200*(n-ir(.016863605*e+.117638439*i+.865350722*s)),a=Math.atan2(o,r)*(180/Math.PI);return[116*n-16,Math.sqrt(r*r+o*o),a<0?a+360:a,t[3]]}function nr(t){if("none"===t)return qn;if(Hn.hasOwnProperty(t))return Hn[t];if($n>=1024){let t=0;for(const e in Hn)3&t++||(delete Hn[e],--$n)}const e=Yn(t);4!==e.length&&Vn(t);for(const i of e)isNaN(i)&&Vn(t);return Hn[t]=e,++$n,e}function rr(t){return Array.isArray(t)?t:nr(t)}function or(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let s=t[2];return s!=(0|s)&&(s=s+.5|0),"rgba("+e+","+i+","+s+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}function ar(t){return t[0]>0&&t[1]>0}function hr(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}let lr=0;const cr=1<<lr++,ur=1<<lr++,dr=1<<lr++,gr=1<<lr++,fr=1<<lr++,_r=1<<lr++,pr=Math.pow(2,6)-1,mr={[cr]:"boolean",[ur]:"number",[dr]:"string",[gr]:"color",[fr]:"number[]",[_r]:"size"},yr=Object.keys(mr).map(Number).sort(v);function vr(t){const e=[];for(const i of yr)Mr(t,i)&&e.push(mr[i]);return 0===e.length?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function Mr(t,e){return(t&e)===e}function wr(t,e){return t===e}class xr{constructor(t,e){if(!function(t){return t in mr}(t))throw new Error(`literal expressions must have a specific type, got ${vr(t)}`);this.type=t,this.value=e}}class Er{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function Sr(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1}}function br(t,e,i){switch(typeof t){case"boolean":if(wr(e,dr))return new xr(dr,t?"true":"false");if(!Mr(e,cr))throw new Error(`got a boolean, but expected ${vr(e)}`);return new xr(cr,t);case"number":if(wr(e,_r))return new xr(_r,hr(t));if(wr(e,cr))return new xr(cr,!!t);if(wr(e,dr))return new xr(dr,t.toString());if(!Mr(e,ur))throw new Error(`got a number, but expected ${vr(e)}`);return new xr(ur,t);case"string":if(wr(e,gr))return new xr(gr,nr(t));if(wr(e,cr))return new xr(cr,!!t);if(!Mr(e,dr))throw new Error(`got a string, but expected ${vr(e)}`);return new xr(dr,t)}if(!Array.isArray(t))throw new Error("expression must be an array or a primitive value");if(0===t.length)throw new Error("empty expression");if("string"==typeof t[0])return function(t,e,i){const s=t[0],n=Mo[s];if(!n)throw new Error(`unknown operator: ${s}`);return n(t,e,i)}(t,e,i);for(const e of t)if("number"!=typeof e)throw new Error("expected an array of numbers");if(wr(e,_r)){if(2!==t.length)throw new Error(`expected an array of two values for a size, got ${t.length}`);return new xr(_r,t)}if(wr(e,gr)){if(3===t.length)return new xr(gr,[...t,1]);if(4===t.length)return new xr(gr,t);throw new Error(`expected an array of 3 or 4 values for a color, got ${t.length}`)}if(!Mr(e,fr))throw new Error(`got an array of numbers, but expected ${vr(e)}`);return new xr(fr,t)}const Pr="get",Cr="var",Rr="concat",Ir="geometry-type",Gr="line-metric",Ar="any",Tr="all",Or="!",Lr="resolution",Nr="zoom",kr="time",Fr="==",zr="!=",Dr=">",jr=">=",qr="<",Ur="<=",Br="*",Kr="/",Xr="+",Wr="-",Zr="clamp",Vr="%",Yr="^",Hr="abs",$r="floor",Qr="ceil",Jr="round",to="sin",eo="cos",io="atan",so="sqrt",no="match",ro="between",oo="interpolate",ao="coalesce",ho="case",lo="in",co="number",uo="string",go="array",fo="color",_o="id",po="band",mo="palette",yo="to-string",vo="has",Mo={[Pr]:Ro(So(1,1/0),wo),[Cr]:Ro(So(1,1),function(t,e,i){const s=t[1];if("string"!=typeof s)throw new Error("expected a string argument for var operation");return i.variables.add(s),[new xr(dr,s)]}),[vo]:Ro(So(1,1/0),wo),[_o]:Ro(function(t,e,i){i.featureId=!0},Eo),[Rr]:Ro(So(2,1/0),Po(dr)),[Ir]:Ro(function(t,e,i){i.geometryType=!0},Eo),[Gr]:Ro(function(t,e,i){i.mCoordinate=!0},Eo),[Lr]:Ro(xo,Eo),[Nr]:Ro(xo,Eo),[kr]:Ro(xo,Eo),[Ar]:Ro(So(2,1/0),Po(cr)),[Tr]:Ro(So(2,1/0),Po(cr)),[Or]:Ro(So(1,1),Po(cr)),[Fr]:Ro(So(2,2),Po(pr)),[zr]:Ro(So(2,2),Po(pr)),[Dr]:Ro(So(2,2),Po(ur)),[jr]:Ro(So(2,2),Po(ur)),[qr]:Ro(So(2,2),Po(ur)),[Ur]:Ro(So(2,2),Po(ur)),[Br]:Ro(So(2,1/0),bo),[ao]:Ro(So(2,1/0),bo),[Kr]:Ro(So(2,2),Po(ur)),[Xr]:Ro(So(2,1/0),Po(ur)),[Wr]:Ro(So(2,2),Po(ur)),[Zr]:Ro(So(3,3),Po(ur)),[Vr]:Ro(So(2,2),Po(ur)),[Yr]:Ro(So(2,2),Po(ur)),[Hr]:Ro(So(1,1),Po(ur)),[$r]:Ro(So(1,1),Po(ur)),[Qr]:Ro(So(1,1),Po(ur)),[Jr]:Ro(So(1,1),Po(ur)),[to]:Ro(So(1,1),Po(ur)),[eo]:Ro(So(1,1),Po(ur)),[io]:Ro(So(1,2),Po(ur)),[so]:Ro(So(1,1),Po(ur)),[no]:Ro(So(4,1/0),Co,function(t,e,i){const s=t.length-1,n=dr|ur|cr,r=br(t[1],n,i),o=br(t[t.length-1],e,i),a=new Array(s-2);for(let e=0;e<s-2;e+=2){try{const s=br(t[e+2],r.type,i);a[e]=s}catch(t){throw new Error(`failed to parse argument ${e+1} of match expression: ${t.message}`)}try{const s=br(t[e+3],o.type,i);a[e+1]=s}catch(t){throw new Error(`failed to parse argument ${e+2} of match expression: ${t.message}`)}}return[r,...a,o]}),[ro]:Ro(So(3,3),Po(ur)),[oo]:Ro(So(6,1/0),Co,function(t,e,i){const s=t[1];let n;switch(s[0]){case"linear":n=1;break;case"exponential":const t=s[1];if("number"!=typeof t||t<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(t)} instead`);n=t;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(s)}`)}const r=new xr(ur,n);let o;try{o=br(t[2],ur,i)}catch(t){throw new Error(`failed to parse argument 1 in interpolate expression: ${t.message}`)}const a=new Array(t.length-3);for(let s=0;s<a.length;s+=2){try{const e=br(t[s+3],ur,i);a[s]=e}catch(t){throw new Error(`failed to parse argument ${s+2} for interpolate expression: ${t.message}`)}try{const n=br(t[s+4],e,i);a[s+1]=n}catch(t){throw new Error(`failed to parse argument ${s+3} for interpolate expression: ${t.message}`)}}return[r,o,...a]}),[ho]:Ro(So(3,1/0),function(t,e,i){const s=t[0],n=t.length-1;if(n%2==0)throw new Error(`expected an odd number of arguments for ${s}, got ${n} instead`)},function(t,e,i){const s=br(t[t.length-1],e,i),n=new Array(t.length-1);for(let e=0;e<n.length-1;e+=2){try{const s=br(t[e+1],cr,i);n[e]=s}catch(t){throw new Error(`failed to parse argument ${e} of case expression: ${t.message}`)}try{const r=br(t[e+2],s.type,i);n[e+1]=r}catch(t){throw new Error(`failed to parse argument ${e+1} of case expression: ${t.message}`)}}return n[n.length-1]=s,n}),[lo]:Ro(So(2,2),function(t,e,i){let s,n=t[2];if(!Array.isArray(n))throw new Error('the second argument for the "in" operator must be an array');if("literal"===n[0]){if(n=n[1],!Array.isArray(n))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if("string"==typeof n[0])throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');s="string"==typeof n[0]?dr:ur;const r=new Array(n.length);for(let t=0;t<r.length;t++)try{const e=br(n[t],s,i);r[t]=e}catch(e){throw new Error(`failed to parse haystack item ${t} for "in" expression: ${e.message}`)}return[br(t[1],s,i),...r]}),[co]:Ro(So(1,1/0),Po(pr)),[uo]:Ro(So(1,1/0),Po(pr)),[go]:Ro(So(1,1/0),Po(ur)),[fo]:Ro(So(1,4),Po(ur)),[po]:Ro(So(1,3),Po(ur)),[mo]:Ro(So(2,2),function(t,e,i){let s;try{s=br(t[1],ur,i)}catch(t){throw new Error(`failed to parse first argument in palette expression: ${t.message}`)}const n=t[2];if(!Array.isArray(n))throw new Error("the second argument of palette must be an array");const r=new Array(n.length);for(let t=0;t<r.length;t++){let e;try{e=br(n[t],gr,i)}catch(e){throw new Error(`failed to parse color at index ${t} in palette expression: ${e.message}`)}if(!(e instanceof xr))throw new Error(`the palette color at index ${t} must be a literal value`);r[t]=e}return[s,...r]}),[yo]:Ro(So(1,1),Po(cr|ur|dr|gr))};function wo(t,e,i){const s=t.length-1,n=new Array(s);for(let e=0;e<s;++e){const s=t[e+1];switch(typeof s){case"number":n[e]=new xr(ur,s);break;case"string":n[e]=new xr(dr,s);break;default:throw new Error(`expected a string key or numeric array index for a get operation, got ${s}`)}0===e&&i.properties.add(String(s))}return n}function xo(t,e,i){i.mapState=!0}function Eo(t,e,i){const s=t[0];if(1!==t.length)throw new Error(`expected no arguments for ${s} operation`);return[]}function So(t,e){return function(i,s,n){const r=i[0],o=i.length-1;if(t===e){if(o!==t)throw new Error(`expected ${t} argument${1===t?"":"s"} for ${r}, got ${o}`)}else if(o<t||o>e)throw new Error(`expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${r}, got ${o}`)}}function bo(t,e,i){const s=t.length-1,n=new Array(s);for(let r=0;r<s;++r){const s=br(t[r+1],e,i);n[r]=s}return n}function Po(t){return function(e,i,s){const n=e.length-1,r=new Array(n);for(let i=0;i<n;++i){const n=br(e[i+1],t,s);r[i]=n}return r}}function Co(t,e,i){const s=t[0],n=t.length-1;if(n%2==1)throw new Error(`expected an even number of arguments for operation ${s}, got ${n} instead`)}function Ro(...t){return function(e,i,s){const n=e[0];let r;for(let n=0;n<t.length;n++){const o=t[n](e,i,s);if(n==t.length-1){if(!o)throw new Error("expected last argument validator to return the parsed args");r=o}}return new Er(i,n,...r)}}function Io(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 Io(t.getGeometries()[0]);default:return""}}function Go(t,e,i){return Ao(br(t,e,i),i)}function Ao(t,e){if(t instanceof xr){if(t.type===gr&&"string"==typeof t.value){const e=nr(t.value);return function(){return e}}return function(){return t.value}}const i=t.operator;switch(i){case co:case uo:case ao:return function(t,e){const i=t.operator,s=t.args.length,n=new Array(s);for(let i=0;i<s;++i)n[i]=Ao(t.args[i],e);switch(i){case ao:return t=>{for(let e=0;e<s;++e){const i=n[e](t);if(null!=i)return i}throw new Error("Expected one of the values to be non-null")};case co:case uo:return t=>{for(let e=0;e<s;++e){const s=n[e](t);if(typeof s===i)return s}throw new Error(`Expected one of the values to be a ${i}`)};default:throw new Error(`Unsupported assertion operator ${i}`)}}(t,e);case Pr:case Cr:case vo:return function(t){const e=t.args[0].value;switch(t.operator){case Pr:return i=>{const s=t.args;let n=i.properties[e];for(let t=1,e=s.length;t<e;++t)n=n[s[t].value];return n};case Cr:return t=>t.variables[e];case vo:return i=>{const s=t.args;if(!(e in i.properties))return!1;let n=i.properties[e];for(let t=1,e=s.length;t<e;++t){const e=s[t].value;if(!n||!Object.hasOwn(n,e))return!1;n=n[e]}return!0};default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}(t);case"id":return t=>t.featureId;case Ir:return t=>t.geometryType;case Rr:{const i=t.args.map(t=>Ao(t,e));return t=>"".concat(...i.map(e=>e(t).toString()))}case Lr:return t=>t.resolution;case Ar:case Tr:case ro:case lo:case"!":return function(t,e){const i=t.operator,s=t.args.length,n=new Array(s);for(let i=0;i<s;++i)n[i]=Ao(t.args[i],e);switch(i){case Ar:return t=>{for(let e=0;e<s;++e)if(n[e](t))return!0;return!1};case Tr:return t=>{for(let e=0;e<s;++e)if(!n[e](t))return!1;return!0};case ro:return t=>{const e=n[0](t),i=n[1](t),s=n[2](t);return e>=i&&e<=s};case lo:return t=>{const e=n[0](t);for(let i=1;i<s;++i)if(e===n[i](t))return!0;return!1};case"!":return t=>!n[0](t);default:throw new Error(`Unsupported logical operator ${i}`)}}(t,e);case Fr:case zr:case"<":case Ur:case">":case jr:return function(t,e){const i=t.operator,s=Ao(t.args[0],e),n=Ao(t.args[1],e);switch(i){case Fr:return t=>s(t)===n(t);case zr:return t=>s(t)!==n(t);case"<":return t=>s(t)<n(t);case Ur:return t=>s(t)<=n(t);case">":return t=>s(t)>n(t);case jr:return t=>s(t)>=n(t);default:throw new Error(`Unsupported comparison operator ${i}`)}}(t,e);case"*":case"/":case"+":case"-":case Zr:case"%":case"^":case Hr:case $r:case Qr:case Jr:case to:case eo:case io:case so:return function(t,e){const i=t.operator,s=t.args.length,n=new Array(s);for(let i=0;i<s;++i)n[i]=Ao(t.args[i],e);switch(i){case"*":return t=>{let e=1;for(let i=0;i<s;++i)e*=n[i](t);return e};case"/":return t=>n[0](t)/n[1](t);case"+":return t=>{let e=0;for(let i=0;i<s;++i)e+=n[i](t);return e};case"-":return t=>n[0](t)-n[1](t);case Zr:return t=>{const e=n[0](t),i=n[1](t);if(e<i)return i;const s=n[2](t);return e>s?s:e};case"%":return t=>n[0](t)%n[1](t);case"^":return t=>Math.pow(n[0](t),n[1](t));case Hr:return t=>Math.abs(n[0](t));case $r:return t=>Math.floor(n[0](t));case Qr:return t=>Math.ceil(n[0](t));case Jr:return t=>Math.round(n[0](t));case to:return t=>Math.sin(n[0](t));case eo:return t=>Math.cos(n[0](t));case io:return 2===s?t=>Math.atan2(n[0](t),n[1](t)):t=>Math.atan(n[0](t));case so:return t=>Math.sqrt(n[0](t));default:throw new Error(`Unsupported numeric operator ${i}`)}}(t,e);case ho:return function(t,e){const i=t.args.length,s=new Array(i);for(let n=0;n<i;++n)s[n]=Ao(t.args[n],e);return t=>{for(let e=0;e<i-1;e+=2)if(s[e](t))return s[e+1](t);return s[i-1](t)}}(t,e);case no:return function(t,e){const i=t.args.length,s=new Array(i);for(let n=0;n<i;++n)s[n]=Ao(t.args[n],e);return t=>{const e=s[0](t);for(let n=1;n<i-1;n+=2)if(e===s[n](t))return s[n+1](t);return s[i-1](t)}}(t,e);case oo:return function(t,e){const i=t.args.length,s=new Array(i);for(let n=0;n<i;++n)s[n]=Ao(t.args[n],e);return t=>{const e=s[0](t),n=s[1](t);let r,o;for(let a=2;a<i;a+=2){const i=s[a](t);let h=s[a+1](t);const l=Array.isArray(h);if(l&&(h=Qn(h)),i>=n)return 2===a?h:l?Oo(e,n,r,o,i,h):To(e,n,r,o,i,h);r=i,o=h}return o}}(t,e);case yo:return function(t,e){const i=t.operator,s=t.args.length,n=new Array(s);for(let i=0;i<s;++i)n[i]=Ao(t.args[i],e);if(i===yo)return e=>{const i=n[0](e);return t.args[0].type===gr?or(i):i.toString()};throw new Error(`Unsupported convert operator ${i}`)}(t,e);default:throw new Error(`Unsupported operator ${i}`)}}function To(t,e,i,s,n,r){const o=n-i;if(0===o)return s;const a=e-i;return s+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(r-s)}function Oo(t,e,i,s,n,r){if(0===n-i)return s;const o=sr(s),a=sr(r);let h=a[2]-o[2];return h>180?h-=360:h<-180&&(h+=360),function(t){const e=(t[0]+16)/116,i=t[1],s=t[2]*Math.PI/180,n=tr(e),r=tr(e+i/500*Math.cos(s)),o=tr(e-i/200*Math.sin(s)),a=Jn(3.021973625*r-1.617392459*n-.404875592*o),h=Jn(-.943766287*r+1.916279586*n+.027607165*o),l=Jn(.069407491*r-.22898585*n+1.159737864*o);return[at(a+.5|0,0,255),at(h+.5|0,0,255),at(l+.5|0,0,255),t[3]]}([To(t,e,i,o[0],n,a[0]),To(t,e,i,o[1],n,a[1]),o[2]+To(t,e,i,0,n,h),To(t,e,i,s[3],n,r[3])])}function Lo(t,e){return t+":"+(e?rr(e):"null")}const No=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=Lo(t,e);return i in this.cache_?this.cache_[i]:null}getPattern(t,e){const i=Lo(t,e);return i in this.patternCache_?this.patternCache_[i]:null}set(t,e,i,s){const n=Lo(t,e),r=n in this.cache_;this.cache_[n]=i,s&&(0===i.getImageState()&&i.load(),1===i.getImageState()?i.ready().then(()=>{this.patternCache_[n]=ds().createPattern(i.getImage(1),"repeat")}):this.patternCache_[n]=ds().createPattern(i.getImage(1),"repeat")),r||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};let ko=null;class Fo extends P{constructor(t,e,i,s,n){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i?.crossOrigin,this.referrerPolicy_=i?.referrerPolicy,this.canvas_={},this.color_=n,this.imageState_=void 0===s?0:s,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(void 0===this.tainted_&&2===this.imageState_){ko||(ko=cs(1,1,void 0,{willReadFrequently:!0})),ko.drawImage(this.image_,0,0);try{ko.getImageData(0,0,1,1),this.tainted_=!1}catch{ko=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(u)}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=cs(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&&X?new Promise((e,i)=>t.decode().then(()=>e(t)).catch(s=>t.complete&&t.width?e(t):i(s))):function(t){return new Promise((e,i)=>{function s(){r(),e(t)}function n(){r(),i(new Error("Image load error"))}function r(){t.removeEventListener("load",s),t.removeEventListener("error",n)}t.addEventListener("load",s),t.addEventListener("error",n)})}(t)).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=cs(Math.ceil(e.width*t),Math.ceil(e.height*t)),s=i.canvas;var n;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle="string"==typeof(n=this.color_)?n:or(n),i.fillRect(0,0,s.width/t,s.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=s}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(2===this.imageState_||3===this.imageState_)t();else{const e=()=>{2!==this.imageState_&&3!==this.imageState_||(this.removeEventListener(u,e),t())};this.addEventListener(u,e)}})),this.ready_}}function zo(t,e,i,s,n,r){let o=void 0===e?void 0:No.get(e,n);return o||(o=new Fo(t,t&&"src"in t?t.src||void 0:e,i,s,n),No.set(e,n,o,r)),r&&o&&!No.getPattern(e,n)&&No.set(e,n,o,r),o}const Do=Fo;function jo(t){return t?Array.isArray(t)?or(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return No.getPattern(t.src,t.color);const e=t.src+":"+t.offset,i=No.getPattern(e,t.color);if(i)return i;const s=No.get(t.src,null);if(2!==s.getImageState())return null;const n=cs(t.size[0],t.size[1]);return n.drawImage(s.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),zo(n.canvas,e,void 0,2,t.color,!0),No.getPattern(e,t.color)}(t):t:null}const qo="#000",Uo="round",Bo="round",Ko=new O;new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);class Xo{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=hr(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new Xo({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 I()}getImage(t){return I()}getHitDetectionImage(){return I()}getPixelRatio(t){return 1}getImageState(){return I()}getImageSize(){return I()}getOrigin(){return I()}getSize(){return I()}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_=hr(t)}listenImageChange(t){I()}load(){I()}unlistenImageChange(t){I()}ready(){return Promise.resolve()}}const Wo=Xo;class Zo extends Wo{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 Zo({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let s=No.get(i,null)?.getImage(1);if(!s){const e=this.renderOptions_,n=Math.ceil(e.size*t),r=cs(n,n);this.draw_(e,r,t),s=r.canvas;const o=new Do(s,void 0,null,2,null);No.set(i,null,o),createImageBitmap(s).then(t=>{o.setImage(t)})}return s}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(t){this.radius!==t&&(this.radius=t,this.render())}getRadius2(){return this.radius2_}setRadius2(t){this.radius2_!==t&&(this.radius2_=t,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let s=this.radius,n=void 0===this.radius2_?s:this.radius2_;if(s<n){const t=s;s=n,n=t}const r=void 0===this.radius2_?this.points_:2*this.points_,o=2*Math.PI/r,a=n*Math.sin(o),h=s-Math.sqrt(n*n-a*a),l=Math.sqrt(a*a+h*h),c=l/a;if("miter"===t&&c<=i)return c*e;const u=e/2/c,d=e/2*(h/l),g=Math.sqrt((s+u)*(s+u)+d*d)-s;if(void 0===this.radius2_||"bevel"===t)return 2*g;const f=s*Math.sin(o),_=n-Math.sqrt(s*s-f*f),p=Math.sqrt(f*f+_*_)/f;if(p<=i){const t=p*e/2-n-s;return 2*Math.max(g,t)}return 2*g}createRenderOptions(){let t,e=Uo,i=Bo,s=0,n=null,r=0,o=0;this.stroke_&&(t=jo(this.stroke_.getColor()??"#000"),o=this.stroke_.getWidth()??1,n=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,i=this.stroke_.getLineJoin()??Bo,e=this.stroke_.getLineCap()??Uo,s=this.stroke_.getMiterLimit()??10);const a=this.calculateLineJoinSize_(i,o,s),h=Math.max(this.radius,this.radius2_||0);return{strokeStyle:t,strokeWidth:o,size:Math.ceil(2*h+a),lineCap:e,lineDash:n,lineDashOffset:r,lineJoin:i,miterLimit:s}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let t=this.fill_.getColor();null===t&&(t=qo),e.fillStyle=jo(t),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),s=0;"string"==typeof i&&(i=rr(i)),null===i?s=1:Array.isArray(i)&&(s=4===i.length?i[3]:1),0===s&&(e=cs(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const s=void 0===this.radius2_?i:this.radius2_;void 0!==this.radius2_&&(e*=2);const n=this.angle_-Math.PI/2,r=2*Math.PI/e;for(let o=0;o<e;o++){const e=n+o*r,a=o%2==0?i:s;t.lineTo(a*Math.cos(e),a*Math.sin(e))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=qo,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()}}const Vo=Zo;class Yo extends Vo{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 Yo({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}}const Ho=Yo;class $o{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 $o({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=zo(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?A(t):"object"==typeof t&&"src"in t?t.src+":"+t.offset:rr(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}const Qo=$o;function Jo(t,e,i,s){return void 0!==i&&void 0!==s?[i/t,s/e]:void 0!==i?i/t:void 0!==s?s/e:1}class ta extends Wo{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,s=void 0!==t.scale?t.scale:1,n=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:s,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:n,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy;const r=void 0!==t.img?t.img:null;let o,a=t.src;if(it(!(void 0!==a&&r),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!r||(a=r.src||A(r)),it(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),it(!((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!==r&&(o="complete"in r?r.complete?r.src?2:0:1:2),this.color_=void 0!==t.color?rr(t.color):null,this.iconImage_=zo(r,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},o,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,this.initialOptions_,void 0!==t.width||void 0!==t.height){let e,i;if(t.size)[e,i]=t.size;else{const s=this.getImage(1);if(s.width&&s.height)e=s.width,i=s.height;else if(s instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(Jo(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(Jo(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 ta({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?rr(t):null;if(this.color_===e||this.color_&&e&&this.color_.length===e.length&&this.color_.every((t,i)=>t===e[i]))return;this.color_=e;const i=this.getSrc(),s=void 0!==i?null:this.getHitDetectionImage(),n=void 0!==i?0:this.iconImage_.getImageState();this.iconImage_=zo(s,i,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},n,this.color_)}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if("top-left"!=this.offsetOrigin_){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=zo(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(u,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(u,t)}ready(){return this.iconImage_.ready()}}const ea=ta;class ia{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 ia({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}}const sa=ia;class na{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=aa,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 na({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_=aa,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let ra=null;function oa(t,e){if(!ra){const t=new Qo({color:"rgba(255,255,255,0.4)"}),e=new sa({color:"#3399CC",width:1.25});ra=[new na({image:new Ho({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return ra}function aa(t){return t.getGeometry()}const ha=na;class la{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_=hr(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 Qo({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 la({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 Qo?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_=hr(void 0!==t?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}const ca=la;function ua(t){return!0}function da(t){const e=Sr(),i=function(t,e){const i=t.length,s=new Array(i);for(let n=0;n<i;++n){const i=t[n],r="filter"in i?Go(i.filter,cr,e):ua;let o;if(Array.isArray(i.style)){const t=i.style.length;o=new Array(t);for(let s=0;s<t;++s)o[s]=fa(i.style[s],e)}else o=[fa(i.style,e)];s[n]={filter:r,styles:o}}return function(e){const n=[];let r=!1;for(let o=0;o<i;++o)if((0,s[o].filter)(e)&&(!t[o].else||!r)){r=!0;for(const t of s[o].styles){const i=t(e);i&&n.push(i)}}return n}}(t,e),s={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""};return function(t,n){if(s.properties=t.getPropertiesInternal(),s.resolution=n,e.featureId){const e=t.getId();s.featureId=void 0!==e?e:null}return e.geometryType&&(s.geometryType=Io(t.getGeometry())),i(s)}}function ga(t){const e=Sr(),i=t.length,s=new Array(i);for(let n=0;n<i;++n)s[n]=fa(t[n],e);const n={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""},r=new Array(i);return function(t,o){if(n.properties=t.getPropertiesInternal(),n.resolution=o,e.featureId){const e=t.getId();n.featureId=void 0!==e?e:null}let a=0;for(let t=0;t<i;++t){const e=s[t](n);e&&(r[a]=e,a+=1)}return r.length=a,r}}function fa(t,e){const i=_a(t,"",e),s=pa(t,"",e),n=function(t,e){const i="text-",s=va(t,i+"value",e);if(!s)return null;const n=_a(t,i,e),r=_a(t,i+"background-",e),o=pa(t,i,e),a=pa(t,i+"background-",e),h=va(t,i+"font",e),l=ya(t,i+"max-angle",e),c=ya(t,i+"offset-x",e),u=ya(t,i+"offset-y",e),d=Ma(t,i+"overflow",e),g=va(t,i+"placement",e),f=ya(t,i+"repeat",e),_=ba(t,i+"scale",e),p=Ma(t,i+"rotate-with-view",e),m=ya(t,i+"rotation",e),y=va(t,i+"align",e),v=va(t,i+"justify",e),M=va(t,i+"baseline",e),w=Ma(t,i+"keep-upright",e),x=xa(t,i+"padding",e),E=Ia(t,i+"declutter-mode"),S=new ca({declutterMode:E});return function(t){if(S.setText(s(t)),n&&S.setFill(n(t)),r&&S.setBackgroundFill(r(t)),o&&S.setStroke(o(t)),a&&S.setBackgroundStroke(a(t)),h&&S.setFont(h(t)),l&&S.setMaxAngle(l(t)),c&&S.setOffsetX(c(t)),u&&S.setOffsetY(u(t)),d&&S.setOverflow(d(t)),g){const e=g(t);if("point"!==e&&"line"!==e)throw new Error("Expected point or line for text-placement");S.setPlacement(e)}if(f&&S.setRepeat(f(t)),_&&S.setScale(_(t)),p&&S.setRotateWithView(p(t)),m&&S.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");S.setTextAlign(e)}if(v){const e=v(t);if("left"!==e&&"right"!==e&&"center"!==e)throw new Error("Expected left, right, or center for text-justify");S.setJustify(e)}if(M){const e=M(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");S.setTextBaseline(e)}return x&&S.setPadding(x(t)),w&&S.setKeepUpright(w(t)),S}}(t,e),r=function(t,e){return"icon-src"in t?function(t,e){const i="icon-",s=i+"src",n=Aa(t[s],s),r=Ea(t,i+"anchor",e),o=ba(t,i+"scale",e),a=ya(t,i+"opacity",e),h=Ea(t,i+"displacement",e),l=ya(t,i+"rotation",e),c=Ma(t,i+"rotate-with-view",e),u=Ca(t,i+"anchor-origin"),d=Ra(t,i+"anchor-x-units"),g=Ra(t,i+"anchor-y-units"),f=ma(t,i+"color");let _,p=null;void 0!==f&&(Array.isArray(f)&&f.length>0&&"string"==typeof f[0]?p=wa(t,i+"color",e):_=Oa(f,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 Ga(i,e)}(t,i+"offset"),v=Ca(t,i+"offset-origin"),M=Pa(t,i+"width"),w=Pa(t,i+"height"),x=function(t,e){const i=t[e];if(void 0!==i){if("number"==typeof i)return hr(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"),E={src:n,anchorOrigin:u,anchorXUnits:d,anchorYUnits:g,crossOrigin:m,offset:y,offsetOrigin:v,height:w,width:M,size:x,declutterMode:Ia(t,i+"declutter-mode")};let S=null;return function(t){if(S)p&&S.setColor(p(t));else{const e=p?p(t):_;S=new ea(void 0!==e?Object.assign({},E,{color:e}):Object.assign({},E))}return a&&S.setOpacity(a(t)),h&&S.setDisplacement(h(t)),l&&S.setRotation(l(t)),c&&S.setRotateWithView(c(t)),o&&S.setScale(o(t)),r&&S.setAnchor(r(t)),S}}(t,e):"shape-points"in t?function(t,e){const i="shape-",s=i+"points",n=i+"radius",r=Ta(t[s],s);if(!(n in t))throw new Error(`Expected a number for ${n}`);const o=ya(t,n,e),a="number"==typeof t[n]?t[n]:5,h=i+"radius2",l=ya(t,h,e),c="number"==typeof t[h]?t[h]:void 0,u=_a(t,i,e),d=pa(t,i,e),g=ba(t,i+"scale",e),f=Ea(t,i+"displacement",e),_=ya(t,i+"rotation",e),p=Ma(t,i+"rotate-with-view",e),m=Pa(t,i+"angle"),y=Ia(t,i+"declutter-mode"),v=new Vo({points:r,radius:a,radius2:c,angle:m,declutterMode:y});return function(t){return o&&v.setRadius(o(t)),l&&v.setRadius2(l(t)),u&&v.setFill(u(t)),d&&v.setStroke(d(t)),f&&v.setDisplacement(f(t)),_&&v.setRotation(_(t)),p&&v.setRotateWithView(p(t)),g&&v.setScale(g(t)),v}}(t,e):"circle-radius"in t?function(t,e){const i="circle-",s=_a(t,i,e),n=pa(t,i,e),r=ya(t,i+"radius",e),o=ba(t,i+"scale",e),a=Ea(t,i+"displacement",e),h=ya(t,i+"rotation",e),l=Ma(t,i+"rotate-with-view",e),c=Ia(t,i+"declutter-mode"),u=new Ho({radius:5,declutterMode:c});return function(t){return r&&u.setRadius(r(t)),s&&u.setFill(s(t)),n&&u.setStroke(n(t)),a&&u.setDisplacement(a(t)),h&&u.setRotation(h(t)),l&&u.setRotateWithView(l(t)),o&&u.setScale(o(t)),u}}(t,e):null}(t,e),o=ya(t,"z-index",e);if(!(i||s||n||r||a(t)))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(t));const h=new ha;return function(t){let e=!0;if(i){const s=i(t);s&&(e=!1),h.setFill(s)}if(s){const i=s(t);i&&(e=!1),h.setStroke(i)}if(n){const i=n(t);i&&(e=!1),h.setText(i)}if(r){const i=r(t);i&&(e=!1),h.setImage(i)}return o&&h.setZIndex(o(t)),e?null:h}}function _a(t,e,i){let s;if(e+"fill-pattern-src"in t)s=function(t,e,i){const s=va(t,e+"pattern-src",i),n=Sa(t,e+"pattern-offset",i),r=Sa(t,e+"pattern-size",i),o=wa(t,e+"color",i);return function(t){return{src:s(t),offset:n&&n(t),size:r&&r(t),color:o&&o(t)}}}(t,e+"fill-",i);else{if("none"===t[e+"fill-color"])return t=>null;s=wa(t,e+"fill-color",i)}if(!s)return null;const n=new Qo;return function(t){const e=s(t);return e===qn?null:(n.setColor(e),n)}}function pa(t,e,i){const s=ya(t,e+"stroke-width",i),n=wa(t,e+"stroke-color",i);if(!s&&!n)return null;const r=va(t,e+"stroke-line-cap",i),o=va(t,e+"stroke-line-join",i),a=xa(t,e+"stroke-line-dash",i),h=ya(t,e+"stroke-line-dash-offset",i),l=ya(t,e+"stroke-miter-limit",i),c=ya(t,e+"stroke-offset",i),u=new sa;return function(t){if(n){const e=n(t);if(e===qn)return null;u.setColor(e)}if(s&&u.setWidth(s(t)),r){const e=r(t);if("butt"!==e&&"round"!==e&&"square"!==e)throw new Error("Expected butt, round, or square line cap");u.setLineCap(e)}if(o){const e=o(t);if("bevel"!==e&&"round"!==e&&"miter"!==e)throw new Error("Expected bevel, round, or miter line join");u.setLineJoin(e)}return a&&u.setLineDash(a(t)),h&&u.setLineDashOffset(h(t)),l&&u.setMiterLimit(l(t)),c&&u.setOffset(c(t)),u}}function ma(t,e){if(!(e in t))return;const i=t[e];return void 0===i?void 0:i}function ya(t,e,i){const s=ma(t,e);if(void 0===s)return;const n=Go(s,ur,i);return function(t){return Ta(n(t),e)}}function va(t,e,i){const s=ma(t,e);if(void 0===s)return null;const n=Go(s,dr,i);return function(t){return Aa(n(t),e)}}function Ma(t,e,i){const s=ma(t,e);if(void 0===s)return null;const n=Go(s,cr,i);return function(t){const i=n(t);if("boolean"!=typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function wa(t,e,i){const s=ma(t,e);if(void 0===s)return null;const n=Go(s,gr,i);return function(t){return Oa(n(t),e)}}function xa(t,e,i){const s=ma(t,e);if(void 0===s)return null;if(Array.isArray(s)&&(0===s.length||"string"!=typeof s[0])){const t=s.map((t,s)=>{if("number"==typeof t)return()=>t;const n=Go(t,ur,i);return function(t){return Ta(n(t),`${e}[${s}]`)}});return function(e){const i=new Array(t.length);for(let s=0;s<t.length;++s)i[s]=t[s](e);return i}}const n=Go(s,fr,i);return function(t){return Ga(n(t),e)}}function Ea(t,e,i){const s=ma(t,e);if(void 0===s)return null;const n=Go(s,fr,i);return function(t){const i=Ga(n(t),e);if(2!==i.length)throw new Error(`Expected two numbers for ${e}`);return i}}function Sa(t,e,i){const s=ma(t,e);if(void 0===s)return null;const n=Go(s,fr,i);return function(t){return La(n(t),e)}}function ba(t,e,i){const s=ma(t,e);if(void 0===s)return null;const n=Go(s,fr|ur,i);return function(t){return i=n(t),s=e,"number"==typeof i?i:La(i,s);var i,s}}function Pa(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 Ca(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 Ra(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 Ia(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 Ga(t,e){if(!Array.isArray(t))throw new Error(`Expected an array for ${e}`);const i=t.length;for(let s=0;s<i;++s)if("number"!=typeof t[s])throw new Error(`Expected an array of numbers for ${e}`);return t}function Aa(t,e){if("string"!=typeof t)throw new Error(`Expected a string for ${e}`);return t}function Ta(t,e){if("number"!=typeof t)throw new Error(`Expected a number for ${e}`);return t}function Oa(t,e){if("string"==typeof t)return t;const i=Ga(t,e),s=i.length;if(s<3||s>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function La(t,e){const i=Ga(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}const Na="renderOrder",ka=class extends xn{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(Na)}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 Pn(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Na,t)}setStyle(t){this.style_=void 0===t?oa:t;const e=function(t){if(void 0===t)return oa;if(!t)return null;if("function"==typeof t)return t;if(t instanceof ha)return t;if(!Array.isArray(t))return ga([t]);if(0===t.length)return[];const e=t.length,i=t[0];if(i instanceof ha){const i=new Array(e);for(let s=0;s<e;++s){const e=t[s];if(!(e instanceof ha))throw new Error("Expected a list of style instances");i[s]=e}return i}if("style"in i){const i=new Array(e);for(let s=0;s<e;++s){const e=t[s];if(!("style"in e))throw new Error("Expected a list of rules with a style property");i[s]=e}return da(i)}return ga(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:(it("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()}},Fa=class extends b{constructor(t,e,i,s){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=s}};function za(t,e){No.expire()}const Da=class extends y{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){I()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,s=t.pixelToCoordinateTransform;vi(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Mi(s,i)}forEachFeatureAtCoordinate(t,e,i,s,n,r,o,a){let h;const l=e.viewState;function c(t,e,i,s){return n.call(r,e,t?i:null,s)}const u=l.projection,d=function(t,e){if(e.canWrapX()){const i=Bt(e.getExtent()),s=Vt(t,e,i);s&&(t[0]-=s*i)}return t}(t.slice(),u),g=[[0,0]];if(u.canWrapX()&&s){const t=Bt(u.getExtent());g.push([-t,0],[t,0])}const f=e.layerStatesArray,_=f.length,p=[],m=[];for(let s=0;s<g.length;s++)for(let n=_-1;n>=0;--n){const r=f[n],u=r.layer;if(u.hasRenderer()&&wn(r,l)&&o.call(a,u)){const n=u.getRenderer(),o=u.getSource();if(n&&o){const a=o.getWrapX()?d:t,l=c.bind(null,r.managed);m[0]=a[0]+g[s][0],m[1]=a[1]+g[s][1],h=n.forEachFeatureAtCoordinate(m,e,i,l,p)}if(h)return h}}if(0===p.length)return;const y=1/p.length;return p.forEach((t,e)=>t.distanceSq+=e*y),p.sort((t,e)=>t.distanceSq-e.distanceSq),p.some(t=>h=t.callback(t.feature,t.layer,t.geometry)),h}hasFeatureAtCoordinate(t,e,i,s,n,r){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,s,x,this,n,r)}getMap(){return this.map_}renderFrame(t){I()}scheduleExpireIconCache(t){No.canExpireCache()&&t.postRenderFunctions.push(za)}},ja=class extends Da{constructor(t){super(t),this.fontChangeListenerKey_=h(Ko,r,t.redrawText,t),this.element_=K?_s():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=as+" ol-layers";const i=t.getViewport();i&&i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const s=new Fa(t,void 0,e);i.dispatchEvent(s)}}disposeInternal(){c(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t)return void(this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1));this.calculateMatrices2D(t),this.dispatchRenderEvent(vn,t);const e=t.layerStatesArray.sort((t,e)=>t.zIndex-e.zIndex);e.some(t=>t.layer instanceof ka&&t.layer.getDeclutter())&&(t.declutter={});const i=t.viewState;this.children_.length=0;const s=[];let n=null;for(let r=0,o=e.length;r<o;++r){const o=e[r];t.layerIndex=r;const a=o.layer,h=a.getSourceState();if(!wn(o,i)||"ready"!=h&&"undefined"!=h){a.unrender();continue}const l=a.render(t,n);l&&(l!==n&&(this.children_.push(l),n=l),s.push(o))}this.declutter(t,s),function(t,e){const i=t.childNodes;for(let s=0;;++s){const n=i[s],r=e[s];if(!n&&!r)break;n!==r&&(n?r?t.insertBefore(r,n):(t.removeChild(n),--s):t.appendChild(r))}}(this.element_,this.children_);const r=this.getMap().getTargetElement();if(ps(r)){const t=r.getContext("2d");for(const e of this.children_){const i=e.firstElementChild||e,s=e.style.backgroundColor;if(s&&(!ps(i)||i.width>0)&&(t.fillStyle=s,t.fillRect(0,0,r.width,r.height)),ps(i)&&i.width>0){t.save();const s=e.style.opacity||i.style.opacity;t.globalAlpha=""===s?1:Number(s);const n=i.style.transform;if(n)t.transform(...xi(n));else{const e=parseFloat(i.style.width)/i.width,s=parseFloat(i.style.height)/i.height;t.transform(e,0,0,s,0,0)}t.drawImage(i,0,0),t.restore()}}}this.dispatchRenderEvent("postcompose",t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){const s=e[i],n=s.layer;n.getDeclutter()&&n.renderDeclutter(t,s)}e.forEach(e=>e.layer.renderDeferred(t))}}};function qa(t){t instanceof xn?t.setMapInternal(null):t instanceof pn&&t.getLayers().forEach(qa)}function Ua(t,e){if(t instanceof xn)t.setMapInternal(e);else if(t instanceof pn){const i=t.getLayers().getArray();for(let t=0,s=i.length;t<s;++t)Ua(i[t],e)}}const Ba=class extends O{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=function(t){let e=null;void 0!==t.keyboardEventTarget&&(e="string"==typeof t.keyboardEventTarget?document.getElementById(t.keyboardEventTarget):t.keyboardEventTarget);const i={},s=t.layers&&"function"==typeof t.layers.getLayers?t.layers:new pn({layers:t.layers});let n,r,o;return i[Q]=s,i[tt]=t.target,i[et]=t.view instanceof rs?t.view:new rs,void 0!==t.controls&&(Array.isArray(t.controls)?n=new k(t.controls.slice()):(it("function"==typeof t.controls.getArray,"Expected `controls` to be an array or an `ol/Collection.js`"),n=t.controls)),void 0!==t.interactions&&(Array.isArray(t.interactions)?r=new k(t.interactions.slice()):(it("function"==typeof t.interactions.getArray,"Expected `interactions` to be an array or an `ol/Collection.js`"),r=t.interactions)),void 0!==t.overlays?Array.isArray(t.overlays)?o=new k(t.overlays.slice()):(it("function"==typeof t.overlays.getArray,"Expected `overlays` to be an array or an `ol/Collection.js`"),o=t.overlays):o=new k,{controls:n,interactions:r,keyboardEventTarget:e,overlays:o,values:i}}(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=void 0!==t.maxTilesLoading?t.maxTilesLoading:16,this.pixelRatio_=void 0!==t.pixelRatio?t.pixelRatio:B,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=[1,0,0,1,0,0],this.pixelToCoordinateTransform_=[1,0,0,1,0,0],this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,K||(this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=t.moveTolerance,this.keyboardEventTarget_=e.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,K||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=e.controls||(K?new k:function(t){t=t||{};const e=new k;return(void 0===t.zoom||t.zoom)&&e.push(new Ms(t.zoomOptions)),(void 0===t.rotate||t.rotate)&&e.push(new vs(t.rotateOptions)),(void 0===t.attribution||t.attribution)&&e.push(new ys(t.attributionOptions)),e}()),this.interactions=e.interactions||(K?new k:Js({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new rt(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Q,this.handleLayerGroupChanged_),this.addChangeListener(et,this.handleViewChanged_),this.addChangeListener(J,this.handleSizeChanged_),this.addChangeListener(tt,this.handleTargetChanged_),this.setProperties(e.values);const i=this;!t.view||t.view instanceof rs||t.view.then(function(t){i.setView(new rs(t))}),this.controls.addEventListener(s,t=>{t.element.setMap(this)}),this.controls.addEventListener(n,t=>{t.element.setMap(null)}),this.interactions.addEventListener(s,t=>{t.element.setMap(this)}),this.interactions.addEventListener(n,t=>{t.element.setMap(null)}),this.overlays_.addEventListener(s,t=>{this.addOverlayInternal_(t.element)}),this.overlays_.addEventListener(n,t=>{const e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)}),this.controls.forEach(t=>{t.setMap(this)}),this.interactions.forEach(t=>{t.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){Ua(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(t),n=void 0!==(i=void 0!==i?i:{}).hitTolerance?i.hitTolerance:0,r=void 0!==i.layerFilter?i.layerFilter:x,o=!1!==i.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,n,o,e,null,r,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,function(t){i.push(t)},e),i}getAllLayers(){const t=[];return function e(i){i.forEach(function(i){i instanceof pn?e(i.getLayers()):t.push(i)})}(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t),s=void 0!==(e=void 0!==e?e:{}).layerFilter?e.layerFilter:x,n=void 0!==e.hitTolerance?e.hitTolerance:0,r=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,n,r,s,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const e=this.viewport_.getBoundingClientRect(),i=this.getSize(),s=e.width/i[0],n=e.height/i[1],r="changedTouches"in t?t.changedTouches[0]:t;return[(r.clientX-e.left)/s,(r.clientY-e.top)/n]}getTarget(){return this.get(tt)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return ui(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?yi(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(Q)}setLayers(t){const e=this.getLayerGroup();if(t instanceof k)return void e.setLayers(t);const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){const i=t[e];if(!i.visible)continue;const s=i.layer.getRenderer();if(s&&!s.ready)return!0;const n=i.layer.getSource();if(n&&n.loading)return!0}return!1}getPixelFromCoordinate(t){const e=di(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?yi(e.coordinateToPixelTransform,t.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(t){this.pixelRatio_!==t&&(this.pixelRatio_=t,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(J)}getView(){return this.get(et)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,s){return function(t,e,i,s,n){if(!t||!(i in t.wantedTiles))return st;if(!t.wantedTiles[i][e.getKey()])return st;const r=t.viewState.center,o=s[0]-r[0],a=s[1]-r[1];return 65536*Math.log(n)+Math.sqrt(o*o+a*a)/n}(this.frameState_,t,e,i,s)}handleBrowserEvent(t,e){e=e||t.type;const i=new z(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===Z||i===m||i===f){const t=this.getOwnerDocument(),i=this.viewport_.getRootNode?this.viewport_.getRootNode():t,s=e.target,n=i instanceof ShadowRoot?i.host===s?i.host.ownerDocument:i:i===t?t.documentElement:i;if(this.overlayContainerStopEvent_.contains(s)||!n.contains(s))return}if(t.frameState=this.frameState_,!1!==this.dispatchEvent(t)){const e=this.getInteractions().getArray().slice();for(let i=e.length-1;i>=0;i--){const s=e[i];if(s.getMap()===this&&s.getActive()&&this.getTargetElement()&&(!s.handleEvent(t)||t.propagationStopped))break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let i=this.maxTilesLoading_,s=i;const n=t?t.viewHints:void 0,r=!!n&&(n[0]||n[1]);if(r){const e=Date.now()-t.time>8;i=e?0:8,s=e?0:2}e.getTilesLoading()<i&&(r&&e.reprioritize(),e.loadMoreTiles(i,s))}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(Mn)&&this.renderer_.dispatchRenderEvent(Mn,t),!1===this.loaded_&&(this.loaded_=!0,this.dispatchEvent(new F($,this,t)))):!0===this.loaded_&&(this.loaded_=!1,this.dispatchEvent(new F(H,this,t))));const i=this.postRenderFunctions_;if(t)for(let e=0,s=i.length;e<s;++e)i[e](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let t=0,e=this.targetChangeHandlerKeys_.length;t<e;++t)c(this.targetChangeHandlerKeys_[t]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(d,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(m,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!ps(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);const t=this.targetElement_.getRootNode();t instanceof ShadowRoot&&this.resizeObserver_.unobserve(t.host),this.setSize(void 0)}const t=this.getTarget(),e="string"==typeof t?document.getElementById(t):t;if(this.targetElement_=e,e){if(ps(e)||e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new ja(this)),!ps(e)){this.mapBrowserEventHandler_=new V(this,this.moveTolerance_);for(const t in D)this.mapBrowserEventHandler_.addEventListener(D[t],this.handleMapBrowserEvent.bind(this));let t;if(this.viewport_.addEventListener(d,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(m,this.boundHandleBrowserEvent_,!!W&&{passive:!1}),this.keyboardEventTarget_)t=this.keyboardEventTarget_;else{const i=e.getRootNode();t=i instanceof ShadowRoot?i.host:e}if(this.targetChangeHandlerKeys_=[h(t,f,this.handleBrowserEvent,this),h(t,_,this.handleBrowserEvent,this)],e instanceof HTMLElement){const t=e.getRootNode();t instanceof ShadowRoot&&this.resizeObserver_.observe(t.host),this.resizeObserver_?.observe(e)}}this.updateSize()}else this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0)}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(c(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(c(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=h(t,r,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=h(t,u,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(c),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new gn("addlayer",t)),this.layerGroupPropertyListenerKeys_=[h(t,r,this.render,this),h(t,u,this.render,this),h(t,"addlayer",this.handleLayerAdd_,this),h(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;const t=this.frameState_.layerStatesArray;for(let e=0,i=t.length;e<i;++e){const i=t[e].layer;i.hasRenderer()&&i.getRenderer().handleFontsChanged()}}render(){this.renderer_&&void 0===this.animationDelayKey_&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){qa(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),s=this.frameState_;let n=null;if(void 0!==e&&ar(e)&&i&&i.isDef()){const s=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),r=i.getState();if(n={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Ft(r.center,r.resolution,r.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:r,viewHints:s,wantedTiles:{},mapId:A(this),renderTargets:{}},r.nextCenter&&r.nextResolution){const t=isNaN(r.nextRotation)?r.rotation:r.nextRotation;n.nextExtent=Ft(r.nextCenter,r.nextResolution,t,e)}}var r,o;this.frameState_=n,this.renderer_.renderFrame(n),n&&(n.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,n.postRenderFunctions),s&&(!this.previousExtent_||!Xt(this.previousExtent_)&&!Ct(n.extent,this.previousExtent_))&&(this.dispatchEvent(new F("movestart",this,s)),this.previousExtent_=Pt(this.previousExtent_)),this.previousExtent_&&!n.viewHints[0]&&!n.viewHints[1]&&!Ct(n.extent,this.previousExtent_)&&(this.dispatchEvent(new F("moveend",this,n)),r=n.extent,(o=this.previousExtent_)?(o[0]=r[0],o[1]=r[1],o[2]=r[2],o[3]=r[3]):r.slice())),this.dispatchEvent(new F(Y,this,n)),this.renderComplete_=(this.hasListener(H)||this.hasListener($)||this.hasListener(Mn))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new gn("removelayer",e)),this.set(Q,t)}setSize(t){this.set(J,t)}setTarget(t){this.set(tt,t)}setView(t){if(!t||t instanceof rs)return void this.set(et,t);this.set(et,new rs);const e=this;t.then(function(t){e.setView(new rs(t))})}updateSize(){const t=this.getTargetElement();let e;if(t){let i,s;if(ps(t)){const e=t.getContext("2d").getTransform();i=t.width/e.a,s=t.height/e.d}else{const e=getComputedStyle(t);i=t.offsetWidth-parseFloat(e.borderLeftWidth)-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight)-parseFloat(e.borderRightWidth),s=t.offsetHeight-parseFloat(e.borderTopWidth)-parseFloat(e.paddingTop)-parseFloat(e.paddingBottom)-parseFloat(e.borderBottomWidth)}isNaN(i)||isNaN(s)||(e=[Math.max(0,i),Math.max(0,s)],!ar(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&ee("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&w(e,i)||(this.updateViewportSize_(e),this.setSize(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}},Ka=class extends P{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(u)}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(){I()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;const s=e-i+1e3/60;return s>=this.transition_?1:Yt(s/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}};function Xa(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageBitmap?t:null}const Wa=new Error("disposed"),Za=[256,256],Va=class extends Ka{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=Xa(this.data_);return t?[t.width,t.height]:Za}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(Wa),this.controller_=null),super.disposeInternal()}},Ya=class extends Ka{constructor(t,e,i,s,n,r){super(t,e,r),this.crossOrigin_=s?.crossOrigin,this.referrerPolicy_=s?.referrerPolicy,this.src_=i,this.key=i,this.image_,K?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=n}getImage(){return this.image_}setImage(t){this.image_=t,this.state=2,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=3,this.unlistenImage_(),this.image_=function(){const t=cs(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}handleImageLoad_(){if(K)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 s=t;let n=!0,r=!1,o=!1;const a=[l(s,"load",function(){o=!0,r||e()})];return s.src&&X?(r=!0,s.decode().then(function(){n&&e()}).catch(function(t){n&&(o?e():i())})):a.push(l(s,"error",i)),function(){n=!1,a.forEach(c)}}(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()}};class Ha{constructor(t,e,i,s){this.minX=t,this.maxX=e,this.minY=i,this.maxY=s}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function $a(t,e,i,s,n){return void 0!==n?(n.minX=t,n.maxX=e,n.minY=i,n.maxY=s,n):new Ha(t,e,i,s)}const Qa=Ha;let Ja;const th=[];function eh(t,e,i,s,n){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(s,n),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,s)+1,Math.max(i,n)),t.restore()}function ih(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function sh(t,e,i,s){const n=ai(i,e,t);let r=Qe(e,s,i);const o=e.getMetersPerUnit();void 0!==o&&(r*=o);const a=t.getMetersPerUnit();void 0!==a&&(r/=a);const h=t.getExtent();if(!h||xt(h,n)){const e=Qe(t,r,n)/r;isFinite(e)&&e>0&&(r/=e)}return r}const nh=class{constructor(t,e,i,s,n,r,o){this.sourceProj_=t,this.targetProj_=e;let a={};const h=o?ei(t=>yi(o,ai(t,this.targetProj_,this.sourceProj_))):oi(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){const e=t[0]+"/"+t[1];return a[e]||(a[e]=h(t)),a[e]},this.maxSourceExtent_=s,this.errorThresholdSquared_=n*n,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&Bt(s)>=Bt(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Bt(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Bt(this.targetProj_.getExtent()):null;const l=qt(i),c=Ut(i),u=Lt(i),d=Ot(i),g=this.transformInv_(l),f=this.transformInv_(c),_=this.transformInv_(u),p=this.transformInv_(d),m=10+(r?Math.max(0,Math.ceil(Math.log2(Tt(i)/(r*r*256*256)))):0);if(this.addQuad_(l,c,u,d,g,f,_,p,m),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach(function(e,i,s){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])}),this.triangles_.forEach(e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const i=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];i[0][0]-t>this.sourceWorldWidth_/2&&(i[0][0]-=this.sourceWorldWidth_),i[1][0]-t>this.sourceWorldWidth_/2&&(i[1][0]-=this.sourceWorldWidth_),i[2][0]-t>this.sourceWorldWidth_/2&&(i[2][0]-=this.sourceWorldWidth_);const s=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-s<this.sourceWorldWidth_/2&&(e.source=i)}})}a={}}addTriangle_(t,e,i,s,n,r){this.triangles_.push({source:[s,n,r],target:[t,e,i]})}addQuad_(t,e,i,s,n,r,o,a,h){const l=Mt([n,r,o,a]),c=this.sourceWorldWidth_?Bt(l)/this.sourceWorldWidth_:null,u=this.sourceWorldWidth_,d=this.sourceProj_.canWrapX()&&c>.5&&c<1;let g=!1;if(h>0&&(this.targetProj_.isGlobal()&&this.targetWorldWidth_&&(g=Bt(Mt([t,e,i,s]))/this.targetWorldWidth_>.25||g),!d&&this.sourceProj_.isGlobal()&&c&&(g=c>.25||g)),!g&&this.maxSourceExtent_&&isFinite(l[0])&&isFinite(l[1])&&isFinite(l[2])&&isFinite(l[3])&&!Kt(l,this.maxSourceExtent_))return;let f=0;if(!(g||isFinite(n[0])&&isFinite(n[1])&&isFinite(r[0])&&isFinite(r[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])))if(h>0)g=!0;else if(f=(isFinite(n[0])&&isFinite(n[1])?0:8)+(isFinite(r[0])&&isFinite(r[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=f&&2!=f&&4!=f&&8!=f)return;if(h>0){if(!g){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],s=this.transformInv_(e);let r;r=d?(dt(n[0],u)+dt(o[0],u))/2-dt(s[0],u):(n[0]+o[0])/2-s[0];const a=(n[1]+o[1])/2-s[1];g=r*r+a*a>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const l=[(e[0]+i[0])/2,(e[1]+i[1])/2],c=this.transformInv_(l),u=[(s[0]+t[0])/2,(s[1]+t[1])/2],d=this.transformInv_(u);this.addQuad_(t,e,l,u,n,r,c,d,h-1),this.addQuad_(u,l,i,s,d,c,o,a,h-1)}else{const l=[(t[0]+e[0])/2,(t[1]+e[1])/2],c=this.transformInv_(l),u=[(i[0]+s[0])/2,(i[1]+s[1])/2],d=this.transformInv_(u);this.addQuad_(t,l,u,s,n,c,d,a,h-1),this.addQuad_(l,e,i,u,c,r,o,d,h-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}11&f||this.addTriangle_(t,i,s,n,o,a),14&f||this.addTriangle_(t,i,e,n,o,r),f&&(13&f||this.addTriangle_(e,s,t,r,a,n),7&f||this.addTriangle_(e,s,i,r,a,o))}calculateSourceExtent(){const t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach(function(e,i,s){const n=e.source;Rt(t,n[0]),Rt(t,n[1]),Rt(t,n[2])}),t}getTriangles(){return this.triangles_}},rh=class extends Ka{constructor(t,e,i,s,n,r,o,a,h,l,c,u){super(n,0,u),this.renderEdges_=void 0!==c&&c,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=s,this.wrappedTileCoord_=r||n,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const d=s.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let f=this.sourceTileGrid_.getExtent();const _=g?jt(d,g):d;if(0===Tt(_))return void(this.state=4);const p=t.getExtent();p&&(f=f?jt(f,p):p);const m=s.getResolution(this.wrappedTileCoord_[0]),y=function(t,e,i,s){const n=Nt(i);let r=sh(t,e,n,s);return(!isFinite(r)||r<=0)&&At(i,function(i){return r=sh(t,e,i,s),isFinite(r)&&r>0}),r}(t,i,_,m);if(!isFinite(y)||y<=0)return void(this.state=4);const v=void 0!==l?l:.5;if(this.triangulation_=new nh(t,i,_,f,y*v,m),0===this.triangulation_.getTriangles().length)return void(this.state=4);this.sourceZ_=e.getZForResolution(y);let M=this.triangulation_.calculateSourceExtent();if(f&&(t.canWrapX()?(M[1]=at(M[1],f[1],f[3]),M[3]=at(M[3],f[1],f[3])):M=jt(M,f)),Tt(M)){let i=0,s=0;t.canWrapX()&&(i=Bt(p),s=Math.floor((M[0]-p[0])/i)),function(t,e,i){if(e.canWrapX()){const s=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[s[0],t[1],s[2],t[3]]];!function(t,e){const i=e.getExtent(),s=Nt(t);if(e.canWrapX()&&(s[0]<i[0]||s[0]>=i[2])){const e=Bt(i),n=Math.floor((s[0]-i[0])/e)*e;t[0]-=n,t[2]-=n}}(t,e);const n=Bt(s);if(Bt(t)>n&&!i)return[[s[0],t[1],s[2],t[3]]];if(t[0]<s[0])return[[t[0]+n,t[1],s[2],t[3]],[s[0],t[1],t[2],t[3]]];if(t[2]>s[2])return[[t[0],t[1],s[2],t[3]],[s[0],t[1],t[2]-n,t[3]]]}return[t]}(M.slice(),t,!0).forEach(t=>{const n=e.getTileRangeForExtentAndZ(t,this.sourceZ_);for(let t=n.minX;t<=n.maxX;t++)for(let e=n.minY;e<=n.maxY;e++){const n=s*i;this.sourceTiles_.push({getTile:()=>h(this.sourceZ_,t,e,o),offset:n})}++s}),0===this.sourceTiles_.length&&(this.state=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 s=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);s[0]+=e.offset,s[2]+=e.offset;const n=this.clipExtent_?.slice();n&&(n[0]+=e.offset,n[2]+=e.offset),t.push({extent:s,clipExtent:n,image:i.getImage()})}}),this.sourceTiles_.length=0,0===t.length)this.state=3;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),s="number"==typeof i?i:i[0],n="number"==typeof i?i:i[1],r=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=function(t,e,i,s,n,r,o,a,h,l,c,u,d,g){const f=cs(Math.round(i*t),Math.round(i*e),th);if(u||(f.imageSmoothingEnabled=!1),0===h.length)return f.canvas;function _(t){return Math.round(t*i)/i}f.scale(i,i),f.globalCompositeOperation="lighter";const p=[1/0,1/0,-1/0,-1/0];let m;h.forEach(function(t,e,i){var s,n;s=p,(n=t.extent)[0]<s[0]&&(s[0]=n[0]),n[2]>s[2]&&(s[2]=n[2]),n[1]<s[1]&&(s[1]=n[1]),n[3]>s[3]&&(s[3]=n[3])});const y=i/s,v=(u?1:1+Math.pow(2,-24))/y;if(!d||1!==h.length||0!==l){if(m=cs(Math.round(Bt(p)*y),Math.round(Dt(p)*y),th),u||(m.imageSmoothingEnabled=!1),n&&g){const t=(n[0]-p[0])*y,e=-(n[3]-p[3])*y,i=Bt(n)*y,s=Dt(n)*y;m.rect(t,e,i,s),m.clip()}h.forEach(function(t,e,i){if(t.image.width>0&&t.image.height>0){if(t.clipExtent){m.save();const e=(t.clipExtent[0]-p[0])*y,i=-(t.clipExtent[3]-p[3])*y,s=Bt(t.clipExtent)*y,n=Dt(t.clipExtent)*y;m.rect(u?e:Math.round(e),u?i:Math.round(i),u?s:Math.round(e+s)-Math.round(e),u?n:Math.round(i+n)-Math.round(i)),m.clip()}const e=(t.extent[0]-p[0])*y,i=-(t.extent[3]-p[3])*y,s=Bt(t.extent)*y,n=Dt(t.extent)*y;m.drawImage(t.image,l,l,t.image.width-2*l,t.image.height-2*l,u?e:Math.round(e),u?i:Math.round(i),u?s:Math.round(e+s)-Math.round(e),u?n:Math.round(i+n)-Math.round(i)),t.clipExtent&&m.restore()}})}const M=qt(o);return a.getTriangles().forEach(function(t,e,i){const s=t.source,n=t.target;let o=s[0][0],a=s[0][1],l=s[1][0],c=s[1][1],d=s[2][0],g=s[2][1];const y=_((n[0][0]-M[0])/r),w=_(-(n[0][1]-M[1])/r),x=_((n[1][0]-M[0])/r),E=_(-(n[1][1]-M[1])/r),S=_((n[2][0]-M[0])/r),b=_(-(n[2][1]-M[1])/r),P=o,C=a;o=0,a=0,l-=P,c-=C,d-=P,g-=C;const R=function(t){const e=t.length;for(let i=0;i<e;i++){let s=i,n=Math.abs(t[i][i]);for(let r=i+1;r<e;r++){const e=Math.abs(t[r][i]);e>n&&(n=e,s=r)}if(0===n)return null;const r=t[s];t[s]=t[i],t[i]=r;for(let s=i+1;s<e;s++){const n=-t[s][i]/t[i][i];for(let r=i;r<e+1;r++)i==r?t[s][r]=0:t[s][r]+=n*t[i][r]}}const i=new Array(e);for(let s=e-1;s>=0;s--){i[s]=t[s][e]/t[s][s];for(let n=s-1;n>=0;n--)t[n][e]-=t[n][s]*i[s]}return i}([[l,c,0,0,x-y],[d,g,0,0,S-y],[0,0,l,c,E-w],[0,0,d,g,b-w]]);if(!R)return;if(f.save(),f.beginPath(),function(){if(void 0===Ja){const t=cs(6,6,th);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",eh(t,4,5,4,0),eh(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;Ja=ih(e,0)||ih(e,4)||ih(e,8),gs(t),th.push(t.canvas)}return Ja}()||!u){f.moveTo(x,E);const t=4,e=y-x,i=w-E;for(let s=0;s<t;s++)f.lineTo(x+_((s+1)*e/t),E+_(s*i/(t-1))),s!=t-1&&f.lineTo(x+_((s+1)*e/t),E+_((s+1)*i/(t-1)));f.lineTo(S,b)}else f.moveTo(x,E),f.lineTo(y,w),f.lineTo(S,b);let I;if(f.clip(),f.transform(R[0],R[2],R[1],R[3],y,w),f.translate(p[0]-P,p[3]-C),m)I=m.canvas,f.scale(v,-v);else{const t=h[0],e=t.extent;I=t.image,f.scale(Bt(e)/I.width,-Dt(e)/I.height)}f.drawImage(I,0,0),f.restore()}),m&&(gs(m),th.push(m.canvas)),c&&(f.save(),f.globalCompositeOperation="source-over",f.strokeStyle="black",f.lineWidth=1,a.getTriangles().forEach(function(t,e,i){const s=t.target,n=(s[0][0]-M[0])/r,o=-(s[0][1]-M[1])/r,a=(s[1][0]-M[0])/r,h=-(s[1][1]-M[1])/r,l=(s[2][0]-M[0])/r,c=-(s[2][1]-M[1])/r;f.beginPath(),f.moveTo(a,h),f.lineTo(n,o),f.lineTo(l,c),f.closePath(),f.stroke()}),f.restore()),f.canvas}(s,n,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),r,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=h(e,u,s=>{const n=e.getState();2!=n&&3!=n&&4!=n||(c(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(c),this.sourcesListenerKeys_=null}release(){this.canvas_&&(gs(this.canvas_.getContext("2d")),th.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},oh=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 y&&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 it(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 it(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){it(!(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 ah(t,e,i,s){return void 0!==s?(s[0]=t,s[1]=e,s[2]=i,s):[t,e,i]}function hh(t,e,i,s,n){return`${A(t)},${e},${function(t,e,i){return t+"/"+e+"/"+i}(i,s,n)}`}const lh=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(ds(),{get:(t,e)=>{if("function"==typeof ds()[e])return this.push_(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_(t),this);pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let i=0,s=e.length;i<s;++i){const s=e[i];if("function"==typeof s){s(t);continue}const n=e[++i];if("function"==typeof t[s])t[s](...n);else{if("function"==typeof n){t[s]=n(t);continue}t[s]=n}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},ch=class extends R{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=5}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return I()}getData(t){return null}prepareFrame(t){return I()}renderFrame(t,e){return I()}forEachFeatureAtCoordinate(t,e,i,s,n){}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(u,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()}};let uh=null;const dh=class extends ch{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=[1,0,0,1,0,0],this.pixelTransform=[1,0,0,1,0,0],this.inversePixelTransform=[1,0,0,1,0,0],this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){let s;uh||(uh=cs(1,1,void 0,{willReadFrequently:!0})),uh.clearRect(0,0,1,1);try{uh.drawImage(t,e,i,1,1,0,0,1,1),s=uh.getImageData(0,0,1,1).data}catch{return uh=null,null}return s}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i){const s=this.getLayer().getClassName();let n,r;if(t&&t.className===s&&(!i||t&&t.style.backgroundColor&&w(rr(t.style.backgroundColor),rr(i)))){const e=t.firstElementChild;ps(e)&&(r=e.getContext("2d"))}if(r&&function(t,e){const i=xi(t),s=xi(e);for(let t=0;t<6;++t)if(0!==Math.round((i[t]-s[t])*wi[t]))return!1;return!0}(r.canvas.style.transform,e)?(this.container=t,this.context=r,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){n=K?_s():document.createElement("div"),n.className=s;let t=n.style;t.position="absolute",t.width="100%",t.height="100%",r=cs();const e=r.canvas;n.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=n,this.context=r}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const s=qt(i),n=Ut(i),r=Lt(i),o=Ot(i);yi(e.coordinateToPixelTransform,s),yi(e.coordinateToPixelTransform,n),yi(e.coordinateToPixelTransform,r),yi(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;yi(a,s),yi(a,n),yi(a,r),yi(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}prepareContainer(t,e){const i=t.extent,s=t.viewState.resolution,n=t.viewState.rotation,r=t.pixelRatio,o=Math.round(Bt(i)/s*r),a=Math.round(Dt(i)/s*r);vi(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/r,1/r,n,-o/2,-a/2),Mi(this.inversePixelTransform,this.pixelTransform);const h="matrix("+this.pixelTransform.join(", ")+")";if(this.useContainer(e,h,this.getBackground(t)),!this.containerReused){const t=this.context.canvas;t.width!=o||t.height!=a?(t.width=o,t.height=a):this.context.clearRect(0,0,o,a),h!==t.style.transform&&(t.style.transform=h)}}dispatchRenderEvent_(t,e,i){const s=this.getLayer();if(s.hasListener(t)){const n=new Fa(t,this.inversePixelTransform,i,e);s.dispatchEvent(n)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(mn,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(yn,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new lh),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(mn,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(yn,this.context,t))}getRenderTransform(t,e,i,s,n,r,o){const a=n/2,h=r/2,l=s/e,c=-l,u=-t[0]+o,d=-t[1];return vi(this.tempTransform,a,h,l,c,-i,u,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}};function gh(t,e,i){if(!(i in t))return t[i]=new Set([e]),!0;const s=t[i],n=s.has(e);return n||s.add(e),!n}function fh(t,e,i){const s=t[i];return!!s&&s.delete(e)}function _h(t,e){const i=t.layerStatesArray[t.layerIndex];i.extent&&(e=jt(e,gi(i.extent,t.viewState.projection)));const s=i.layer.getRenderSource();if(!s.getWrapX()){const i=s.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=jt(e,i))}return e}const ph=class extends dh{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=[1/0,1/0,-1/0,-1/0],this.tempTileRange_=new Qa(0,0,0,0),this.tempTileCoord_=ah(0,0,0);const i=void 0!==e.cacheSize?e.cacheSize:512;this.tileCache_=new oh(i),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=.5*i}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new oh(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,s){const n=this.tileCache_,r=this.getLayer().getSource(),o=hh(r,r.getKey(),t,e,i);let a;if(n.containsKey(o))a=n.get(o);else{const h=s.viewState.projection,l=r.getProjection();if(a=r.getTile(t,e,i,s.pixelRatio,h,!l||si(l,h)?void 0:this.getSourceTileCache()),!a)return null;n.set(o,a)}return a}getTile(t,e,i,s){return this.getOrCreateTile(t,e,i,s)||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),s=yi(e.pixelToCoordinateTransform,t.slice()),n=i.getExtent();if(n&&!xt(n,s))return null;const r=e.viewState,o=i.getRenderSource(),a=o.getTileGridForProjection(r.projection),h=o.getTilePixelRatio(e.pixelRatio);for(let t=a.getZForResolution(r.resolution);t>=a.getMinZoom();--t){const i=a.getTileCoordForCoordAndZ(s,t),n=this.getTile(t,i[1],i[2],e);if(!n||2!==n.getState())continue;const l=a.getOrigin(t),c=hr(a.getTileSize(t)),u=a.getResolution(t);let d;if(n instanceof Ya||n instanceof rh)d=n.getImage();else{if(!(n instanceof Va))continue;if(d=Xa(n.getData()),!d)continue}const g=Math.floor(h*((s[0]-l[0])/u-i[1]*c[0])),f=Math.floor(h*((l[1]-s[1])/u-i[2]*c[1])),_=Math.round(h*o.getGutterForProjection(r.projection));return this.getImageData(d,g+_,f+_)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=i,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,i,s,n){const r=t.viewState,o=this.getLayer(),a=o.getRenderSource(),h=a.getTileGridForProjection(r.projection),l=A(a);l in t.wantedTiles||(t.wantedTiles[l]={});const c=t.wantedTiles[l],u=o.getMapInternal(),d=Math.max(i-n,h.getMinZoom(),h.getZForResolution(Math.min(o.getMaxResolution(),u?u.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):h.getResolution(0)),a.zDirection)),g=r.rotation,f=g?zt(r.center,r.resolution,g,t.size):void 0;for(let n=i;n>=d;--n){const i=h.getTileRangeForExtentAndZ(e,n,this.tempTileRange_),r=h.getResolution(n);for(let e=i.minX;e<=i.maxX;++e)for(let o=i.minY;o<=i.maxY;++o){if(g&&!h.tileCoordIntersectsViewport([n,e,o],f))continue;const i=this.getTile(n,e,o,t);if(!i)continue;if(!gh(s,i,n))continue;const a=i.getKey();if(c[a]=!0,0===i.getState()&&!t.tileQueue.isKeyQueued(a)){const s=ah(n,e,o,this.tempTileCoord_);t.tileQueue.enqueue([i,l,h.getTileCoordCenter(s),r])}}}}findStaleTile_(t,e){const i=this.tileCache_,s=t[0],n=t[1],r=t[2],o=this.getStaleKeys();for(let t=0;t<o.length;++t){const a=hh(this.getLayer().getSource(),o[t],s,n,r);if(i.containsKey(a)){const t=i.peek(a);if(2===t.getState())return t.endTransition(A(this)),gh(e,t,s),!0}}return!1}findAltTiles_(t,e,i,s){const n=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!n)return!1;let r=!0;const o=this.tileCache_,a=this.getLayer().getRenderSource(),h=a.getKey();for(let t=n.minX;t<=n.maxX;++t)for(let e=n.minY;e<=n.maxY;++e){const n=hh(a,h,i,t,e);let l=!1;if(o.containsKey(n)){const t=o.peek(n);2===t.getState()&&(gh(s,t,i),l=!0)}l||(r=!1)}return r}renderFrame(t,e){this.renderComplete=!0;const i=t.layerStatesArray[t.layerIndex],s=t.viewState,n=s.projection,r=s.resolution,o=s.center,a=t.pixelRatio,h=this.getLayer(),l=h.getSource(),c=l.getTileGridForProjection(n),u=c.getZForResolution(r,l.zDirection),d=c.getResolution(u),g=l.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==g&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=g):this.renderedSourceKey_=g;let f=t.extent;const _=l.getTilePixelRatio(a);this.prepareContainer(t,e);const p=this.context.canvas.width,m=this.context.canvas.height;this.layerExtent=i.extent?gi(i.extent):null,this.layerExtent&&(f=jt(f,this.layerExtent));const y=d*p/2/_,M=d*m/2/_,w=[o[0]-y,o[1]-M,o[0]+y,o[1]+M],x={};this.renderedTiles.length=0;const E=h.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const e=c.getZForResolution(s.nextResolution,l.zDirection),i=_h(t,t.nextExtent);this.enqueueTiles(t,i,e,x,E)}const S=_h(t,f);if(this.enqueueTiles(t,S,u,x,0),E>0&&setTimeout(()=>{this.enqueueTiles(t,S,u-1,x,E-1)},0),!(u in x))return this.container;const b=A(this),P=t.time;for(const e of x[u]){const i=e.getState();if(4===i)continue;const s=e.tileCoord;if(2===i&&1===e.getAlpha(b,P)){e.endTransition(b);continue}if(3!==i&&(this.renderComplete=!1),this.findStaleTile_(s,x)){fh(x,e,u),t.animate=!0;continue}if(this.findAltTiles_(c,s,u+1,x))continue;const n=c.getMinZoom();for(let t=u-1;t>=n&&!this.findAltTiles_(c,s,t,x);--t);}const C=d/r*a/_,R=this.getRenderContext(t);vi(this.tempTransform,p/2,m/2,C,C,0,-p/2,-m/2),this.layerExtent&&this.clipUnrotated(R,t,this.layerExtent),l.getInterpolate()||(R.imageSmoothingEnabled=!1),this.preRender(R,t);const I=Object.keys(x).map(Number);let G;I.sort(v);const T=[],O=[];for(let e=I.length-1;e>=0;--e){const i=I[e],s=l.getTilePixelSize(i,a,n),r=c.getResolution(i)/d,o=s[0]*r*C,h=s[1]*r*C,u=c.getTileCoordForCoordAndZ(qt(w),i),g=c.getTileCoordExtent(u),f=yi(this.tempTransform,[_*(g[0]-w[0])/d,_*(w[3]-g[3])/d]),p=_*l.getGutterForProjection(n);for(const e of x[i]){if(2!==e.getState())continue;const s=e.tileCoord,n=u[1]-s[1],r=Math.round(f[0]-(n-1)*o),a=u[2]-s[2],c=Math.round(f[1]-(a-1)*h),d=Math.round(f[0]-n*o),g=Math.round(f[1]-a*h),_=r-d,m=c-g,y=1===I.length;let v=!1;G=[d,g,d+_,g,d+_,g+m,d,g+m];for(let t=0,e=T.length;t<e;++t)if(!y&&i<O[t]){const e=T[t];Kt([d,g,d+_,g+m],[e[0],e[3],e[4],e[7]])&&(v||(R.save(),v=!0),R.beginPath(),R.moveTo(G[0],G[1]),R.lineTo(G[2],G[3]),R.lineTo(G[4],G[5]),R.lineTo(G[6],G[7]),R.moveTo(e[6],e[7]),R.lineTo(e[4],e[5]),R.lineTo(e[2],e[3]),R.lineTo(e[0],e[1]),R.clip())}T.push(G),O.push(i),this.drawTile(e,t,d,g,_,m,p,y),v&&R.restore(),this.renderedTiles.unshift(e),this.updateUsedTiles(t.usedTiles,l,e)}}if(this.renderedResolution=d,this.extentChanged=!this.renderedExtent_||!Ct(this.renderedExtent_,w),this.renderedExtent_=w,this.renderedPixelRatio=a,this.postRender(this.context,t),this.layerExtent&&R.restore(),R.imageSmoothingEnabled=!0,this.renderComplete){const e=(t,e)=>{const i=A(l),s=e.wantedTiles[i],n=s?Object.keys(s).length:0;this.updateCacheSize(n),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(e)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,2*t)}drawTile(t,e,i,s,n,r,o,a){let h;if(t instanceof Va){if(h=Xa(t.getData()),!h)throw new Error("Rendering array data is not yet supported")}else h=this.getTileImage(t);if(!h)return;const l=this.getRenderContext(e),c=A(this),u=e.layerStatesArray[e.layerIndex],d=u.opacity*(a?t.getAlpha(c,e.time):1),g=d!==l.globalAlpha;g&&(l.save(),l.globalAlpha=d),l.drawImage(h,o,o,h.width-2*o,h.height-2*o,i,s,n,r),g&&l.restore(),d!==u.opacity?e.animate=!0:a&&t.endTransition(c)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,i){const s=A(e);s in t||(t[s]={}),t[s][i.getKey()]=!0}},mh="preload",yh="useInterimTilesOnError",vh=class extends xn{constructor(t){t=t||{};const e=Object.assign({},t),i=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i,this.setPreload(void 0!==t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(mh)}setPreload(t){this.set(mh,t)}getUseInterimTilesOnError(){return this.get(yh)}setUseInterimTilesOnError(t){this.set(yh,t)}getData(t){return super.getData(t)}},Mh=class extends vh{constructor(t){super(t)}createRenderer(){return new ph(this,{cacheSize:this.getCacheSize()})}};var wh=6378137,xh=.0066943799901413165,Eh=484813681109536e-20,Sh=Math.PI/2,bh=1e-10,Ph=.017453292519943295,Ch=57.29577951308232,Rh=Math.PI/4,Ih=2*Math.PI,Gh=3.14159265359;const Ah={greenwich:0,lisbon:-9.131906111111,paris:2.337229166667,bogota:-74.080916666667,madrid:-3.687938888889,rome:12.452333333333,bern:7.439583333333,jakarta:106.807719444444,ferro:-17.666666666667,brussels:4.367975,stockholm:18.058277777778,athens:23.7163375,oslo:10.722916666667},Th={mm:{to_meter:.001},cm:{to_meter:.01},ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937},fath:{to_meter:1.8288},kmi:{to_meter:1852},"us-ch":{to_meter:20.1168402336805},"us-mi":{to_meter:1609.34721869444},km:{to_meter:1e3},"ind-ft":{to_meter:.30479841},"ind-yd":{to_meter:.91439523},mi:{to_meter:1609.344},yd:{to_meter:.9144},ch:{to_meter:20.1168},link:{to_meter:.201168},dm:{to_meter:.1},in:{to_meter:.0254},"ind-ch":{to_meter:20.11669506},"us-in":{to_meter:.025400050800101},"us-yd":{to_meter:.914401828803658}};var Oh=/[\s_\-\/\(\)]/g;function Lh(t,e){if(t[e])return t[e];for(var i,s=Object.keys(t),n=e.toLowerCase().replace(Oh,""),r=-1;++r<s.length;)if((i=s[r]).toLowerCase().replace(Oh,"")===n)return t[i]}function Nh(t){var e,i,s,n={},r=t.split("+").map(function(t){return t.trim()}).filter(function(t){return t}).reduce(function(t,e){var i=e.split("=");return i.push(!0),t[i[0].toLowerCase()]=i[1],t},{}),o={proj:"projName",datum:"datumCode",rf:function(t){n.rf=parseFloat(t)},lat_0:function(t){n.lat0=t*Ph},lat_1:function(t){n.lat1=t*Ph},lat_2:function(t){n.lat2=t*Ph},lat_ts:function(t){n.lat_ts=t*Ph},lon_0:function(t){n.long0=t*Ph},lon_1:function(t){n.long1=t*Ph},lon_2:function(t){n.long2=t*Ph},alpha:function(t){n.alpha=parseFloat(t)*Ph},gamma:function(t){n.rectified_grid_angle=parseFloat(t)*Ph},lonc:function(t){n.longc=t*Ph},x_0:function(t){n.x0=parseFloat(t)},y_0:function(t){n.y0=parseFloat(t)},k_0:function(t){n.k0=parseFloat(t)},k:function(t){n.k0=parseFloat(t)},a:function(t){n.a=parseFloat(t)},b:function(t){n.b=parseFloat(t)},r:function(t){n.a=n.b=parseFloat(t)},r_a:function(){n.R_A=!0},zone:function(t){n.zone=parseInt(t,10)},south:function(){n.utmSouth=!0},towgs84:function(t){n.datum_params=t.split(",").map(function(t){return parseFloat(t)})},to_meter:function(t){n.to_meter=parseFloat(t)},units:function(t){n.units=t;var e=Lh(Th,t);e&&(n.to_meter=e.to_meter)},from_greenwich:function(t){n.from_greenwich=t*Ph},pm:function(t){var e=Lh(Ah,t);n.from_greenwich=(e||parseFloat(t))*Ph},nadgrids:function(t){"@null"===t?n.datumCode="none":n.nadgrids=t},axis:function(t){var e="ewnsud";3===t.length&&-1!==e.indexOf(t.substr(0,1))&&-1!==e.indexOf(t.substr(1,1))&&-1!==e.indexOf(t.substr(2,1))&&(n.axis=t)},approx:function(){n.approx=!0},over:function(){n.over=!0}};for(e in r)i=r[e],e in o?"function"==typeof(s=o[e])?s(i):n[s]=i:n[e]=i;return"string"==typeof n.datumCode&&"WGS84"!==n.datumCode&&(n.datumCode=n.datumCode.toLowerCase()),n.projStr=t,n}const kh=class{static getId(t){const e=t.find(t=>Array.isArray(t)&&"ID"===t[0]);return e&&e.length>=3?{authority:e[1],code:parseInt(e[2],10)}:null}static convertUnit(t,e="unit"){if(!t||t.length<3)return{type:e,name:"unknown",conversion_factor:null};const i=t[1],s=parseFloat(t[2])||null,n=t.find(t=>Array.isArray(t)&&"ID"===t[0]);return{type:e,name:i,conversion_factor:s,id:n?{authority:n[1],code:parseInt(n[2],10)}:null}}static convertAxis(t){const e=t[1]||"Unknown";let i;const s=e.match(/^\((.)\)$/);if(s){const e=s[1].toUpperCase();if("E"===e)i="east";else if("N"===e)i="north";else if("U"===e)i="up";else{if(!t[2])throw new Error(`Unknown axis abbreviation: ${e}`);i=t[2]}}else i=t[2]||"unknown";const n=t.find(t=>Array.isArray(t)&&"ORDER"===t[0]),r=n?parseInt(n[1],10):null,o=t.find(t=>Array.isArray(t)&&("LENGTHUNIT"===t[0]||"ANGLEUNIT"===t[0]||"SCALEUNIT"===t[0]));return{name:e,direction:i,unit:this.convertUnit(o),order:r}}static extractAxes(t){return t.filter(t=>Array.isArray(t)&&"AXIS"===t[0]).map(t=>this.convertAxis(t)).sort((t,e)=>(t.order||0)-(e.order||0))}static convert(t,e={}){switch(t[0]){case"PROJCRS":e.type="ProjectedCRS",e.name=t[1],e.base_crs=t.find(t=>Array.isArray(t)&&"BASEGEOGCRS"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"BASEGEOGCRS"===t[0])):null,e.conversion=t.find(t=>Array.isArray(t)&&"CONVERSION"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"CONVERSION"===t[0])):null;const i=t.find(t=>Array.isArray(t)&&"CS"===t[0]);i&&(e.coordinate_system={type:i[1],axis:this.extractAxes(t)});const s=t.find(t=>Array.isArray(t)&&"LENGTHUNIT"===t[0]);if(s){const t=this.convertUnit(s);e.coordinate_system.unit=t}e.id=this.getId(t);break;case"BASEGEOGCRS":case"GEOGCRS":case"GEODCRS":e.type="GEODCRS"===t[0]?"GeodeticCRS":"GeographicCRS",e.name=t[1];const n=t.find(t=>Array.isArray(t)&&("DATUM"===t[0]||"ENSEMBLE"===t[0]));if(n){const i=this.convert(n);"ENSEMBLE"===n[0]?e.datum_ensemble=i:e.datum=i;const s=t.find(t=>Array.isArray(t)&&"PRIMEM"===t[0]);s&&"Greenwich"!==s[1]&&(i.prime_meridian={name:s[1],longitude:parseFloat(s[2])})}e.coordinate_system={type:"ellipsoidal",axis:this.extractAxes(t)},e.id=this.getId(t);break;case"DATUM":e.type="GeodeticReferenceFrame",e.name=t[1],e.ellipsoid=t.find(t=>Array.isArray(t)&&"ELLIPSOID"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"ELLIPSOID"===t[0])):null;break;case"ENSEMBLE":e.type="DatumEnsemble",e.name=t[1],e.members=t.filter(t=>Array.isArray(t)&&"MEMBER"===t[0]).map(t=>({type:"DatumEnsembleMember",name:t[1],id:this.getId(t)}));const r=t.find(t=>Array.isArray(t)&&"ENSEMBLEACCURACY"===t[0]);r&&(e.accuracy=parseFloat(r[1]));const o=t.find(t=>Array.isArray(t)&&"ELLIPSOID"===t[0]);o&&(e.ellipsoid=this.convert(o)),e.id=this.getId(t);break;case"ELLIPSOID":e.type="Ellipsoid",e.name=t[1],e.semi_major_axis=parseFloat(t[2]),e.inverse_flattening=parseFloat(t[3]),t.find(t=>Array.isArray(t)&&"LENGTHUNIT"===t[0])&&this.convert(t.find(t=>Array.isArray(t)&&"LENGTHUNIT"===t[0]),e);break;case"CONVERSION":e.type="Conversion",e.name=t[1],e.method=t.find(t=>Array.isArray(t)&&"METHOD"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"METHOD"===t[0])):null,e.parameters=t.filter(t=>Array.isArray(t)&&"PARAMETER"===t[0]).map(t=>this.convert(t));break;case"METHOD":e.type="Method",e.name=t[1],e.id=this.getId(t);break;case"PARAMETER":e.type="Parameter",e.name=t[1],e.value=parseFloat(t[2]),e.unit=this.convertUnit(t.find(t=>Array.isArray(t)&&("LENGTHUNIT"===t[0]||"ANGLEUNIT"===t[0]||"SCALEUNIT"===t[0]))),e.id=this.getId(t);break;case"BOUNDCRS":e.type="BoundCRS";const a=t.find(t=>Array.isArray(t)&&"SOURCECRS"===t[0]);if(a){const t=a.find(t=>Array.isArray(t));e.source_crs=t?this.convert(t):null}const h=t.find(t=>Array.isArray(t)&&"TARGETCRS"===t[0]);if(h){const t=h.find(t=>Array.isArray(t));e.target_crs=t?this.convert(t):null}const l=t.find(t=>Array.isArray(t)&&"ABRIDGEDTRANSFORMATION"===t[0]);e.transformation=l?this.convert(l):null;break;case"ABRIDGEDTRANSFORMATION":if(e.type="Transformation",e.name=t[1],e.method=t.find(t=>Array.isArray(t)&&"METHOD"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"METHOD"===t[0])):null,e.parameters=t.filter(t=>Array.isArray(t)&&("PARAMETER"===t[0]||"PARAMETERFILE"===t[0])).map(t=>"PARAMETER"===t[0]?this.convert(t):"PARAMETERFILE"===t[0]?{name:t[1],value:t[2],id:{authority:"EPSG",code:8656}}:void 0),7===e.parameters.length){const t=e.parameters[6];"Scale difference"===t.name&&(t.value=Math.round(1e12*(t.value-1))/1e6)}e.id=this.getId(t);break;case"AXIS":e.coordinate_system||(e.coordinate_system={type:"unspecified",axis:[]}),e.coordinate_system.axis.push(this.convertAxis(t));break;case"LENGTHUNIT":const c=this.convertUnit(t,"LinearUnit");e.coordinate_system&&e.coordinate_system.axis&&e.coordinate_system.axis.forEach(t=>{t.unit||(t.unit=c)}),c.conversion_factor&&1!==c.conversion_factor&&e.semi_major_axis&&(e.semi_major_axis={value:e.semi_major_axis,unit:c});break;default:e.keyword=t[0]}return e}},Fh=class extends kh{static convert(t,e={}){return super.convert(t,e),e.coordinate_system&&"Cartesian"===e.coordinate_system.subtype&&delete e.coordinate_system,e.usage&&delete e.usage,e}},zh=class extends kh{static convert(t,e={}){super.convert(t,e);const i=t.find(t=>Array.isArray(t)&&"CS"===t[0]);i&&(e.coordinate_system={subtype:i[1],axis:this.extractAxes(t)});const s=t.find(t=>Array.isArray(t)&&"USAGE"===t[0]);if(s){const t=s.find(t=>Array.isArray(t)&&"SCOPE"===t[0]),i=s.find(t=>Array.isArray(t)&&"AREA"===t[0]),n=s.find(t=>Array.isArray(t)&&"BBOX"===t[0]);e.usage={},t&&(e.usage.scope=t[1]),i&&(e.usage.area=i[1]),n&&(e.usage.bbox=n.slice(1))}return e}};var Dh=/\s/,jh=/[A-Za-z]/,qh=/[A-Za-z84_]/,Uh=/[,\]]/,Bh=/[\d\.E\-\+]/;function Kh(t){if("string"!=typeof t)throw new Error("not a string");this.text=t.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=1}function Xh(t,e,i){Array.isArray(e)&&(i.unshift(e),e=null);var s=e?{}:t,n=i.reduce(function(t,e){return Wh(e,t),t},s);e&&(t[e]=n)}function Wh(t,e){if(Array.isArray(t)){var i=t.shift();if("PARAMETER"===i&&(i=t.shift()),1===t.length)return Array.isArray(t[0])?(e[i]={},void Wh(t[0],e[i])):void(e[i]=t[0]);if(t.length)if("TOWGS84"!==i){if("AXIS"===i)return i in e||(e[i]=[]),void e[i].push(t);var s;switch(Array.isArray(i)||(e[i]={}),i){case"UNIT":case"PRIMEM":case"VERT_DATUM":return e[i]={name:t[0].toLowerCase(),convert:t[1]},void(3===t.length&&Wh(t[2],e[i]));case"SPHEROID":case"ELLIPSOID":return e[i]={name:t[0],a:t[1],rf:t[2]},void(4===t.length&&Wh(t[3],e[i]));case"EDATUM":case"ENGINEERINGDATUM":case"LOCAL_DATUM":case"DATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":return t[0]=["name",t[0]],void Xh(e,i,t);case"COMPD_CS":case"COMPOUNDCRS":case"FITTED_CS":case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"ENGCRS":case"ENGINEERINGCRS":return t[0]=["name",t[0]],Xh(e,i,t),void(e[i].type=i);default:for(s=-1;++s<t.length;)if(!Array.isArray(t[s]))return Wh(t,e[i]);return Xh(e,i,t)}}else e[i]=t;else e[i]=!0}else e[t]=!0}function Zh(t){return.017453292519943295*t}function Vh(t){const e=(t.projName||"").toLowerCase().replace(/_/g," ");void 0===t.long0&&void 0!==t.longc&&(t.long0=t.longc),t.lat_ts||!t.lat1||"stereographic south pole"!==e&&"polar stereographic (variant b)"!==e?t.lat_ts||!t.lat0||"polar stereographic"!==e&&"polar stereographic (variant a)"!==e||(t.lat_ts=t.lat0,t.lat0=Zh(t.lat0>0?90:-90),delete t.lat1):(t.lat0=Zh(t.lat1>0?90:-90),t.lat_ts=t.lat1,delete t.lat1)}function Yh(t){let e={units:null,to_meter:void 0};return"string"==typeof t?(e.units=t.toLowerCase(),"metre"===e.units&&(e.units="meter"),"meter"===e.units&&(e.to_meter=1)):t&&t.name&&(e.units=t.name.toLowerCase(),"metre"===e.units&&(e.units="meter"),e.to_meter=t.conversion_factor),e}function Hh(t){return"object"==typeof t?t.value*t.unit.conversion_factor:t}function $h(t,e){t.ellipsoid.radius?(e.a=t.ellipsoid.radius,e.rf=0):(e.a=Hh(t.ellipsoid.semi_major_axis),void 0!==t.ellipsoid.inverse_flattening?e.rf=t.ellipsoid.inverse_flattening:void 0!==t.ellipsoid.semi_major_axis&&void 0!==t.ellipsoid.semi_minor_axis&&(e.rf=e.a/(e.a-Hh(t.ellipsoid.semi_minor_axis))))}function Qh(t,e={}){return t&&"object"==typeof t?"BoundCRS"===t.type?(Qh(t.source_crs,e),t.transformation&&(t.transformation.method&&"NTv2"===t.transformation.method.name?e.nadgrids=t.transformation.parameters[0].value:e.datum_params=t.transformation.parameters.map(t=>t.value)),e):(Object.keys(t).forEach(i=>{const s=t[i];if(null!==s)switch(i){case"name":if(e.srsCode)break;e.name=s,e.srsCode=s;break;case"type":"GeographicCRS"===s?e.projName="longlat":"GeodeticCRS"===s?t.coordinate_system&&"Cartesian"===t.coordinate_system.subtype?e.projName="geocent":e.projName="longlat":"ProjectedCRS"===s&&t.conversion&&t.conversion.method&&(e.projName=t.conversion.method.name);break;case"datum":case"datum_ensemble":s.ellipsoid&&(e.ellps=s.ellipsoid.name,$h(s,e)),s.prime_meridian&&(e.from_greenwich=s.prime_meridian.longitude*Math.PI/180);break;case"ellipsoid":e.ellps=s.name,$h(s,e);break;case"prime_meridian":e.long0=(s.longitude||0)*Math.PI/180;break;case"coordinate_system":if(s.axis){const t={east:"e",north:"n",west:"w",south:"s",up:"u",down:"d",geocentricx:"e",geocentricy:"n",geocentricz:"u"},i=s.axis.map(e=>t[e.direction.toLowerCase()]);if(i.every(Boolean)&&(e.axis=i.join(""),2===e.axis.length&&(e.axis+="u")),s.unit){const{units:t,to_meter:i}=Yh(s.unit);e.units=t,e.to_meter=i}else if(s.axis[0]&&s.axis[0].unit){const{units:t,to_meter:i}=Yh(s.axis[0].unit);e.units=t,e.to_meter=i}}break;case"id":s.authority&&s.code&&(e.title=s.authority+":"+s.code);break;case"conversion":s.method&&s.method.name&&(e.projName=s.method.name),s.parameters&&s.parameters.forEach(t=>{const i=t.name.toLowerCase().replace(/\s+/g,"_"),s=t.value;t.unit&&t.unit.conversion_factor?e[i]=s*t.unit.conversion_factor:"degree"===t.unit?e[i]=s*Math.PI/180:e[i]=s});break;case"unit":s.name&&(e.units=s.name.toLowerCase(),"metre"===e.units&&(e.units="meter")),s.conversion_factor&&(e.to_meter=s.conversion_factor);break;case"base_crs":Qh(s,e),e.datumCode=s.id?s.id.authority+"_"+s.id.code:s.name}}),void 0!==e.latitude_of_false_origin&&(e.lat0=e.latitude_of_false_origin),void 0!==e.longitude_of_false_origin&&(e.long0=e.longitude_of_false_origin),void 0!==e.latitude_of_standard_parallel&&(e.lat0=e.latitude_of_standard_parallel,e.lat1=e.latitude_of_standard_parallel),void 0!==e.latitude_of_1st_standard_parallel&&(e.lat1=e.latitude_of_1st_standard_parallel),void 0!==e.latitude_of_2nd_standard_parallel&&(e.lat2=e.latitude_of_2nd_standard_parallel),void 0!==e.latitude_of_projection_centre&&(e.lat0=e.latitude_of_projection_centre),void 0!==e.longitude_of_projection_centre&&(e.longc=e.longitude_of_projection_centre),void 0!==e.easting_at_false_origin&&(e.x0=e.easting_at_false_origin),void 0!==e.northing_at_false_origin&&(e.y0=e.northing_at_false_origin),void 0!==e.latitude_of_natural_origin&&(e.lat0=e.latitude_of_natural_origin),void 0!==e.longitude_of_natural_origin&&(e.long0=e.longitude_of_natural_origin),void 0!==e.longitude_of_origin&&(e.long0=e.longitude_of_origin),void 0!==e.false_easting&&(e.x0=e.false_easting),e.easting_at_projection_centre&&(e.x0=e.easting_at_projection_centre),void 0!==e.false_northing&&(e.y0=e.false_northing),e.northing_at_projection_centre&&(e.y0=e.northing_at_projection_centre),void 0!==e.standard_parallel_1&&(e.lat1=e.standard_parallel_1),void 0!==e.standard_parallel_2&&(e.lat2=e.standard_parallel_2),void 0!==e.scale_factor_at_natural_origin&&(e.k0=e.scale_factor_at_natural_origin),void 0!==e.scale_factor_at_projection_centre&&(e.k0=e.scale_factor_at_projection_centre),void 0!==e.scale_factor_on_pseudo_standard_parallel&&(e.k0=e.scale_factor_on_pseudo_standard_parallel),void 0!==e.azimuth&&(e.alpha=e.azimuth),void 0!==e.azimuth_at_projection_centre&&(e.alpha=e.azimuth_at_projection_centre),e.angle_from_rectified_to_skew_grid&&(e.rectified_grid_angle=e.angle_from_rectified_to_skew_grid),Vh(e),e):t}Kh.prototype.readCharicter=function(){var t=this.text[this.place++];if(4!==this.state)for(;Dh.test(t);){if(this.place>=this.text.length)return;t=this.text[this.place++]}switch(this.state){case 1:return this.neutral(t);case 2:return this.keyword(t);case 4:return this.quoted(t);case 5:return this.afterquote(t);case 3:return this.number(t);case-1:return}},Kh.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=4);if(Uh.test(t))return this.word=this.word.trim(),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in afterquote yet, index '+this.place)},Kh.prototype.afterItem=function(t){return","===t?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=1)):"]"===t?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=1,this.currentObject=this.stack.pop(),void(this.currentObject||(this.state=-1))):void 0},Kh.prototype.number=function(t){if(!Bh.test(t)){if(Uh.test(t))return this.word=parseFloat(this.word),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in number yet, index '+this.place)}this.word+=t},Kh.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=5},Kh.prototype.keyword=function(t){if(qh.test(t))this.word+=t;else{if("["===t){var e=[];return e.push(this.word),this.level++,null===this.root?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,void(this.state=1)}if(!Uh.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}},Kh.prototype.neutral=function(t){if(jh.test(t))return this.word=t,void(this.state=2);if('"'===t)return this.word="",void(this.state=4);if(Bh.test(t))return this.word=t,void(this.state=3);if(!Uh.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)},Kh.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(-1===this.state)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};var Jh=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function tl(t){for(var e=Object.keys(t),i=0,s=e.length;i<s;++i){var n=e[i];-1!==Jh.indexOf(n)&&el(t[n]),"object"==typeof t[n]&&tl(t[n])}}function el(t){if(t.AUTHORITY){var e=Object.keys(t.AUTHORITY)[0];e&&e in t.AUTHORITY&&(t.title=e+":"+t.AUTHORITY[e])}if("GEOGCS"===t.type?t.projName="longlat":"LOCAL_CS"===t.type?(t.projName="identity",t.local=!0):"object"==typeof t.PROJECTION?t.projName=Object.keys(t.PROJECTION)[0]:t.projName=t.PROJECTION,t.AXIS){for(var i="",s=0,n=t.AXIS.length;s<n;++s){var r=[t.AXIS[s][0].toLowerCase(),t.AXIS[s][1].toLowerCase()];-1!==r[0].indexOf("north")||("y"===r[0]||"lat"===r[0])&&"north"===r[1]?i+="n":-1!==r[0].indexOf("south")||("y"===r[0]||"lat"===r[0])&&"south"===r[1]?i+="s":-1!==r[0].indexOf("east")||("x"===r[0]||"lon"===r[0])&&"east"===r[1]?i+="e":-1===r[0].indexOf("west")&&("x"!==r[0]&&"lon"!==r[0]||"west"!==r[1])||(i+="w")}2===i.length&&(i+="u"),3===i.length&&(t.axis=i)}t.UNIT&&(t.units=t.UNIT.name.toLowerCase(),"metre"===t.units&&(t.units="meter"),t.UNIT.convert&&("GEOGCS"===t.type?t.DATUM&&t.DATUM.SPHEROID&&(t.to_meter=t.UNIT.convert*t.DATUM.SPHEROID.a):t.to_meter=t.UNIT.convert));var o=t.GEOGCS;function a(e){return e*(t.to_meter||1)}"GEOGCS"===t.type&&(o=t),o&&(o.PRIMEM&&o.PRIMEM.convert&&(t.from_greenwich=Zh(o.PRIMEM.convert)),o.DATUM?t.datumCode=o.DATUM.name.toLowerCase():t.datumCode=o.name.toLowerCase(),"d_"===t.datumCode.slice(0,2)&&(t.datumCode=t.datumCode.slice(2)),"new_zealand_1949"===t.datumCode&&(t.datumCode="nzgd49"),"wgs_1984"!==t.datumCode&&"world_geodetic_system_1984"!==t.datumCode||("Mercator_Auxiliary_Sphere"===t.PROJECTION&&(t.sphere=!0),t.datumCode="wgs84"),"belge_1972"===t.datumCode&&(t.datumCode="rnb72"),o.DATUM&&o.DATUM.SPHEROID&&(t.ellps=o.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),"international"===t.ellps.toLowerCase().slice(0,13)&&(t.ellps="intl"),t.a=o.DATUM.SPHEROID.a,t.rf=parseFloat(o.DATUM.SPHEROID.rf)),o.DATUM&&o.DATUM.TOWGS84&&(t.datum_params=o.DATUM.TOWGS84),~t.datumCode.indexOf("osgb_1936")&&(t.datumCode="osgb36"),~t.datumCode.indexOf("osni_1952")&&(t.datumCode="osni52"),(~t.datumCode.indexOf("tm65")||~t.datumCode.indexOf("geodetic_datum_of_1965"))&&(t.datumCode="ire65"),"ch1903+"===t.datumCode&&(t.datumCode="ch1903"),~t.datumCode.indexOf("israel")&&(t.datumCode="isr93")),t.b&&!isFinite(t.b)&&(t.b=t.a),t.rectified_grid_angle&&(t.rectified_grid_angle=Zh(t.rectified_grid_angle)),[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",Zh],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",Zh],["x0","false_easting",a],["y0","false_northing",a],["long0","central_meridian",Zh],["lat0","latitude_of_origin",Zh],["lat0","standard_parallel_1",Zh],["lat1","standard_parallel_1",Zh],["lat2","standard_parallel_2",Zh],["azimuth","Azimuth"],["alpha","azimuth",Zh],["srsCode","name"]].forEach(function(e){return function(t,e){var i=e[0],s=e[1];!(i in t)&&s in t&&(t[i]=t[s],3===e.length&&(t[i]=e[2](t[i])))}(t,e)}),Vh(t)}function il(t){if("object"==typeof t)return Qh(t);const e=function(t){const e=t.toUpperCase();return e.includes("PROJCRS")||e.includes("GEOGCRS")||e.includes("BOUNDCRS")||e.includes("VERTCRS")||e.includes("LENGTHUNIT")||e.includes("ANGLEUNIT")||e.includes("SCALEUNIT")?"WKT2":(e.includes("PROJCS")||e.includes("GEOGCS")||e.includes("LOCAL_CS")||e.includes("VERT_CS")||e.includes("UNIT"),"WKT1")}(t);var i=new Kh(t).output();if("WKT2"===e)return Qh(function(t){const e=function(t){return t.find(t=>Array.isArray(t)&&"USAGE"===t[0])?"2019":(t.find(t=>Array.isArray(t)&&"CS"===t[0])||"BOUNDCRS"===t[0]||"PROJCRS"===t[0]||t[0],"2015")}(t);return("2019"===e?zh:Fh).convert(t)}(i));var s=i[0],n={};return Wh(i,n),tl(n),n[s]}function sl(t){var e=this;if(2===arguments.length){var i=arguments[1];"string"==typeof i?"+"===i.charAt(0)?sl[t]=Nh(arguments[1]):sl[t]=il(arguments[1]):i&&"object"==typeof i&&!("projName"in i)?sl[t]=il(arguments[1]):(sl[t]=i,i||delete sl[t])}else if(1===arguments.length){if(Array.isArray(t))return t.map(function(t){return Array.isArray(t)?sl.apply(e,t):sl(t)});if("string"==typeof t){if(t in sl)return sl[t]}else"EPSG"in t?sl["EPSG:"+t.EPSG]=t:"ESRI"in t?sl["ESRI:"+t.ESRI]=t:"IAU2000"in t?sl["IAU2000:"+t.IAU2000]=t:console.log(t);return}}!function(t){t("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),t("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),t("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");for(var e=1;e<=60;++e)t("EPSG:"+(32600+e),"+proj=utm +zone="+e+" +datum=WGS84 +units=m"),t("EPSG:"+(32700+e),"+proj=utm +zone="+e+" +south +datum=WGS84 +units=m");t("EPSG:5041","+title=WGS 84 / UPS North (E,N) +proj=stere +lat_0=90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m"),t("EPSG:5042","+title=WGS 84 / UPS South (E,N) +proj=stere +lat_0=-90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m"),t.WGS84=t["EPSG:4326"],t["EPSG:3785"]=t["EPSG:3857"],t.GOOGLE=t["EPSG:3857"],t["EPSG:900913"]=t["EPSG:3857"],t["EPSG:102113"]=t["EPSG:3857"]}(sl);const nl=sl;var rl=["3857","900913","3785","102113"];function ol(t,e){var i,s;if(t=t||{},!e)return t;for(s in e)void 0!==(i=e[s])&&(t[s]=i);return t}function al(t,e,i){var s=t*e;return i/Math.sqrt(1-s*s)}function hl(t){return t<0?-1:1}function ll(t,e){return e||Math.abs(t)<=Gh?t:t-hl(t)*Ih}function cl(t,e,i){var s=t*i,n=.5*t;return s=Math.pow((1-s)/(1+s),n),Math.tan(.5*(Sh-e))/s}function ul(t,e){for(var i,s,n=.5*t,r=Sh-2*Math.atan(e),o=0;o<=15;o++)if(i=t*Math.sin(r),r+=s=Sh-2*Math.atan(e*Math.pow((1-i)/(1+i),n))-r,Math.abs(s)<=1e-10)return r;return-9999}function dl(t){return t}var gl=["longlat","identity"],fl=[{init:function(){var t=this.b/this.a;this.es=1-t*t,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=al(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)},forward:function(t){var e,i,s=t.x,n=t.y;if(n*Ch>90&&n*Ch<-90&&s*Ch>180&&s*Ch<-180)return null;if(Math.abs(Math.abs(n)-Sh)<=bh)return null;if(this.sphere)e=this.x0+this.a*this.k0*ll(s-this.long0,this.over),i=this.y0+this.a*this.k0*Math.log(Math.tan(Rh+.5*n));else{var r=Math.sin(n),o=cl(this.e,n,r);e=this.x0+this.a*this.k0*ll(s-this.long0,this.over),i=this.y0-this.a*this.k0*Math.log(o)}return t.x=e,t.y=i,t},inverse:function(t){var e,i,s=t.x-this.x0,n=t.y-this.y0;if(this.sphere)i=Sh-2*Math.atan(Math.exp(-n/(this.a*this.k0)));else{var r=Math.exp(-n/(this.a*this.k0));if(-9999===(i=ul(this.e,r)))return null}return e=ll(this.long0+s/(this.a*this.k0),this.over),t.x=e,t.y=i,t},names:["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","Mercator_Variant_A","merc"]},{init:function(){},forward:dl,inverse:dl,names:gl}],_l={},pl=[];function ml(t,e){var i=pl.length;return t.names?(pl[i]=t,t.names.forEach(function(t){_l[t.toLowerCase()]=i}),this):(console.log(e),!0)}function yl(t){return t.replace(/[-\(\)\s]+/g," ").trim().replace(/ /g,"_")}const vl={start:function(){fl.forEach(ml)},add:ml,get:function(t){if(!t)return!1;var e=t.toLowerCase();return void 0!==_l[e]&&pl[_l[e]]||(e=yl(e))in _l&&pl[_l[e]]?pl[_l[e]]:void 0}},Ml={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},andrae:{a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},clrk80:{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:6378249.2,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:6355834.8467,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS7:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"},sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}},wl=Ml.WGS84;var xl={wgs84:{towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},ch1903:{towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},ggrs87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},nad83:{towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},nad27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},mgi:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Militar-Geographische Institut"},osni52:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},rassadiran:{towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},osgb36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Ordnance Survey of Great Britain 1936"},s_jtsk:{towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},beduaram:{towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},gunung_segara:{towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},rnb72:{towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"},EPSG_5451:{towgs84:"6.41,-49.05,-11.28,1.5657,0.5242,6.9718,-5.7649"},IGNF_LURESG:{towgs84:"-192.986,13.673,-39.309,-0.4099,-2.9332,2.6881,0.43"},EPSG_4614:{towgs84:"-119.4248,-303.65872,-11.00061,1.164298,0.174458,1.096259,3.657065"},EPSG_4615:{towgs84:"-494.088,-312.129,279.877,-1.423,-1.013,1.59,-0.748"},ESRI_37241:{towgs84:"-76.822,257.457,-12.817,2.136,-0.033,-2.392,-0.031"},ESRI_37249:{towgs84:"-440.296,58.548,296.265,1.128,10.202,4.559,-0.438"},ESRI_37245:{towgs84:"-511.151,-181.269,139.609,1.05,2.703,1.798,3.071"},EPSG_4178:{towgs84:"24.9,-126.4,-93.2,-0.063,-0.247,-0.041,1.01"},EPSG_4622:{towgs84:"-472.29,-5.63,-304.12,0.4362,-0.8374,0.2563,1.8984"},EPSG_4625:{towgs84:"126.93,547.94,130.41,-2.7867,5.1612,-0.8584,13.8227"},EPSG_5252:{towgs84:"0.023,0.036,-0.068,0.00176,0.00912,-0.01136,0.00439"},EPSG_4314:{towgs84:"597.1,71.4,412.1,0.894,0.068,-1.563,7.58"},EPSG_4282:{towgs84:"-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166"},EPSG_4231:{towgs84:"-83.11,-97.38,-117.22,0.005693,-0.044698,0.044285,0.1218"},EPSG_4274:{towgs84:"-230.994,102.591,25.199,0.633,-0.239,0.9,1.95"},EPSG_4134:{towgs84:"-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006"},EPSG_4254:{towgs84:"18.38,192.45,96.82,0.056,-0.142,-0.2,-0.0013"},EPSG_4159:{towgs84:"-194.513,-63.978,-25.759,-3.4027,3.756,-3.352,-0.9175"},EPSG_4687:{towgs84:"0.072,-0.507,-0.245,0.0183,-0.0003,0.007,-0.0093"},EPSG_4227:{towgs84:"-83.58,-397.54,458.78,-17.595,-2.847,4.256,3.225"},EPSG_4746:{towgs84:"599.4,72.4,419.2,-0.062,-0.022,-2.723,6.46"},EPSG_4745:{towgs84:"612.4,77,440.2,-0.054,0.057,-2.797,2.55"},EPSG_6311:{towgs84:"8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926"},EPSG_4289:{towgs84:"565.7381,50.4018,465.2904,-0.395026,0.330772,-1.876073,4.07244"},EPSG_4230:{towgs84:"-68.863,-134.888,-111.49,-0.53,-0.14,0.57,-3.4"},EPSG_4154:{towgs84:"-123.02,-158.95,-168.47"},EPSG_4156:{towgs84:"570.8,85.7,462.8,4.998,1.587,5.261,3.56"},EPSG_4299:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4179:{towgs84:"33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84"},EPSG_4313:{towgs84:"-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747"},EPSG_4194:{towgs84:"163.511,127.533,-159.789"},EPSG_4195:{towgs84:"105,326,-102.5"},EPSG_4196:{towgs84:"-45,417,-3.5"},EPSG_4611:{towgs84:"-162.619,-276.959,-161.764,0.067753,-2.243648,-1.158828,-1.094246"},EPSG_4633:{towgs84:"137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824"},EPSG_4641:{towgs84:"-408.809,366.856,-412.987,1.8842,-0.5308,2.1655,-121.0993"},EPSG_4643:{towgs84:"-480.26,-438.32,-643.429,16.3119,20.1721,-4.0349,-111.7002"},EPSG_4300:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4188:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4660:{towgs84:"982.6087,552.753,-540.873,6.681627,-31.611492,-19.848161,16.805"},EPSG_4662:{towgs84:"97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259"},EPSG_3906:{towgs84:"577.88891,165.22205,391.18289,4.9145,-0.94729,-13.05098,7.78664"},EPSG_4307:{towgs84:"-209.3622,-87.8162,404.6198,0.0046,3.4784,0.5805,-1.4547"},EPSG_6892:{towgs84:"-76.269,-16.683,68.562,-6.275,10.536,-4.286,-13.686"},EPSG_4690:{towgs84:"221.597,152.441,176.523,2.403,1.3893,0.884,11.4648"},EPSG_4691:{towgs84:"218.769,150.75,176.75,3.5231,2.0037,1.288,10.9817"},EPSG_4629:{towgs84:"72.51,345.411,79.241,-1.5862,-0.8826,-0.5495,1.3653"},EPSG_4630:{towgs84:"165.804,216.213,180.26,-0.6251,-0.4515,-0.0721,7.4111"},EPSG_4692:{towgs84:"217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093"},EPSG_9333:{towgs84:"0,0,0,-0.008393,0.000749,-0.010276,0"},EPSG_9059:{towgs84:"0,0,0"},EPSG_4312:{towgs84:"601.705,84.263,485.227,4.7354,1.3145,5.393,-2.3887"},EPSG_4123:{towgs84:"-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496"},EPSG_4309:{towgs84:"-124.45,183.74,44.64,-0.4384,0.5446,-0.9706,-2.1365"},ESRI_104106:{towgs84:"-283.088,-70.693,117.445,-1.157,0.059,-0.652,-4.058"},EPSG_4281:{towgs84:"-219.247,-73.802,269.529"},EPSG_4322:{towgs84:"0,0,4.5"},EPSG_4324:{towgs84:"0,0,1.9"},EPSG_4284:{towgs84:"43.822,-108.842,-119.585,1.455,-0.761,0.737,0.549"},EPSG_4277:{towgs84:"446.448,-125.157,542.06,0.15,0.247,0.842,-20.489"},EPSG_4207:{towgs84:"-282.1,-72.2,120,-1.529,0.145,-0.89,-4.46"},EPSG_4688:{towgs84:"347.175,1077.618,2623.677,33.9058,-70.6776,9.4013,186.0647"},EPSG_4689:{towgs84:"410.793,54.542,80.501,-2.5596,-2.3517,-0.6594,17.3218"},EPSG_4720:{towgs84:"0,0,4.5"},EPSG_4273:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},EPSG_4240:{towgs84:"204.64,834.74,293.8"},EPSG_4817:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},ESRI_104131:{towgs84:"426.62,142.62,460.09,4.98,4.49,-12.42,-17.1"},EPSG_4265:{towgs84:"-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68"},EPSG_4263:{towgs84:"-111.92,-87.85,114.5,1.875,0.202,0.219,0.032"},EPSG_4298:{towgs84:"-689.5937,623.84046,-65.93566,-0.02331,1.17094,-0.80054,5.88536"},EPSG_4270:{towgs84:"-253.4392,-148.452,386.5267,0.15605,0.43,-0.1013,-0.0424"},EPSG_4229:{towgs84:"-121.8,98.1,-10.7"},EPSG_4220:{towgs84:"-55.5,-348,-229.2"},EPSG_4214:{towgs84:"12.646,-155.176,-80.863"},EPSG_4232:{towgs84:"-345,3,223"},EPSG_4238:{towgs84:"-1.977,-13.06,-9.993,0.364,0.254,0.689,-1.037"},EPSG_4168:{towgs84:"-170,33,326"},EPSG_4131:{towgs84:"199,931,318.9"},EPSG_4152:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_5228:{towgs84:"572.213,85.334,461.94,4.9732,1.529,5.2484,3.5378"},EPSG_8351:{towgs84:"485.021,169.465,483.839,7.786342,4.397554,4.102655,0"},EPSG_4683:{towgs84:"-127.62,-67.24,-47.04,-3.068,4.903,1.578,-1.06"},EPSG_4133:{towgs84:"0,0,0"},EPSG_7373:{towgs84:"0.819,-0.5762,-1.6446,-0.00378,-0.03317,0.00318,0.0693"},EPSG_9075:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9072:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9294:{towgs84:"1.16835,-1.42001,-2.24431,-0.00822,-0.05508,0.01818,0.23388"},EPSG_4212:{towgs84:"-267.434,173.496,181.814,-13.4704,8.7154,7.3926,14.7492"},EPSG_4191:{towgs84:"-44.183,-0.58,-38.489,2.3867,2.7072,-3.5196,-8.2703"},EPSG_4237:{towgs84:"52.684,-71.194,-13.975,-0.312,-0.1063,-0.3729,1.0191"},EPSG_4740:{towgs84:"-1.08,-0.27,-0.9"},EPSG_4124:{towgs84:"419.3836,99.3335,591.3451,0.850389,1.817277,-7.862238,-0.99496"},EPSG_5681:{towgs84:"584.9636,107.7175,413.8067,1.1155,0.2824,-3.1384,7.9922"},EPSG_4141:{towgs84:"23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262"},EPSG_4204:{towgs84:"-85.645,-273.077,-79.708,2.289,-1.421,2.532,3.194"},EPSG_4319:{towgs84:"226.702,-193.337,-35.371,-2.229,-4.391,9.238,0.9798"},EPSG_4200:{towgs84:"24.82,-131.21,-82.66"},EPSG_4130:{towgs84:"0,0,0"},EPSG_4127:{towgs84:"-82.875,-57.097,-156.768,-2.158,1.524,-0.982,-0.359"},EPSG_4149:{towgs84:"674.374,15.056,405.346"},EPSG_4617:{towgs84:"-0.991,1.9072,0.5129,0.02579,0.00965,0.01166,0"},EPSG_4663:{towgs84:"-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485"},EPSG_4664:{towgs84:"-211.939,137.626,58.3,-0.089,0.251,0.079,0.384"},EPSG_4665:{towgs84:"-105.854,165.589,-38.312,-0.003,-0.026,0.024,-0.048"},EPSG_4666:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},EPSG_4756:{towgs84:"-192.873,-39.382,-111.202,-0.00205,-0.0005,0.00335,0.0188"},EPSG_4723:{towgs84:"-179.483,-69.379,-27.584,-7.862,8.163,6.042,-13.925"},EPSG_4726:{towgs84:"8.853,-52.644,180.304,-0.393,-2.323,2.96,-24.081"},EPSG_4267:{towgs84:"-8.0,160.0,176.0"},EPSG_5365:{towgs84:"-0.16959,0.35312,0.51846,0.03385,-0.16325,0.03446,0.03693"},EPSG_4218:{towgs84:"304.5,306.5,-318.1"},EPSG_4242:{towgs84:"-33.722,153.789,94.959,-8.581,-4.478,4.54,8.95"},EPSG_4216:{towgs84:"-292.295,248.758,429.447,4.9971,2.99,6.6906,1.0289"},ESRI_104105:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},ESRI_104129:{towgs84:"0,0,0"},EPSG_4673:{towgs84:"174.05,-25.49,112.57"},EPSG_4202:{towgs84:"-124,-60,154"},EPSG_4203:{towgs84:"-117.763,-51.51,139.061,0.292,0.443,0.277,-0.191"},EPSG_3819:{towgs84:"595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408"},EPSG_8694:{towgs84:"-93.799,-132.737,-219.073,-1.844,0.648,-6.37,-0.169"},EPSG_4145:{towgs84:"275.57,676.78,229.6"},EPSG_4283:{towgs84:"0.06155,-0.01087,-0.04019,0.039492,0.032722,0.032898,-0.009994"},EPSG_4317:{towgs84:"2.3287,-147.0425,-92.0802,-0.309248,0.324822,0.497299,5.689063"},EPSG_4272:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993"},EPSG_4248:{towgs84:"-307.7,265.3,-363.5"},EPSG_5561:{towgs84:"24,-121,-76"},EPSG_5233:{towgs84:"-0.293,766.95,87.713,0.195704,1.695068,3.473016,-0.039338"},ESRI_104130:{towgs84:"-86,-98,-119"},ESRI_104102:{towgs84:"682,-203,480"},ESRI_37207:{towgs84:"7,-10,-26"},EPSG_4675:{towgs84:"59.935,118.4,-10.871"},ESRI_104109:{towgs84:"-89.121,-348.182,260.871"},ESRI_104112:{towgs84:"-185.583,-230.096,281.361"},ESRI_104113:{towgs84:"25.1,-275.6,222.6"},IGNF_WGS72G:{towgs84:"0,12,6"},IGNF_NTFG:{towgs84:"-168,-60,320"},IGNF_EFATE57G:{towgs84:"-127,-769,472"},IGNF_PGP50G:{towgs84:"324.8,153.6,172.1"},IGNF_REUN47G:{towgs84:"94,-948,-1262"},IGNF_CSG67G:{towgs84:"-186,230,110"},IGNF_GUAD48G:{towgs84:"-467,-16,-300"},IGNF_TAHI51G:{towgs84:"162,117,154"},IGNF_TAHAAG:{towgs84:"65,342,77"},IGNF_NUKU72G:{towgs84:"84,274,65"},IGNF_PETRELS72G:{towgs84:"365,194,166"},IGNF_WALL78G:{towgs84:"253,-133,-127"},IGNF_MAYO50G:{towgs84:"-382,-59,-262"},IGNF_TANNAG:{towgs84:"-139,-967,436"},IGNF_IGN72G:{towgs84:"-13,-348,292"},IGNF_ATIGG:{towgs84:"1118,23,66"},IGNF_FANGA84G:{towgs84:"150.57,158.33,118.32"},IGNF_RUSAT84G:{towgs84:"202.13,174.6,-15.74"},IGNF_KAUE70G:{towgs84:"126.74,300.1,-75.49"},IGNF_MOP90G:{towgs84:"-10.8,-1.8,12.77"},IGNF_MHPF67G:{towgs84:"338.08,212.58,-296.17"},IGNF_TAHI79G:{towgs84:"160.61,116.05,153.69"},IGNF_ANAA92G:{towgs84:"1.5,3.84,4.81"},IGNF_MARQUI72G:{towgs84:"330.91,-13.92,58.56"},IGNF_APAT86G:{towgs84:"143.6,197.82,74.05"},IGNF_TUBU69G:{towgs84:"237.17,171.61,-77.84"},IGNF_STPM50G:{towgs84:"11.363,424.148,373.13"},EPSG_4150:{towgs84:"674.374,15.056,405.346"},EPSG_4754:{towgs84:"-208.4058,-109.8777,-2.5764"},ESRI_104101:{towgs84:"372.87,149.23,585.29"},EPSG_4693:{towgs84:"0,-0.15,0.68"},EPSG_6207:{towgs84:"293.17,726.18,245.36"},EPSG_4153:{towgs84:"-133.63,-157.5,-158.62"},EPSG_4132:{towgs84:"-241.54,-163.64,396.06"},EPSG_4221:{towgs84:"-154.5,150.7,100.4"},EPSG_4266:{towgs84:"-80.7,-132.5,41.1"},EPSG_4193:{towgs84:"-70.9,-151.8,-41.4"},EPSG_5340:{towgs84:"-0.41,0.46,-0.35"},EPSG_4246:{towgs84:"-294.7,-200.1,525.5"},EPSG_4318:{towgs84:"-3.2,-5.7,2.8"},EPSG_4121:{towgs84:"-199.87,74.79,246.62"},EPSG_4223:{towgs84:"-260.1,5.5,432.2"},EPSG_4158:{towgs84:"-0.465,372.095,171.736"},EPSG_4285:{towgs84:"-128.16,-282.42,21.93"},EPSG_4613:{towgs84:"-404.78,685.68,45.47"},EPSG_4607:{towgs84:"195.671,332.517,274.607"},EPSG_4475:{towgs84:"-381.788,-57.501,-256.673"},EPSG_4208:{towgs84:"-157.84,308.54,-146.6"},EPSG_4743:{towgs84:"70.995,-335.916,262.898"},EPSG_4710:{towgs84:"-323.65,551.39,-491.22"},EPSG_7881:{towgs84:"-0.077,0.079,0.086"},EPSG_4682:{towgs84:"283.729,735.942,261.143"},EPSG_4739:{towgs84:"-156,-271,-189"},EPSG_4679:{towgs84:"-80.01,253.26,291.19"},EPSG_4750:{towgs84:"-56.263,16.136,-22.856"},EPSG_4644:{towgs84:"-10.18,-350.43,291.37"},EPSG_4695:{towgs84:"-103.746,-9.614,-255.95"},EPSG_4292:{towgs84:"-355,21,72"},EPSG_4302:{towgs84:"-61.702,284.488,472.052"},EPSG_4143:{towgs84:"-124.76,53,466.79"},EPSG_4606:{towgs84:"-153,153,307"},EPSG_4699:{towgs84:"-770.1,158.4,-498.2"},EPSG_4247:{towgs84:"-273.5,110.6,-357.9"},EPSG_4160:{towgs84:"8.88,184.86,106.69"},EPSG_4161:{towgs84:"-233.43,6.65,173.64"},EPSG_9251:{towgs84:"-9.5,122.9,138.2"},EPSG_9253:{towgs84:"-78.1,101.6,133.3"},EPSG_4297:{towgs84:"-198.383,-240.517,-107.909"},EPSG_4269:{towgs84:"0,0,0"},EPSG_4301:{towgs84:"-147,506,687"},EPSG_4618:{towgs84:"-59,-11,-52"},EPSG_4612:{towgs84:"0,0,0"},EPSG_4678:{towgs84:"44.585,-131.212,-39.544"},EPSG_4250:{towgs84:"-130,29,364"},EPSG_4144:{towgs84:"214,804,268"},EPSG_4147:{towgs84:"-17.51,-108.32,-62.39"},EPSG_4259:{towgs84:"-254.1,-5.36,-100.29"},EPSG_4164:{towgs84:"-76,-138,67"},EPSG_4211:{towgs84:"-378.873,676.002,-46.255"},EPSG_4182:{towgs84:"-422.651,-172.995,84.02"},EPSG_4224:{towgs84:"-143.87,243.37,-33.52"},EPSG_4225:{towgs84:"-205.57,168.77,-4.12"},EPSG_5527:{towgs84:"-67.35,3.88,-38.22"},EPSG_4752:{towgs84:"98,390,-22"},EPSG_4310:{towgs84:"-30,190,89"},EPSG_9248:{towgs84:"-192.26,65.72,132.08"},EPSG_4680:{towgs84:"124.5,-63.5,-281"},EPSG_4701:{towgs84:"-79.9,-158,-168.9"},EPSG_4706:{towgs84:"-146.21,112.63,4.05"},EPSG_4805:{towgs84:"682,-203,480"},EPSG_4201:{towgs84:"-165,-11,206"},EPSG_4210:{towgs84:"-157,-2,-299"},EPSG_4183:{towgs84:"-104,167,-38"},EPSG_4139:{towgs84:"11,72,-101"},EPSG_4668:{towgs84:"-86,-98,-119"},EPSG_4717:{towgs84:"-2,151,181"},EPSG_4732:{towgs84:"102,52,-38"},EPSG_4280:{towgs84:"-377,681,-50"},EPSG_4209:{towgs84:"-138,-105,-289"},EPSG_4261:{towgs84:"31,146,47"},EPSG_4658:{towgs84:"-73,46,-86"},EPSG_4721:{towgs84:"265.025,384.929,-194.046"},EPSG_4222:{towgs84:"-136,-108,-292"},EPSG_4601:{towgs84:"-255,-15,71"},EPSG_4602:{towgs84:"725,685,536"},EPSG_4603:{towgs84:"72,213.7,93"},EPSG_4605:{towgs84:"9,183,236"},EPSG_4621:{towgs84:"137,248,-430"},EPSG_4657:{towgs84:"-28,199,5"},EPSG_4316:{towgs84:"103.25,-100.4,-307.19"},EPSG_4642:{towgs84:"-13,-348,292"},EPSG_4698:{towgs84:"145,-187,103"},EPSG_4192:{towgs84:"-206.1,-174.7,-87.7"},EPSG_4311:{towgs84:"-265,120,-358"},EPSG_4135:{towgs84:"58,-283,-182"},ESRI_104138:{towgs84:"198,-226,-347"},EPSG_4245:{towgs84:"-11,851,5"},EPSG_4142:{towgs84:"-125,53,467"},EPSG_4213:{towgs84:"-106,-87,188"},EPSG_4253:{towgs84:"-133,-77,-51"},EPSG_4129:{towgs84:"-132,-110,-335"},EPSG_4713:{towgs84:"-77,-128,142"},EPSG_4239:{towgs84:"217,823,299"},EPSG_4146:{towgs84:"295,736,257"},EPSG_4155:{towgs84:"-83,37,124"},EPSG_4165:{towgs84:"-173,253,27"},EPSG_4672:{towgs84:"175,-38,113"},EPSG_4236:{towgs84:"-637,-549,-203"},EPSG_4251:{towgs84:"-90,40,88"},EPSG_4271:{towgs84:"-2,374,172"},EPSG_4175:{towgs84:"-88,4,101"},EPSG_4716:{towgs84:"298,-304,-375"},EPSG_4315:{towgs84:"-23,259,-9"},EPSG_4744:{towgs84:"-242.2,-144.9,370.3"},EPSG_4244:{towgs84:"-97,787,86"},EPSG_4293:{towgs84:"616,97,-251"},EPSG_4714:{towgs84:"-127,-769,472"},EPSG_4736:{towgs84:"260,12,-147"},EPSG_6883:{towgs84:"-235,-110,393"},EPSG_6894:{towgs84:"-63,176,185"},EPSG_4205:{towgs84:"-43,-163,45"},EPSG_4256:{towgs84:"41,-220,-134"},EPSG_4262:{towgs84:"639,405,60"},EPSG_4604:{towgs84:"174,359,365"},EPSG_4169:{towgs84:"-115,118,426"},EPSG_4620:{towgs84:"-106,-129,165"},EPSG_4184:{towgs84:"-203,141,53"},EPSG_4616:{towgs84:"-289,-124,60"},EPSG_9403:{towgs84:"-307,-92,127"},EPSG_4684:{towgs84:"-133,-321,50"},EPSG_4708:{towgs84:"-491,-22,435"},EPSG_4707:{towgs84:"114,-116,-333"},EPSG_4709:{towgs84:"145,75,-272"},EPSG_4712:{towgs84:"-205,107,53"},EPSG_4711:{towgs84:"124,-234,-25"},EPSG_4718:{towgs84:"230,-199,-752"},EPSG_4719:{towgs84:"211,147,111"},EPSG_4724:{towgs84:"208,-435,-229"},EPSG_4725:{towgs84:"189,-79,-202"},EPSG_4735:{towgs84:"647,1777,-1124"},EPSG_4722:{towgs84:"-794,119,-298"},EPSG_4728:{towgs84:"-307,-92,127"},EPSG_4734:{towgs84:"-632,438,-609"},EPSG_4727:{towgs84:"912,-58,1227"},EPSG_4729:{towgs84:"185,165,42"},EPSG_4730:{towgs84:"170,42,84"},EPSG_4733:{towgs84:"276,-57,149"},ESRI_37218:{towgs84:"230,-199,-752"},ESRI_37240:{towgs84:"-7,215,225"},ESRI_37221:{towgs84:"252,-209,-751"},ESRI_4305:{towgs84:"-123,-206,219"},ESRI_104139:{towgs84:"-73,-247,227"},EPSG_4748:{towgs84:"51,391,-36"},EPSG_4219:{towgs84:"-384,664,-48"},EPSG_4255:{towgs84:"-333,-222,114"},EPSG_4257:{towgs84:"-587.8,519.75,145.76"},EPSG_4646:{towgs84:"-963,510,-359"},EPSG_6881:{towgs84:"-24,-203,268"},EPSG_6882:{towgs84:"-183,-15,273"},EPSG_4715:{towgs84:"-104,-129,239"},IGNF_RGF93GDD:{towgs84:"0,0,0"},IGNF_RGM04GDD:{towgs84:"0,0,0"},IGNF_RGSPM06GDD:{towgs84:"0,0,0"},IGNF_RGTAAF07GDD:{towgs84:"0,0,0"},IGNF_RGFG95GDD:{towgs84:"0,0,0"},IGNF_RGNCG:{towgs84:"0,0,0"},IGNF_RGPFGDD:{towgs84:"0,0,0"},IGNF_ETRS89G:{towgs84:"0,0,0"},IGNF_RGR92GDD:{towgs84:"0,0,0"},EPSG_4173:{towgs84:"0,0,0"},EPSG_4180:{towgs84:"0,0,0"},EPSG_4619:{towgs84:"0,0,0"},EPSG_4667:{towgs84:"0,0,0"},EPSG_4075:{towgs84:"0,0,0"},EPSG_6706:{towgs84:"0,0,0"},EPSG_7798:{towgs84:"0,0,0"},EPSG_4661:{towgs84:"0,0,0"},EPSG_4669:{towgs84:"0,0,0"},EPSG_8685:{towgs84:"0,0,0"},EPSG_4151:{towgs84:"0,0,0"},EPSG_9702:{towgs84:"0,0,0"},EPSG_4758:{towgs84:"0,0,0"},EPSG_4761:{towgs84:"0,0,0"},EPSG_4765:{towgs84:"0,0,0"},EPSG_8997:{towgs84:"0,0,0"},EPSG_4023:{towgs84:"0,0,0"},EPSG_4670:{towgs84:"0,0,0"},EPSG_4694:{towgs84:"0,0,0"},EPSG_4148:{towgs84:"0,0,0"},EPSG_4163:{towgs84:"0,0,0"},EPSG_4167:{towgs84:"0,0,0"},EPSG_4189:{towgs84:"0,0,0"},EPSG_4190:{towgs84:"0,0,0"},EPSG_4176:{towgs84:"0,0,0"},EPSG_4659:{towgs84:"0,0,0"},EPSG_3824:{towgs84:"0,0,0"},EPSG_3889:{towgs84:"0,0,0"},EPSG_4046:{towgs84:"0,0,0"},EPSG_4081:{towgs84:"0,0,0"},EPSG_4558:{towgs84:"0,0,0"},EPSG_4483:{towgs84:"0,0,0"},EPSG_5013:{towgs84:"0,0,0"},EPSG_5264:{towgs84:"0,0,0"},EPSG_5324:{towgs84:"0,0,0"},EPSG_5354:{towgs84:"0,0,0"},EPSG_5371:{towgs84:"0,0,0"},EPSG_5373:{towgs84:"0,0,0"},EPSG_5381:{towgs84:"0,0,0"},EPSG_5393:{towgs84:"0,0,0"},EPSG_5489:{towgs84:"0,0,0"},EPSG_5593:{towgs84:"0,0,0"},EPSG_6135:{towgs84:"0,0,0"},EPSG_6365:{towgs84:"0,0,0"},EPSG_5246:{towgs84:"0,0,0"},EPSG_7886:{towgs84:"0,0,0"},EPSG_8431:{towgs84:"0,0,0"},EPSG_8427:{towgs84:"0,0,0"},EPSG_8699:{towgs84:"0,0,0"},EPSG_8818:{towgs84:"0,0,0"},EPSG_4757:{towgs84:"0,0,0"},EPSG_9140:{towgs84:"0,0,0"},EPSG_8086:{towgs84:"0,0,0"},EPSG_4686:{towgs84:"0,0,0"},EPSG_4737:{towgs84:"0,0,0"},EPSG_4702:{towgs84:"0,0,0"},EPSG_4747:{towgs84:"0,0,0"},EPSG_4749:{towgs84:"0,0,0"},EPSG_4674:{towgs84:"0,0,0"},EPSG_4755:{towgs84:"0,0,0"},EPSG_4759:{towgs84:"0,0,0"},EPSG_4762:{towgs84:"0,0,0"},EPSG_4763:{towgs84:"0,0,0"},EPSG_4764:{towgs84:"0,0,0"},EPSG_4166:{towgs84:"0,0,0"},EPSG_4170:{towgs84:"0,0,0"},EPSG_5546:{towgs84:"0,0,0"},EPSG_7844:{towgs84:"0,0,0"},EPSG_4818:{towgs84:"589,76,480"},EPSG_10328:{towgs84:"0,0,0"},EPSG_9782:{towgs84:"0,0,0"},EPSG_9777:{towgs84:"0,0,0"},EPSG_10690:{towgs84:"0,0,0"},EPSG_10639:{towgs84:"0,0,0"},EPSG_10739:{towgs84:"0,0,0"},EPSG_7686:{towgs84:"0,0,0"},EPSG_8900:{towgs84:"0,0,0"},EPSG_5886:{towgs84:"0,0,0"},EPSG_7683:{towgs84:"0,0,0"},EPSG_6668:{towgs84:"0,0,0"},EPSG_20046:{towgs84:"0,0,0"},EPSG_10299:{towgs84:"0,0,0"},EPSG_10310:{towgs84:"0,0,0"},EPSG_10475:{towgs84:"0,0,0"},EPSG_4742:{towgs84:"0,0,0"},EPSG_10671:{towgs84:"0,0,0"},EPSG_10762:{towgs84:"0,0,0"},EPSG_10725:{towgs84:"0,0,0"},EPSG_10791:{towgs84:"0,0,0"},EPSG_10800:{towgs84:"0,0,0"},EPSG_10305:{towgs84:"0,0,0"},EPSG_10941:{towgs84:"0,0,0"},EPSG_10968:{towgs84:"0,0,0"},EPSG_10875:{towgs84:"0,0,0"},EPSG_6318:{towgs84:"0,0,0"},EPSG_10910:{towgs84:"0,0,0"}};for(var El in xl){var Sl=xl[El];Sl.datumName&&(xl[Sl.datumName]=Sl)}const bl=xl;var Pl={};async function Cl(t,e){for(var i=[],s=await e.getImageCount(),n=s-1;n>=0;n--){var r=await e.getImage(n),o=await r.readRasters(),a=[r.getWidth(),r.getHeight()],h=r.getBoundingBox().map(Il),l=[r.fileDirectory.ModelPixelScale[0],r.fileDirectory.ModelPixelScale[1]].map(Il),c=h[0]+(a[0]-1)*l[0],u=h[3]-(a[1]-1)*l[1],d=o[0],g=o[1],f=[];for(let t=a[1]-1;t>=0;t--)for(let e=a[0]-1;e>=0;e--){var _=t*a[0]+e;f.push([-Gl(g[_]),Gl(d[_])])}i.push({del:l,lim:a,ll:[-c,u],cvs:f})}var p={header:{nSubgrids:s},subgrids:i};return Pl[t]=p,p}function Rl(t){if(0===t.length)return null;var e="@"===t[0];return e&&(t=t.slice(1)),"null"===t?{name:"null",mandatory:!e,grid:null,isNull:!0}:{name:t,mandatory:!e,grid:Pl[t]||null,isNull:!1}}function Il(t){return t*Math.PI/180}function Gl(t){return t/3600*Math.PI/180}function Al(t,e,i){return String.fromCharCode.apply(null,new Uint8Array(t.buffer.slice(e,i)))}function Tl(t){return t.map(function(t){return[Gl(t.longitudeShift),Gl(t.latitudeShift)]})}function Ol(t,e,i){return{name:Al(t,e+8,e+16).trim(),parent:Al(t,e+24,e+24+8).trim(),lowerLatitude:t.getFloat64(e+72,i),upperLatitude:t.getFloat64(e+88,i),lowerLongitude:t.getFloat64(e+104,i),upperLongitude:t.getFloat64(e+120,i),latitudeInterval:t.getFloat64(e+136,i),longitudeInterval:t.getFloat64(e+152,i),gridNodeCount:t.getInt32(e+168,i)}}function Ll(t,e,i,s,n){var r=e+176,o=16;!1===n&&(o=8);for(var a=[],h=0;h<i.gridNodeCount;h++){var l={latitudeShift:t.getFloat32(r+h*o,s),longitudeShift:t.getFloat32(r+h*o+4,s)};!1!==n&&(l.latitudeAccuracy=t.getFloat32(r+h*o+8,s),l.longitudeAccuracy=t.getFloat32(r+h*o+12,s)),a.push(l)}return a}function Nl(t,e){if(!(this instanceof Nl))return new Nl(t);this.forward=null,this.inverse=null,this.init=null,this.name,this.names=null,this.title,e=e||function(t){if(t)throw t};var i=function(t){let e;if(function(t){return"string"==typeof t}(t))if(function(t){return t in nl}(t))e=nl[t];else if(function(t){return 0!==t.indexOf("+")&&-1!==t.indexOf("[")||"object"==typeof t&&!("srsCode"in t)}(t)){e=il(t);var i=function(t){var e=Lh(t,"extension");if(e)return Lh(e,"proj4")}(e);i&&(e=Nh(i))}else(function(t){return"+"===t[0]})(t)&&(e=Nh(t));else e="projName"in t?t:il(t);return e&&function(t){if(t.title)return 0===t.title.toLowerCase().indexOf("epsg:")&&rl.indexOf(t.title.substr(5))>-1;var e=Lh(t,"authority");if(e){var i=Lh(e,"epsg");return i&&rl.indexOf(i)>-1}}(e)?nl["EPSG:3857"]:e}(t);if("object"==typeof i){var s=Nl.projections.get(i.projName);if(s){if(i.datumCode&&"none"!==i.datumCode){var n=Lh(bl,i.datumCode);n&&(i.datum_params=i.datum_params||(n.towgs84?n.towgs84.split(","):null),i.ellps=n.ellipse,i.datumName=n.datumName?n.datumName:i.datumCode)}i.k0=i.k0||1,i.axis=i.axis||"enu",i.ellps=i.ellps||"wgs84",i.lat1=i.lat1||i.lat0;var r=function(t,e,i,s,n){if(!t){var r=Lh(Ml,s);r||(r=wl),t=r.a,e=r.b,i=r.rf}return i&&!e&&(e=(1-1/i)*t),(0===i||Math.abs(t-e)<bh)&&(n=!0,e=t),{a:t,b:e,rf:i,sphere:n}}(i.a,i.b,i.rf,i.ellps,i.sphere),o=function(t,e,i,s){var n=t*t,r=e*e,o=(n-r)/n,a=0;return s?(n=(t*=1-o*(.16666666666666666+o*(.04722222222222222+.022156084656084655*o)))*t,o=0):a=Math.sqrt(o),{es:o,e:a,ep2:(n-r)/r}}(r.a,r.b,r.rf,i.R_A),a=function(t){return void 0===t?null:t.split(",").map(Rl)}(i.nadgrids),h=i.datum||function(t,e,i,s,n,r,o){var a={};return a.datum_type=void 0===t||"none"===t?5:4,e&&(a.datum_params=e.map(parseFloat),0===a.datum_params[0]&&0===a.datum_params[1]&&0===a.datum_params[2]||(a.datum_type=1),a.datum_params.length>3&&(0===a.datum_params[3]&&0===a.datum_params[4]&&0===a.datum_params[5]&&0===a.datum_params[6]||(a.datum_type=2,a.datum_params[3]*=Eh,a.datum_params[4]*=Eh,a.datum_params[5]*=Eh,a.datum_params[6]=a.datum_params[6]/1e6+1))),o&&(a.datum_type=3,a.grids=o),a.a=i,a.b=s,a.es=n,a.ep2=r,a}(i.datumCode,i.datum_params,r.a,r.b,o.es,o.ep2,a);ol(this,i),ol(this,s),this.a=r.a,this.b=r.b,this.rf=r.rf,this.sphere=r.sphere,this.es=o.es,this.e=o.e,this.ep2=o.ep2,this.datum=h,"init"in this&&"function"==typeof this.init&&this.init(),e(null,this)}else e("Could not get projection name from: "+t)}else e("Could not parse to valid json: "+t)}Nl.projections=vl,Nl.projections.start();const kl=Nl;function Fl(t,e,i){var s,n,r,o,a=t.x,h=t.y,l=t.z?t.z:0;if(h<-Sh&&h>-1.001*Sh)h=-Sh;else if(h>Sh&&h<1.001*Sh)h=Sh;else{if(h<-Sh)return{x:-1/0,y:-1/0,z:t.z};if(h>Sh)return{x:1/0,y:1/0,z:t.z}}return a>Math.PI&&(a-=2*Math.PI),n=Math.sin(h),o=Math.cos(h),r=n*n,{x:((s=i/Math.sqrt(1-e*r))+l)*o*Math.cos(a),y:(s+l)*o*Math.sin(a),z:(s*(1-e)+l)*n}}function zl(t,e,i,s){var n,r,o,a,h,l,c,u,d,g,f,_,p,m,y,v=t.x,M=t.y,w=t.z?t.z:0;if(n=Math.sqrt(v*v+M*M),r=Math.sqrt(v*v+M*M+w*w),n/i<1e-12){if(m=0,r/i<1e-12)return y=-s,{x:t.x,y:t.y,z:t.z}}else m=Math.atan2(M,v);o=w/r,u=(a=n/r)*(1-e)*(h=1/Math.sqrt(1-e*(2-e)*a*a)),d=o*h,p=0;do{p++,l=e*(c=i/Math.sqrt(1-e*d*d))/(c+(y=n*u+w*d-c*(1-e*d*d))),_=(f=o*(h=1/Math.sqrt(1-l*(2-l)*a*a)))*u-(g=a*(1-l)*h)*d,u=g,d=f}while(_*_>1e-24&&p<30);return{x:m,y:Math.atan(f/Math.abs(g)),z:y}}function Dl(t){return 1===t||2===t}function jl(t,e,i){if(null===t.grids||0===t.grids.length)return console.log("Grid shift grids not found"),-1;var s={x:-i.x,y:i.y},n={x:Number.NaN,y:Number.NaN},r=[];t:for(var o=0;o<t.grids.length;o++){var a=t.grids[o];if(r.push(a.name),a.isNull){n=s;break}if(null!==a.grid)for(var h=a.grid.subgrids,l=0,c=h.length;l<c;l++){var u=h[l],d=(Math.abs(u.del[1])+Math.abs(u.del[0]))/1e4,g=u.ll[0]-d,f=u.ll[1]-d,_=u.ll[0]+(u.lim[0]-1)*u.del[0]+d,p=u.ll[1]+(u.lim[1]-1)*u.del[1]+d;if(!(f>s.y||g>s.x||p<s.y||_<s.x||(n=ql(s,e,u),isNaN(n.x))))break t}else if(a.mandatory)return console.log("Unable to find mandatory grid '"+a.name+"'"),-1}return isNaN(n.x)?(console.log("Failed to find a grid shift table for location '"+-s.x*Ch+" "+s.y*Ch+" tried: '"+r+"'"),-1):(i.x=-n.x,i.y=n.y,0)}function ql(t,e,i){var s={x:Number.NaN,y:Number.NaN};if(isNaN(t.x))return s;var n={x:t.x,y:t.y};n.x-=i.ll[0],n.y-=i.ll[1],n.x=ll(n.x-Math.PI)+Math.PI;var r=Ul(n,i);if(e){if(isNaN(r.x))return s;r.x=n.x-r.x,r.y=n.y-r.y;var o,a,h=9;do{if(a=Ul(r,i),isNaN(a.x)){console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");break}o={x:n.x-(a.x+r.x),y:n.y-(a.y+r.y)},r.x+=o.x,r.y+=o.y}while(h--&&Math.abs(o.x)>1e-12&&Math.abs(o.y)>1e-12);if(h<0)return console.log("Inverse grid shift iterator failed to converge."),s;s.x=ll(r.x+i.ll[0]),s.y=r.y+i.ll[1]}else isNaN(r.x)||(s.x=t.x+r.x,s.y=t.y+r.y);return s}function Ul(t,e){var i,s={x:t.x/e.del[0],y:t.y/e.del[1]},n=Math.floor(s.x),r=Math.floor(s.y),o=s.x-1*n,a=s.y-1*r,h={x:Number.NaN,y:Number.NaN};if(n<0||n>=e.lim[0])return h;if(r<0||r>=e.lim[1])return h;i=r*e.lim[0]+n;var l=e.cvs[i][0],c=e.cvs[i][1];i++;var u=e.cvs[i][0],d=e.cvs[i][1];i+=e.lim[0];var g=e.cvs[i][0],f=e.cvs[i][1];i--;var _=e.cvs[i][0],p=e.cvs[i][1],m=o*a,y=o*(1-a),v=(1-o)*(1-a),M=(1-o)*a;return h.x=v*l+y*u+M*_+m*g,h.y=v*c+y*d+M*p+m*f,h}function Bl(t,e,i){var s,n,r,o=i.x,a=i.y,h=i.z||0,l={};for(r=0;r<3;r++)if(!e||2!==r||void 0!==i.z)switch(0===r?(s=o,n=-1!=="ew".indexOf(t.axis[r])?"x":"y"):1===r?(s=a,n=-1!=="ns".indexOf(t.axis[r])?"y":"x"):(s=h,n="z"),t.axis[r]){case"e":case"n":l[n]=s;break;case"w":case"s":l[n]=-s;break;case"u":void 0!==i[n]&&(l.z=s);break;case"d":void 0!==i[n]&&(l.z=-s);break;default:return null}return l}function Kl(t){var e={x:t[0],y:t[1]};return t.length>2&&(e.z=t[2]),t.length>3&&(e.m=t[3]),e}function Xl(t){if("function"==typeof Number.isFinite){if(Number.isFinite(t))return;throw new TypeError("coordinates must be finite numbers")}if("number"!=typeof t||t!=t||!isFinite(t))throw new TypeError("coordinates must be finite numbers")}function Wl(t,e,i,s){var n,r=void 0!==(i=Array.isArray(i)?Kl(i):{x:i.x,y:i.y,z:i.z,m:i.m}).z;if(function(t){Xl(t.x),Xl(t.y)}(i),t.datum&&e.datum&&function(t,e){return(1===t.datum.datum_type||2===t.datum.datum_type||3===t.datum.datum_type)&&"WGS84"!==e.datumCode||(1===e.datum.datum_type||2===e.datum.datum_type||3===e.datum.datum_type)&&"WGS84"!==t.datumCode}(t,e)&&(i=Wl(t,n=new kl("WGS84"),i,s),t=n),s&&"enu"!==t.axis&&(i=Bl(t,!1,i)),"longlat"===t.projName)i={x:i.x*Ph,y:i.y*Ph,z:i.z||0};else if(t.to_meter&&(i={x:i.x*t.to_meter,y:i.y*t.to_meter,z:i.z||0}),!(i=t.inverse(i)))return;if(t.from_greenwich&&(i.x+=t.from_greenwich),i=function(t,e,i){if(function(t,e){return t.datum_type===e.datum_type&&!(t.a!==e.a||Math.abs(t.es-e.es)>5e-11)&&(1===t.datum_type?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]:2!==t.datum_type||t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]&&t.datum_params[3]===e.datum_params[3]&&t.datum_params[4]===e.datum_params[4]&&t.datum_params[5]===e.datum_params[5]&&t.datum_params[6]===e.datum_params[6])}(t,e))return i;if(5===t.datum_type||5===e.datum_type)return i;var s=t.a,n=t.es;if(3===t.datum_type){if(0!==jl(t,!1,i))return;s=wh,n=xh}var r=e.a,o=e.b,a=e.es;return 3===e.datum_type&&(r=wh,o=6356752.314,a=xh),n!==a||s!==r||Dl(t.datum_type)||Dl(e.datum_type)?(i=Fl(i,n,s),Dl(t.datum_type)&&(i=function(t,e,i){if(1===e)return{x:t.x+i[0],y:t.y+i[1],z:t.z+i[2]};if(2===e){var s=i[0],n=i[1],r=i[2],o=i[3],a=i[4],h=i[5],l=i[6];return{x:l*(t.x-h*t.y+a*t.z)+s,y:l*(h*t.x+t.y-o*t.z)+n,z:l*(-a*t.x+o*t.y+t.z)+r}}}(i,t.datum_type,t.datum_params)),Dl(e.datum_type)&&(i=function(t,e,i){if(1===e)return{x:t.x-i[0],y:t.y-i[1],z:t.z-i[2]};if(2===e){var s=i[0],n=i[1],r=i[2],o=i[3],a=i[4],h=i[5],l=i[6],c=(t.x-s)/l,u=(t.y-n)/l,d=(t.z-r)/l;return{x:c+h*u-a*d,y:-h*c+u+o*d,z:a*c-o*u+d}}}(i,e.datum_type,e.datum_params)),i=zl(i,a,r,o),3!==e.datum_type||0===jl(e,!0,i)?i:void 0):i}(t.datum,e.datum,i))return e.from_greenwich&&(i={x:i.x-e.from_greenwich,y:i.y,z:i.z||0}),"longlat"===e.projName?i={x:i.x*Ch,y:i.y*Ch,z:i.z||0}:(i=e.forward(i),e.to_meter&&(i={x:i.x/e.to_meter,y:i.y/e.to_meter,z:i.z||0})),s&&"enu"!==e.axis?Bl(e,!0,i):(i&&!r&&"geocent"!==e.projName&&delete i.z,i)}var Zl=kl("WGS84");function Vl(t,e,i,s){var n,r,o;return Array.isArray(i)?(n=Wl(t,e,i,s)||{x:NaN,y:NaN},i.length>2?void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name?"number"==typeof n.z?[n.x,n.y,n.z].concat(i.slice(3)):[n.x,n.y,i[2]].concat(i.slice(3)):[n.x,n.y].concat(i.slice(2)):[n.x,n.y]):(r=Wl(t,e,i,s),2===(o=Object.keys(i)).length||o.forEach(function(s){if(void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name){if("x"===s||"y"===s||"z"===s)return}else if("x"===s||"y"===s)return;r[s]=i[s]}),r)}function Yl(t){return t instanceof kl?t:"object"==typeof t&&"oProj"in t?t.oProj:kl(t)}var Hl="AJSAJS",$l="AFAFAF",Ql=65,Jl=73,tc=79;const ec={forward:ic,inverse:function(t){var e=oc(hc(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat,e.lon,e.lat]:[e.left,e.bottom,e.right,e.top]},toPoint:sc};function ic(t,e){return e=e||5,function(t,e){var i,s,n,r,o,a,h,l,c,u,d,g="00000"+t.easting,f="00000"+t.northing;return t.zoneNumber+t.zoneLetter+(c=t.easting,u=t.northing,d=ac(t.zoneNumber),i=Math.floor(c/1e5),s=Math.floor(u/1e5)%20,r=Hl.charCodeAt(n=d-1),o=$l.charCodeAt(n),l=!1,(a=r+i-1)>90&&(a=a-90+Ql-1,l=!0),(a===Jl||r<Jl&&a>Jl||(a>Jl||r<Jl)&&l)&&a++,(a===tc||r<tc&&a>tc||(a>tc||r<tc)&&l)&&++a===Jl&&a++,a>90&&(a=a-90+Ql-1),(h=o+s)>86?(h=h-86+Ql-1,l=!0):l=!1,(h===Jl||o<Jl&&h>Jl||(h>Jl||o<Jl)&&l)&&h++,(h===tc||o<tc&&h>tc||(h>tc||o<tc)&&l)&&++h===Jl&&h++,h>86&&(h=h-86+Ql-1),String.fromCharCode(a)+String.fromCharCode(h))+g.substr(g.length-5,e)+f.substr(f.length-5,e)}(function(t){var e,i,s,n,r,o,a,h=t.lat,l=t.lon,c=6378137,u=.00669438,d=.9996,g=nc(h),f=nc(l);a=Math.floor((l+180)/6)+1,180===l&&(a=60),h>=56&&h<64&&l>=3&&l<12&&(a=32),h>=72&&h<84&&(l>=0&&l<9?a=31:l>=9&&l<21?a=33:l>=21&&l<33?a=35:l>=33&&l<42&&(a=37)),o=nc(6*(a-1)-180+3),e=.006739496752268451,i=c/Math.sqrt(1-u*Math.sin(g)*Math.sin(g)),s=Math.tan(g)*Math.tan(g),n=e*Math.cos(g)*Math.cos(g);var _,p,m=d*i*((r=Math.cos(g)*(f-o))+(1-s+n)*r*r*r/6+(5-18*s+s*s+72*n-58*e)*r*r*r*r*r/120)+5e5,y=d*(c*(.9983242984503243*g-.002514607064228144*Math.sin(2*g)+2639046602129982e-21*Math.sin(4*g)-3.418046101696858e-9*Math.sin(6*g))+i*Math.tan(g)*(r*r/2+(5-s+9*n+4*n*n)*r*r*r*r/24+(61-58*s+s*s+600*n-2.2240339282485886)*r*r*r*r*r*r/720));return h<0&&(y+=1e7),{northing:Math.round(y),easting:Math.round(m),zoneNumber:a,zoneLetter:(_=h,p="Z",84>=_&&_>=72?p="X":72>_&&_>=64?p="W":64>_&&_>=56?p="V":56>_&&_>=48?p="U":48>_&&_>=40?p="T":40>_&&_>=32?p="S":32>_&&_>=24?p="R":24>_&&_>=16?p="Q":16>_&&_>=8?p="P":8>_&&_>=0?p="N":0>_&&_>=-8?p="M":-8>_&&_>=-16?p="L":-16>_&&_>=-24?p="K":-24>_&&_>=-32?p="J":-32>_&&_>=-40?p="H":-40>_&&_>=-48?p="G":-48>_&&_>=-56?p="F":-56>_&&_>=-64?p="E":-64>_&&_>=-72?p="D":-72>_&&_>=-80&&(p="C"),p)}}({lat:t[1],lon:t[0]}),e)}function sc(t){var e=oc(hc(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function nc(t){return t*(Math.PI/180)}function rc(t){return t/Math.PI*180}function oc(t){var e=t.northing,i=t.easting,s=t.zoneLetter,n=t.zoneNumber;if(n<0||n>60)return null;var r,o,a,h,l,c,u,d,g,f=.9996,_=6378137,p=.00669438,m=(1-Math.sqrt(.99330562))/(1+Math.sqrt(.99330562)),y=i-5e5,v=e;s<"N"&&(v-=1e7),u=6*(n-1)-180+3,r=.006739496752268451,g=(d=v/f/6367449.145945056)+(3*m/2-27*m*m*m/32)*Math.sin(2*d)+(21*m*m/16-55*m*m*m*m/32)*Math.sin(4*d)+151*m*m*m/96*Math.sin(6*d),o=_/Math.sqrt(1-p*Math.sin(g)*Math.sin(g)),a=Math.tan(g)*Math.tan(g),h=r*Math.cos(g)*Math.cos(g),l=.99330562*_/Math.pow(1-p*Math.sin(g)*Math.sin(g),1.5),c=y/(o*f);var M=g-o*Math.tan(g)/l*(c*c/2-(5+3*a+10*h-4*h*h-9*r)*c*c*c*c/24+(61+90*a+298*h+45*a*a-1.6983531815716497-3*h*h)*c*c*c*c*c*c/720);M=rc(M);var w,x=(c-(1+2*a+h)*c*c*c/6+(5-2*h+28*a-3*h*h+8*r+24*a*a)*c*c*c*c*c/120)/Math.cos(g);if(x=u+rc(x),t.accuracy){var E=oc({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});w={top:E.lat,right:E.lon,bottom:M,left:x}}else w={lat:M,lon:x};return w}function ac(t){var e=t%6;return 0===e&&(e=6),e}function hc(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";for(var e,i=t.length,s=null,n="",r=0;!/[A-Z]/.test(e=t.charAt(r));){if(r>=2)throw"MGRSPoint bad conversion from: "+t;n+=e,r++}var o=parseInt(n,10);if(0===r||r+3>i)throw"MGRSPoint bad conversion from: "+t;var a=t.charAt(r++);if(a<="A"||"B"===a||"Y"===a||a>="Z"||"I"===a||"O"===a)throw"MGRSPoint zone letter "+a+" not handled: "+t;s=t.substring(r,r+=2);for(var h=ac(o),l=function(t,e){for(var i=Hl.charCodeAt(e-1),s=1e5,n=!1;i!==t.charCodeAt(0);){if(++i===Jl&&i++,i===tc&&i++,i>90){if(n)throw"Bad character: "+t;i=Ql,n=!0}s+=1e5}return s}(s.charAt(0),h),c=function(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;for(var i=$l.charCodeAt(e-1),s=0,n=!1;i!==t.charCodeAt(0);){if(++i===Jl&&i++,i===tc&&i++,i>86){if(n)throw"Bad character: "+t;i=Ql,n=!0}s+=1e5}return s}(s.charAt(1),h);c<lc(a);)c+=2e6;var u=i-r;if(u%2!=0)throw"MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters"+t;var d,g,f,_=u/2,p=0,m=0;return _>0&&(d=1e5/Math.pow(10,_),g=t.substring(r,r+_),p=parseFloat(g)*d,f=t.substring(r+_),m=parseFloat(f)*d),{easting:p+l,northing:m+c,zoneLetter:a,zoneNumber:o,accuracy:d}}function lc(t){var e;switch(t){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+t}function cc(t,e,i){if(!(this instanceof cc))return new cc(t,e,i);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if("object"==typeof t)this.x=t.x,this.y=t.y,this.z=t.z||0;else if("string"==typeof t&&void 0===e){var s=t.split(",");this.x=parseFloat(s[0]),this.y=parseFloat(s[1]),this.z=parseFloat(s[2])||0}else this.x=t,this.y=e,this.z=i||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}cc.fromMGRS=function(t){return new cc(sc(t))},cc.prototype.toMGRS=function(t){return ic([this.x,this.y],t)};const uc=cc;var dc=.046875,gc=.01953125,fc=.01068115234375;function _c(t){var e=[];e[0]=1-t*(.25+t*(dc+t*(gc+t*fc))),e[1]=t*(.75-t*(dc+t*(gc+t*fc)));var i=t*t;return e[2]=i*(.46875-t*(.013020833333333334+.007120768229166667*t)),i*=t,e[3]=i*(.3645833333333333-.005696614583333333*t),e[4]=i*t*.3076171875,e}function pc(t,e,i,s){return i*=e,e*=e,s[0]*t-i*(s[1]+e*(s[2]+e*(s[3]+e*s[4])))}function mc(t,e,i){for(var s=1/(1-e),n=t,r=20;r;--r){var o=Math.sin(n),a=1-e*o*o;if(n-=a=(pc(n,o,Math.cos(n),i)-t)*(a*Math.sqrt(a))*s,Math.abs(a)<bh)return n}return n}const yc={init:function(){this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.es&&(this.en=_c(this.es),this.ml0=pc(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))},forward:function(t){var e,i,s,n=t.x,r=t.y,o=ll(n-this.long0,this.over),a=Math.sin(r),h=Math.cos(r);if(this.es){var l=h*o,c=Math.pow(l,2),u=this.ep2*Math.pow(h,2),d=Math.pow(u,2),g=Math.abs(h)>bh?Math.tan(r):0,f=Math.pow(g,2),_=Math.pow(f,2);e=1-this.es*Math.pow(a,2),l/=Math.sqrt(e);var p=pc(r,a,h,this.en);i=this.a*(this.k0*l*(1+c/6*(1-f+u+c/20*(5-18*f+_+14*u-58*f*u+c/42*(61+179*_-_*f-479*f)))))+this.x0,s=this.a*(this.k0*(p-this.ml0+a*o*l/2*(1+c/12*(5-f+9*u+4*d+c/30*(61+_-58*f+270*u-330*f*u+c/56*(1385+543*_-_*f-3111*f))))))+this.y0}else{var m=h*Math.sin(o);if(Math.abs(Math.abs(m)-1)<bh)return 93;if(i=.5*this.a*this.k0*Math.log((1+m)/(1-m))+this.x0,s=h*Math.cos(o)/Math.sqrt(1-Math.pow(m,2)),(m=Math.abs(s))>=1){if(m-1>bh)return 93;s=0}else s=Math.acos(s);r<0&&(s=-s),s=this.a*this.k0*(s-this.lat0)+this.y0}return t.x=i,t.y=s,t},inverse:function(t){var e,i,s,n,r=(t.x-this.x0)*(1/this.a),o=(t.y-this.y0)*(1/this.a);if(this.es)if(i=mc(e=this.ml0+o/this.k0,this.es,this.en),Math.abs(i)<Sh){var a=Math.sin(i),h=Math.cos(i),l=Math.abs(h)>bh?Math.tan(i):0,c=this.ep2*Math.pow(h,2),u=Math.pow(c,2),d=Math.pow(l,2),g=Math.pow(d,2);e=1-this.es*Math.pow(a,2);var f=r*Math.sqrt(e)/this.k0,_=Math.pow(f,2);s=i-(e*=l)*_/(1-this.es)*.5*(1-_/12*(5+3*d-9*c*d+c-4*u-_/30*(61+90*d-252*c*d+45*g+46*c-_/56*(1385+3633*d+4095*g+1574*g*d)))),n=ll(this.long0+f*(1-_/6*(1+2*d+c-_/20*(5+28*d+24*g+8*c*d+6*c-_/42*(61+662*d+1320*g+720*g*d))))/h,this.over)}else s=Sh*hl(o),n=0;else{var p=Math.exp(r/this.k0),m=.5*(p-1/p),y=this.lat0+o/this.k0,v=Math.cos(y);e=Math.sqrt((1-Math.pow(v,2))/(1+Math.pow(m,2))),s=Math.asin(e),o<0&&(s=-s),n=0===m&&0===v?0:ll(Math.atan2(m,v)+this.long0,this.over)}return t.x=n,t.y=s,t},names:["Fast_Transverse_Mercator","Fast Transverse Mercator"]};function vc(t){var e=Math.exp(t);return(e-1/e)/2}function Mc(t,e){t=Math.abs(t),e=Math.abs(e);var i=Math.max(t,e),s=Math.min(t,e)/(i||1);return i*Math.sqrt(1+Math.pow(s,2))}function wc(t,e){for(var i,s=2*Math.cos(2*e),n=t.length-1,r=t[n],o=0;--n>=0;)i=s*r-o+t[n],o=r,r=i;return e+i*Math.sin(2*e)}function xc(t,e,i){for(var s,n,r=Math.sin(e),o=Math.cos(e),a=vc(i),h=function(t){var e=Math.exp(t);return(e+1/e)/2}(i),l=2*o*h,c=-2*r*a,u=t.length-1,d=t[u],g=0,f=0,_=0;--u>=0;)s=f,n=g,d=l*(f=d)-s-c*(g=_)+t[u],_=c*f-n+l*g;return[(l=r*h)*d-(c=o*a)*_,l*_+c*d]}const Ec={init:function(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(yc.init.apply(this),this.forward=yc.forward,this.inverse=yc.inverse),this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=this.es/(1+Math.sqrt(1-this.es)),e=t/(2-t),i=e;this.cgb[0]=e*(2+e*(-2/3+e*(e*(116/45+e*(26/45+e*(-2854/675)))-2))),this.cbg[0]=e*(e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))-2),i*=e,this.cgb[1]=i*(7/3+e*(e*(-227/45+e*(2704/315+e*(2323/945)))-1.6)),this.cbg[1]=i*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),i*=e,this.cgb[2]=i*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=i*(-26/15+e*(34/21+e*(1.6+e*(-12686/2835)))),i*=e,this.cgb[3]=i*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=i*(1237/630+e*(e*(-24832/14175)-2.4)),i*=e,this.cgb[4]=i*(4174/315+e*(-144838/6237)),this.cbg[4]=i*(-734/315+e*(109598/31185)),i*=e,this.cgb[5]=i*(601676/22275),this.cbg[5]=i*(444337/155925),i=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+i*(1/4+i*(1/64+i/256))),this.utg[0]=e*(e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))-.5),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=i*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=i*(13/48+e*(e*(557/1440+e*(281/630+e*(-1983433/1935360)))-.6)),i*=e,this.utg[2]=i*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=i*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),i*=e,this.utg[3]=i*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=i*(49561/161280+e*(-179/168+e*(6601661/7257600))),i*=e,this.utg[4]=i*(-4583/161280+e*(108847/3991680)),this.gtu[4]=i*(34729/80640+e*(-3418889/1995840)),i*=e,this.utg[5]=i*(-20648693/638668800),this.gtu[5]=.6650675310896665*i;var s=wc(this.cbg,this.lat0);this.Zb=-this.Qn*(s+function(t,e){for(var i,s=2*Math.cos(e),n=t.length-1,r=t[n],o=0;--n>=0;)i=s*r-o+t[n],o=r,r=i;return Math.sin(e)*i}(this.gtu,2*s))},forward:function(t){var e=ll(t.x-this.long0,this.over),i=t.y;i=wc(this.cbg,i);var s=Math.sin(i),n=Math.cos(i),r=Math.sin(e),o=Math.cos(e);i=Math.atan2(s,o*n),e=Math.atan2(r*n,Mc(s,n*o)),e=function(t){var e=Math.abs(t);return e=function(t){var e=1+t,i=e-1;return 0===i?t:t*Math.log(e)/i}(e*(1+e/(Mc(1,e)+1))),t<0?-e:e}(Math.tan(e));var a,h,l=xc(this.gtu,2*i,2*e);return i+=l[0],e+=l[1],Math.abs(e)<=2.623395162778?(a=this.a*(this.Qn*e)+this.x0,h=this.a*(this.Qn*i+this.Zb)+this.y0):(a=1/0,h=1/0),t.x=a,t.y=h,t},inverse:function(t){var e,i,s=(t.x-this.x0)*(1/this.a),n=(t.y-this.y0)*(1/this.a);if(n=(n-this.Zb)/this.Qn,s/=this.Qn,Math.abs(s)<=2.623395162778){var r=xc(this.utg,2*n,2*s);n+=r[0],s+=r[1],s=Math.atan(vc(s));var o=Math.sin(n),a=Math.cos(n),h=Math.sin(s),l=Math.cos(s);n=Math.atan2(o*l,Mc(h,l*a)),e=ll((s=Math.atan2(h,l*a))+this.long0,this.over),i=wc(this.cgb,n)}else e=1/0,i=1/0;return t.x=e,t.y=i,t},names:["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","Gauss Kruger","Gauss_Kruger","tmerc"]},Sc={init:function(){var t=function(t,e){if(void 0===t){if((t=Math.floor(30*(ll(e)+Math.PI)/Math.PI)+1)<0)return 0;if(t>60)return 60}return t}(this.zone,this.long0);if(void 0===t)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*Ph,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Ec.init.apply(this),this.forward=Ec.forward,this.inverse=Ec.inverse},names:["Universal Transverse Mercator System","utm"],dependsOn:"etmerc"};function bc(t,e){return Math.pow((1-t)/(1+t),e)}const Pc={init:function(){var t=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+Rh)/(Math.pow(Math.tan(.5*this.lat0+Rh),this.C)*bc(this.e*t,this.ratexp))},forward:function(t){var e=t.x,i=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*i+Rh),this.C)*bc(this.e*Math.sin(i),this.ratexp))-Sh,t.x=this.C*e,t},inverse:function(t){for(var e=t.x/this.C,i=t.y,s=Math.pow(Math.tan(.5*i+Rh)/this.K,1/this.C),n=20;n>0&&(i=2*Math.atan(s*bc(this.e*Math.sin(t.y),-.5*this.e))-Sh,!(Math.abs(i-t.y)<1e-14));--n)t.y=i;return n?(t.x=e,t.y=i,t):null},names:["gauss"]},Cc={init:function(){Pc.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))},forward:function(t){var e,i,s,n;return t.x=ll(t.x-this.long0,this.over),Pc.forward.apply(this,[t]),e=Math.sin(t.y),i=Math.cos(t.y),s=Math.cos(t.x),n=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*i*s),t.x=n*i*Math.sin(t.x),t.y=n*(this.cosc0*e-this.sinc0*i*s),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t},inverse:function(t){var e,i,s,n,r;if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,r=Mc(t.x,t.y)){var o=2*Math.atan2(r,this.R2);e=Math.sin(o),i=Math.cos(o),n=Math.asin(i*this.sinc0+t.y*e*this.cosc0/r),s=Math.atan2(t.x*e,r*this.cosc0*i-t.y*this.sinc0*e)}else n=this.phic0,s=0;return t.x=s,t.y=n,Pc.inverse.apply(this,[t]),t.x=ll(t.x+this.long0,this.over),t},names:["Stereographic_North_Pole","Oblique_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"]};function Rc(t,e,i){return e*=i,Math.tan(.5*(Sh+t))*Math.pow((1-e)/(1+e),.5*i)}const Ic={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=bh&&(this.k0=.5*(1+hl(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=bh&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=bh&&Math.abs(Math.cos(this.lat_ts))>bh&&(this.k0=.5*this.cons*al(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/cl(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=al(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(Rc(this.lat0,this.sinlat0,this.e))-Sh,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))},forward:function(t){var e,i,s,n,r,o,a=t.x,h=t.y,l=Math.sin(h),c=Math.cos(h),u=ll(a-this.long0,this.over);return Math.abs(Math.abs(a-this.long0)-Math.PI)<=bh&&Math.abs(h+this.lat0)<=bh?(t.x=NaN,t.y=NaN,t):this.sphere?(e=2*this.k0/(1+this.sinlat0*l+this.coslat0*c*Math.cos(u)),t.x=this.a*e*c*Math.sin(u)+this.x0,t.y=this.a*e*(this.coslat0*l-this.sinlat0*c*Math.cos(u))+this.y0,t):(i=2*Math.atan(Rc(h,l,this.e))-Sh,n=Math.cos(i),s=Math.sin(i),Math.abs(this.coslat0)<=bh?(r=cl(this.e,h*this.con,this.con*l),o=2*this.a*this.k0*r/this.cons,t.x=this.x0+o*Math.sin(a-this.long0),t.y=this.y0-this.con*o*Math.cos(a-this.long0),t):(Math.abs(this.sinlat0)<bh?(e=2*this.a*this.k0/(1+n*Math.cos(u)),t.y=e*s):(e=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*s+this.cosX0*n*Math.cos(u))),t.y=e*(this.cosX0*s-this.sinX0*n*Math.cos(u))+this.y0),t.x=e*n*Math.sin(u)+this.x0,t))},inverse:function(t){var e,i,s,n,r;t.x-=this.x0,t.y-=this.y0;var o=Math.sqrt(t.x*t.x+t.y*t.y);if(this.sphere){var a=2*Math.atan(o/(2*this.a*this.k0));return e=this.long0,i=this.lat0,o<=bh?(t.x=e,t.y=i,t):(i=Math.asin(Math.cos(a)*this.sinlat0+t.y*Math.sin(a)*this.coslat0/o),e=Math.abs(this.coslat0)<bh?this.lat0>0?ll(this.long0+Math.atan2(t.x,-1*t.y),this.over):ll(this.long0+Math.atan2(t.x,t.y),this.over):ll(this.long0+Math.atan2(t.x*Math.sin(a),o*this.coslat0*Math.cos(a)-t.y*this.sinlat0*Math.sin(a)),this.over),t.x=e,t.y=i,t)}if(Math.abs(this.coslat0)<=bh){if(o<=bh)return i=this.lat0,e=this.long0,t.x=e,t.y=i,t;t.x*=this.con,t.y*=this.con,s=o*this.cons/(2*this.a*this.k0),i=this.con*ul(this.e,s),e=this.con*ll(this.con*this.long0+Math.atan2(t.x,-1*t.y),this.over)}else n=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,o<=bh?r=this.X0:(r=Math.asin(Math.cos(n)*this.sinX0+t.y*Math.sin(n)*this.cosX0/o),e=ll(this.long0+Math.atan2(t.x*Math.sin(n),o*this.cosX0*Math.cos(n)-t.y*this.sinX0*Math.sin(n)),this.over)),i=-1*ul(this.e,Math.tan(.5*(Sh+r)));return t.x=e,t.y=i,t},names:["stere","Stereographic_South_Pole","Polar_Stereographic_variant_A","Polar_Stereographic_variant_B","Polar_Stereographic"],ssfn_:Rc},Gc={init:function(){var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),i=this.a,s=1/this.rf,n=2*s-Math.pow(s,2),r=this.e=Math.sqrt(n);this.R=this.k0*i*Math.sqrt(1-n)/(1-n*Math.pow(e,2)),this.alpha=Math.sqrt(1+n/(1-n)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(e/this.alpha);var o=Math.log(Math.tan(Math.PI/4+this.b0/2)),a=Math.log(Math.tan(Math.PI/4+t/2)),h=Math.log((1+r*e)/(1-r*e));this.K=o-this.alpha*a+this.alpha*r/2*h},forward:function(t){var e=Math.log(Math.tan(Math.PI/4-t.y/2)),i=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),s=-this.alpha*(e+i)+this.K,n=2*(Math.atan(Math.exp(s))-Math.PI/4),r=this.alpha*(t.x-this.lambda0),o=Math.atan(Math.sin(r)/(Math.sin(this.b0)*Math.tan(n)+Math.cos(this.b0)*Math.cos(r))),a=Math.asin(Math.cos(this.b0)*Math.sin(n)-Math.sin(this.b0)*Math.cos(n)*Math.cos(r));return t.y=this.R/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)))+this.y0,t.x=this.R*o+this.x0,t},inverse:function(t){for(var e=t.x-this.x0,i=t.y-this.y0,s=e/this.R,n=2*(Math.atan(Math.exp(i/this.R))-Math.PI/4),r=Math.asin(Math.cos(this.b0)*Math.sin(n)+Math.sin(this.b0)*Math.cos(n)*Math.cos(s)),o=Math.atan(Math.sin(s)/(Math.cos(this.b0)*Math.cos(s)-Math.sin(this.b0)*Math.tan(n))),a=this.lambda0+o/this.alpha,h=0,l=r,c=-1e3,u=0;Math.abs(l-c)>1e-7;){if(++u>20)return;h=1/this.alpha*(Math.log(Math.tan(Math.PI/4+r/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(l))/2)),c=l,l=2*Math.atan(Math.exp(h))-Math.PI/2}return t.x=a,t.y=l,t},names:["somerc"]};var Ac=1e-7;const Tc={init:function(){var t,e,i,s,n,r,o,a,h,l,c,u,d,g,f=0,_=0,p=0,m=0,y=0,v=0,M=0;this.no_off=(d=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],g="object"==typeof(u=this).projName?Object.keys(u.projName)[0]:u.projName,"no_uoff"in u||"no_off"in u||-1!==d.indexOf(g)||-1!==d.indexOf(yl(g))),this.no_rot="no_rot"in this;var w=!1;"alpha"in this&&(w=!0);var x=!1;if("rectified_grid_angle"in this&&(x=!0),w&&(M=this.alpha),x&&(f=this.rectified_grid_angle),w||x)_=this.longc;else if(p=this.long1,y=this.lat1,m=this.long2,v=this.lat2,Math.abs(y-v)<=Ac||(t=Math.abs(y))<=Ac||Math.abs(t-Sh)<=Ac||Math.abs(Math.abs(this.lat0)-Sh)<=Ac||Math.abs(Math.abs(v)-Sh)<=Ac)throw new Error;var E=1-this.es;e=Math.sqrt(E),Math.abs(this.lat0)>bh?(a=Math.sin(this.lat0),i=Math.cos(this.lat0),t=1-this.es*a*a,this.B=i*i,this.B=Math.sqrt(1+this.es*this.B*this.B/E),this.A=this.B*this.k0*e/t,(n=(s=this.B*e/(i*Math.sqrt(t)))*s-1)<=0?n=0:(n=Math.sqrt(n),this.lat0<0&&(n=-n)),this.E=n+=s,this.E*=Math.pow(cl(this.e,this.lat0,a),this.B)):(this.B=1/e,this.A=this.k0,this.E=s=n=1),w||x?(w?(c=Math.asin(Math.sin(M)/s),x||(f=M)):(c=f,M=Math.asin(s*Math.sin(c))),this.lam0=_-Math.asin(.5*(n-1/n)*Math.tan(c))/this.B):(r=Math.pow(cl(this.e,y,Math.sin(y)),this.B),o=Math.pow(cl(this.e,v,Math.sin(v)),this.B),n=this.E/r,h=(o-r)/(o+r),l=((l=this.E*this.E)-o*r)/(l+o*r),(t=p-m)<-Math.PI?m-=Ih:t>Math.PI&&(m+=Ih),this.lam0=ll(.5*(p+m)-Math.atan(l*Math.tan(.5*this.B*(p-m))/h)/this.B,this.over),c=Math.atan(2*Math.sin(this.B*ll(p-this.lam0,this.over))/(n-1/n)),f=M=Math.asin(s*Math.sin(c))),this.singam=Math.sin(c),this.cosgam=Math.cos(c),this.sinrot=Math.sin(f),this.cosrot=Math.cos(f),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(s*s-1)/Math.cos(M))),this.lat0<0&&(this.u_0=-this.u_0)),n=.5*c,this.v_pole_n=this.ArB*Math.log(Math.tan(Rh-n)),this.v_pole_s=this.ArB*Math.log(Math.tan(Rh+n))},forward:function(t){var e,i,s,n,r,o,a,h,l={};if(t.x=t.x-this.lam0,Math.abs(Math.abs(t.y)-Sh)>bh){if(e=.5*((r=this.E/Math.pow(cl(this.e,t.y,Math.sin(t.y)),this.B))-(o=1/r)),i=.5*(r+o),n=Math.sin(this.B*t.x),s=(e*this.singam-n*this.cosgam)/i,Math.abs(Math.abs(s)-1)<bh)throw new Error;h=.5*this.ArB*Math.log((1-s)/(1+s)),o=Math.cos(this.B*t.x),a=Math.abs(o)<Ac?this.A*t.x:this.ArB*Math.atan2(e*this.cosgam+n*this.singam,o)}else h=t.y>0?this.v_pole_n:this.v_pole_s,a=this.ArB*t.y;return this.no_rot?(l.x=a,l.y=h):(a-=this.u_0,l.x=h*this.cosrot+a*this.sinrot,l.y=a*this.cosrot-h*this.sinrot),l.x=this.a*l.x+this.x0,l.y=this.a*l.y+this.y0,l},inverse:function(t){var e,i,s,n,r,o,a,h={};if(t.x=(t.x-this.x0)*(1/this.a),t.y=(t.y-this.y0)*(1/this.a),this.no_rot?(i=t.y,e=t.x):(i=t.x*this.cosrot-t.y*this.sinrot,e=t.y*this.cosrot+t.x*this.sinrot+this.u_0),n=.5*((s=Math.exp(-this.BrA*i))-1/s),r=.5*(s+1/s),a=((o=Math.sin(this.BrA*e))*this.cosgam+n*this.singam)/r,Math.abs(Math.abs(a)-1)<bh)h.x=0,h.y=a<0?-Sh:Sh;else{if(h.y=this.E/Math.sqrt((1+a)/(1-a)),h.y=ul(this.e,Math.pow(h.y,1/this.B)),h.y===1/0)throw new Error;h.x=-this.rB*Math.atan2(n*this.cosgam-o*this.singam,Math.cos(this.BrA*e))}return h.x+=this.lam0,h},names:["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Variant_B","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator","omerc"]},Oc={init:function(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<bh)){var t=this.b/this.a;this.e=Math.sqrt(1-t*t);var e=Math.sin(this.lat1),i=Math.cos(this.lat1),s=al(this.e,e,i),n=cl(this.e,this.lat1,e),r=Math.sin(this.lat2),o=Math.cos(this.lat2),a=al(this.e,r,o),h=cl(this.e,this.lat2,r),l=Math.abs(Math.abs(this.lat0)-Sh)<bh?0:cl(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>bh?this.ns=Math.log(s/a)/Math.log(n/h):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=s/(this.ns*Math.pow(n,this.ns)),this.rh=this.a*this.f0*Math.pow(l,this.ns),this.title||(this.title="Lambert Conformal Conic")}},forward:function(t){var e=t.x,i=t.y;Math.abs(2*Math.abs(i)-Math.PI)<=bh&&(i=hl(i)*(Sh-2e-10));var s,n,r=Math.abs(Math.abs(i)-Sh);if(r>bh)s=cl(this.e,i,Math.sin(i)),n=this.a*this.f0*Math.pow(s,this.ns);else{if((r=i*this.ns)<=0)return null;n=0}var o=this.ns*ll(e-this.long0,this.over);return t.x=this.k0*(n*Math.sin(o))+this.x0,t.y=this.k0*(this.rh-n*Math.cos(o))+this.y0,t},inverse:function(t){var e,i,s,n,r,o=(t.x-this.x0)/this.k0,a=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(o*o+a*a),i=1):(e=-Math.sqrt(o*o+a*a),i=-1);var h=0;if(0!==e&&(h=Math.atan2(i*o,i*a)),0!==e||this.ns>0){if(i=1/this.ns,s=Math.pow(e/(this.a*this.f0),i),-9999===(n=ul(this.e,s)))return null}else n=-Sh;return r=ll(h/this.ns+this.long0,this.over),t.x=r,t.y=n,t},names:["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"]},Lc={init:function(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.4334234309119251),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq},forward:function(t){var e,i,s,n,r,o,a,h=t.x,l=t.y,c=ll(h-this.long0,this.over);return e=Math.pow((1+this.e*Math.sin(l))/(1-this.e*Math.sin(l)),this.alfa*this.e/2),i=2*(Math.atan(this.k*Math.pow(Math.tan(l/2+this.s45),this.alfa)/e)-this.s45),s=-c*this.alfa,n=Math.asin(Math.cos(this.ad)*Math.sin(i)+Math.sin(this.ad)*Math.cos(i)*Math.cos(s)),r=Math.asin(Math.cos(i)*Math.sin(s)/Math.cos(n)),o=this.n*r,a=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(n/2+this.s45),this.n),t.y=a*Math.cos(o)/1,t.x=a*Math.sin(o)/1,this.czech||(t.y*=-1,t.x*=-1),t},inverse:function(t){var e,i,s,n,r,o,a,h=t.x;t.x=t.y,t.y=h,this.czech||(t.y*=-1,t.x*=-1),r=Math.sqrt(t.x*t.x+t.y*t.y),n=Math.atan2(t.y,t.x)/Math.sin(this.s0),s=2*(Math.atan(Math.pow(this.ro0/r,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(s)-Math.sin(this.ad)*Math.cos(s)*Math.cos(n)),i=Math.asin(Math.cos(s)*Math.sin(n)/Math.cos(e)),t.x=this.long0-i/this.alfa,o=e,a=0;var l=0;do{t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(o))/(1-this.e*Math.sin(o)),this.e/2))-this.s45),Math.abs(o-t.y)<1e-10&&(a=1),o=t.y,l+=1}while(0===a&&l<15);return l>=15?null:t},names:["Krovak","Krovak Modified","Krovak (North Orientated)","Krovak Modified (North Orientated)","krovak"]};function Nc(t,e,i,s,n){return t*n-e*Math.sin(2*n)+i*Math.sin(4*n)-s*Math.sin(6*n)}function kc(t){return 1-.25*t*(1+t/16*(3+1.25*t))}function Fc(t){return.375*t*(1+.25*t*(1+.46875*t))}function zc(t){return.05859375*t*t*(1+.75*t)}function Dc(t){return t*t*t*(35/3072)}function jc(t,e,i){var s=e*i;return t/Math.sqrt(1-s*s)}function qc(t){return Math.abs(t)<Sh?t:t-hl(t)*Math.PI}function Uc(t,e,i,s,n){var r,o;r=t/e;for(var a=0;a<15;a++)if(r+=o=(t-(e*r-i*Math.sin(2*r)+s*Math.sin(4*r)-n*Math.sin(6*r)))/(e-2*i*Math.cos(2*r)+4*s*Math.cos(4*r)-6*n*Math.cos(6*r)),Math.abs(o)<=1e-10)return r;return NaN}const Bc={init:function(){this.sphere||(this.e0=kc(this.es),this.e1=Fc(this.es),this.e2=zc(this.es),this.e3=Dc(this.es),this.ml0=this.a*Nc(this.e0,this.e1,this.e2,this.e3,this.lat0))},forward:function(t){var e,i,s=t.x,n=t.y;if(s=ll(s-this.long0,this.over),this.sphere)e=this.a*Math.asin(Math.cos(n)*Math.sin(s)),i=this.a*(Math.atan2(Math.tan(n),Math.cos(s))-this.lat0);else{var r=Math.sin(n),o=Math.cos(n),a=jc(this.a,this.e,r),h=Math.tan(n)*Math.tan(n),l=s*Math.cos(n),c=l*l,u=this.es*o*o/(1-this.es);e=a*l*(1-c*h*(1/6-(8-h+8*u)*c/120)),i=this.a*Nc(this.e0,this.e1,this.e2,this.e3,n)-this.ml0+a*r/o*c*(.5+(5-h+6*u)*c/24)}return t.x=e+this.x0,t.y=i+this.y0,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e,i,s=t.x/this.a,n=t.y/this.a;if(this.sphere){var r=n+this.lat0;e=Math.asin(Math.sin(r)*Math.cos(s)),i=Math.atan2(Math.tan(s),Math.cos(r))}else{var o=Uc(this.ml0/this.a+n,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(o)-Sh)<=bh)return t.x=this.long0,t.y=Sh,n<0&&(t.y*=-1),t;var a=jc(this.a,this.e,Math.sin(o)),h=a*a*a/this.a/this.a*(1-this.es),l=Math.pow(Math.tan(o),2),c=s*this.a/a,u=c*c;e=o-a*Math.tan(o)/h*c*c*(.5-(1+3*l)*c*c/24),i=c*(1-u*(l/3+(1+3*l)*l*u/15))/Math.cos(o)}return t.x=ll(i+this.long0,this.over),t.y=qc(e),t},names:["Cassini","Cassini_Soldner","cass"]};function Kc(t,e){var i;return t>1e-7?(1-t*t)*(e/(1-(i=t*e)*i)-.5/t*Math.log((1-i)/(1+i))):2*e}const Xc={init:function(){var t,e=Math.abs(this.lat0);if(Math.abs(e-Sh)<bh?this.mode=this.lat0<0?1:2:Math.abs(e)<bh?this.mode=3:this.mode=4,this.es>0)switch(this.qp=Kc(this.e,1),this.mmf=.5/(1-this.es),this.apa=function(t){var e,i=[];return i[0]=.3333333333333333*t,e=t*t,i[0]+=.17222222222222222*e,i[1]=.06388888888888888*e,e*=t,i[0]+=.10257936507936508*e,i[1]+=.0664021164021164*e,i[2]=.016415012942191543*e,i}(this.es),this.mode){case 2:case 1:this.dd=1;break;case 3:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case 4:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=Kc(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}else 4===this.mode&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))},forward:function(t){var e,i,s,n,r,o,a,h,l,c,u=t.x,d=t.y;if(u=ll(u-this.long0,this.over),this.sphere){if(r=Math.sin(d),c=Math.cos(d),s=Math.cos(u),this.mode===this.OBLIQ||this.mode===this.EQUIT){if((i=this.mode===this.EQUIT?1+c*s:1+this.sinph0*r+this.cosph0*c*s)<=bh)return null;e=(i=Math.sqrt(2/i))*c*Math.sin(u),i*=this.mode===this.EQUIT?r:this.cosph0*r-this.sinph0*c*s}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(s=-s),Math.abs(d+this.lat0)<bh)return null;i=Rh-.5*d,e=(i=2*(this.mode===this.S_POLE?Math.cos(i):Math.sin(i)))*Math.sin(u),i*=s}}else{switch(a=0,h=0,l=0,s=Math.cos(u),n=Math.sin(u),r=Math.sin(d),o=Kc(this.e,r),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(a=o/this.qp,h=Math.sqrt(1-a*a)),this.mode){case this.OBLIQ:l=1+this.sinb1*a+this.cosb1*h*s;break;case this.EQUIT:l=1+h*s;break;case this.N_POLE:l=Sh+d,o=this.qp-o;break;case this.S_POLE:l=d-Sh,o=this.qp+o}if(Math.abs(l)<bh)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:l=Math.sqrt(2/l),i=this.mode===this.OBLIQ?this.ymf*l*(this.cosb1*a-this.sinb1*h*s):(l=Math.sqrt(2/(1+h*s)))*a*this.ymf,e=this.xmf*l*h*n;break;case this.N_POLE:case this.S_POLE:o>=0?(e=(l=Math.sqrt(o))*n,i=s*(this.mode===this.S_POLE?l:-l)):e=i=0}}return t.x=this.a*e+this.x0,t.y=this.a*i+this.y0,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e,i,s,n,r,o,a,h,l,c,u=t.x/this.a,d=t.y/this.a;if(this.sphere){var g,f=0,_=0;if((i=.5*(g=Math.sqrt(u*u+d*d)))>1)return null;switch(i=2*Math.asin(i),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(_=Math.sin(i),f=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(g)<=bh?0:Math.asin(d*_/g),u*=_,d=f*g;break;case this.OBLIQ:i=Math.abs(g)<=bh?this.lat0:Math.asin(f*this.sinph0+d*_*this.cosph0/g),u*=_*this.cosph0,d=(f-Math.sin(i)*this.sinph0)*g;break;case this.N_POLE:d=-d,i=Sh-i;break;case this.S_POLE:i-=Sh}e=0!==d||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(u,d):0}else{if(a=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(u/=this.dd,d*=this.dd,(o=Math.sqrt(u*u+d*d))<bh)return t.x=this.long0,t.y=this.lat0,t;n=2*Math.asin(.5*o/this.rq),s=Math.cos(n),u*=n=Math.sin(n),this.mode===this.OBLIQ?(a=s*this.sinb1+d*n*this.cosb1/o,r=this.qp*a,d=o*this.cosb1*s-d*this.sinb1*n):(a=d*n/o,r=this.qp*a,d=o*s)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(d=-d),!(r=u*u+d*d))return t.x=this.long0,t.y=this.lat0,t;a=1-r/this.qp,this.mode===this.S_POLE&&(a=-a)}e=Math.atan2(u,d),c=(h=Math.asin(a))+h,i=h+(l=this.apa)[0]*Math.sin(c)+l[1]*Math.sin(c+c)+l[2]*Math.sin(c+c+c)}return t.x=ll(this.long0+e,this.over),t.y=i,t},names:["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],S_POLE:1,N_POLE:2,EQUIT:3,OBLIQ:4};function Wc(t){return Math.abs(t)>1&&(t=t>1?1:-1),Math.asin(t)}const Zc={init:function(){Math.abs(this.lat1+this.lat2)<bh||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=al(this.e3,this.sin_po,this.cos_po),this.qs1=Kc(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=al(this.e3,this.sin_po,this.cos_po),this.qs2=Kc(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=Kc(this.e3,this.sin_po),Math.abs(this.lat1-this.lat2)>bh?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)},forward:function(t){var e=t.x,i=t.y;this.sin_phi=Math.sin(i),this.cos_phi=Math.cos(i);var s=Kc(this.e3,this.sin_phi),n=this.a*Math.sqrt(this.c-this.ns0*s)/this.ns0,r=this.ns0*ll(e-this.long0,this.over),o=n*Math.sin(r)+this.x0,a=this.rh-n*Math.cos(r)+this.y0;return t.x=o,t.y=a,t},inverse:function(t){var e,i,s,n,r,o;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(e=Math.sqrt(t.x*t.x+t.y*t.y),s=1):(e=-Math.sqrt(t.x*t.x+t.y*t.y),s=-1),n=0,0!==e&&(n=Math.atan2(s*t.x,s*t.y)),s=e*this.ns0/this.a,this.sphere?o=Math.asin((this.c-s*s)/(2*this.ns0)):(i=(this.c-s*s)/this.ns0,o=this.phi1z(this.e3,i)),r=ll(n/this.ns0+this.long0,this.over),t.x=r,t.y=o,t},names:["Albers_Conic_Equal_Area","Albers_Equal_Area","Albers","aea"],phi1z:function(t,e){var i,s,n,r,o=Wc(.5*e);if(t<bh)return o;for(var a=t*t,h=1;h<=25;h++)if(o+=r=.5*(n=1-(s=t*(i=Math.sin(o)))*s)*n/Math.cos(o)*(e/(1-a)-i/n+.5/t*Math.log((1-s)/(1+s))),Math.abs(r)<=1e-7)return o;return null}},Vc={init:function(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1},forward:function(t){var e,i,s,n,r,o,a,h=t.x,l=t.y;return s=ll(h-this.long0,this.over),e=Math.sin(l),i=Math.cos(l),n=Math.cos(s),(r=this.sin_p14*e+this.cos_p14*i*n)>0||Math.abs(r)<=bh?(o=this.x0+1*this.a*i*Math.sin(s)/r,a=this.y0+1*this.a*(this.cos_p14*e-this.sin_p14*i*n)/r):(o=this.x0+this.infinity_dist*i*Math.sin(s),a=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*i*n)),t.x=o,t.y=a,t},inverse:function(t){var e,i,s,n,r,o;return t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,(e=Math.sqrt(t.x*t.x+t.y*t.y))?(n=Math.atan2(e,this.rc),i=Math.sin(n),o=Wc((s=Math.cos(n))*this.sin_p14+t.y*i*this.cos_p14/e),r=Math.atan2(t.x*i,e*this.cos_p14*s-t.y*this.sin_p14*i),r=ll(this.long0+r,this.over)):(o=this.phic0,r=0),t.x=r,t.y=o,t},names:["gnom"]},Yc={init:function(){this.sphere||(this.k0=al(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))},forward:function(t){var e,i,s=t.x,n=t.y,r=ll(s-this.long0,this.over);if(this.sphere)e=this.x0+this.a*r*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(n)/Math.cos(this.lat_ts);else{var o=Kc(this.e,Math.sin(n));e=this.x0+this.a*this.k0*r,i=this.y0+this.a*o*.5/this.k0}return t.x=e,t.y=i,t},inverse:function(t){var e,i;return t.x-=this.x0,t.y-=this.y0,this.sphere?(e=ll(this.long0+t.x/this.a/Math.cos(this.lat_ts),this.over),i=Math.asin(t.y/this.a*Math.cos(this.lat_ts))):(i=function(t,e){var i=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(e)-i)<1e-6)return e<0?-1*Sh:Sh;for(var s,n,r,o,a=Math.asin(.5*e),h=0;h<30;h++)if(n=Math.sin(a),r=Math.cos(a),o=t*n,a+=s=Math.pow(1-o*o,2)/(2*r)*(e/(1-t*t)-n/(1-o*o)+.5/t*Math.log((1-o)/(1+o))),Math.abs(s)<=1e-10)return a;return NaN}(this.e,2*t.y*this.k0/this.a),e=ll(this.long0+t.x/(this.a*this.k0),this.over)),t.x=e,t.y=i,t},names:["cea"]},Hc={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)},forward:function(t){var e=t.x,i=t.y,s=ll(e-this.long0,this.over),n=qc(i-this.lat0);return t.x=this.x0+this.a*s*this.rc,t.y=this.y0+this.a*n,t},inverse:function(t){var e=t.x,i=t.y;return t.x=ll(this.long0+(e-this.x0)/(this.a*this.rc),this.over),t.y=qc(this.lat0+(i-this.y0)/this.a),t},names:["Equirectangular","Equidistant_Cylindrical","Equidistant_Cylindrical_Spherical","eqc"]},$c={init:function(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=kc(this.es),this.e1=Fc(this.es),this.e2=zc(this.es),this.e3=Dc(this.es),this.ml0=this.a*Nc(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(t){var e,i,s,n=t.x,r=t.y,o=ll(n-this.long0,this.over);if(s=o*Math.sin(r),this.sphere)Math.abs(r)<=bh?(e=this.a*o,i=-1*this.a*this.lat0):(e=this.a*Math.sin(s)/Math.tan(r),i=this.a*(qc(r-this.lat0)+(1-Math.cos(s))/Math.tan(r)));else if(Math.abs(r)<=bh)e=this.a*o,i=-1*this.ml0;else{var a=jc(this.a,this.e,Math.sin(r))/Math.tan(r);e=a*Math.sin(s),i=this.a*Nc(this.e0,this.e1,this.e2,this.e3,r)-this.ml0+a*(1-Math.cos(s))}return t.x=e+this.x0,t.y=i+this.y0,t},inverse:function(t){var e,i,s,n,r,o,a,h,l;if(s=t.x-this.x0,n=t.y-this.y0,this.sphere)if(Math.abs(n+this.a*this.lat0)<=bh)e=ll(s/this.a+this.long0,this.over),i=0;else{var c;for(o=this.lat0+n/this.a,a=s*s/this.a/this.a+o*o,h=o,r=20;r;--r)if(h+=l=-1*(o*(h*(c=Math.tan(h))+1)-h-.5*(h*h+a)*c)/((h-o)/c-1),Math.abs(l)<=bh){i=h;break}e=ll(this.long0+Math.asin(s*Math.tan(h)/this.a)/Math.sin(i),this.over)}else if(Math.abs(n+this.ml0)<=bh)i=0,e=ll(this.long0+s/this.a,this.over);else{var u,d,g,f,_;for(o=(this.ml0+n)/this.a,a=s*s/this.a/this.a+o*o,h=o,r=20;r;--r)if(_=this.e*Math.sin(h),u=Math.sqrt(1-_*_)*Math.tan(h),d=this.a*Nc(this.e0,this.e1,this.e2,this.e3,h),g=this.e0-2*this.e1*Math.cos(2*h)+4*this.e2*Math.cos(4*h)-6*this.e3*Math.cos(6*h),h-=l=(o*(u*(f=d/this.a)+1)-f-.5*u*(f*f+a))/(this.es*Math.sin(2*h)*(f*f+a-2*o*f)/(4*u)+(o-f)*(u*g-2/Math.sin(2*h))-g),Math.abs(l)<=bh){i=h;break}u=Math.sqrt(1-this.es*Math.pow(Math.sin(i),2))*Math.tan(i),e=ll(this.long0+Math.asin(s*u/this.a)/Math.sin(i),this.over)}return t.x=e,t.y=i,t},names:["Polyconic","American_Polyconic","poly"]},Qc={init:function(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013},forward:function(t){var e,i=t.x,s=t.y-this.lat0,n=i-this.long0,r=s/Eh*1e-5,o=n,a=1,h=0;for(e=1;e<=10;e++)a*=r,h+=this.A[e]*a;var l,c=h,u=o,d=1,g=0,f=0,_=0;for(e=1;e<=6;e++)l=g*c+d*u,d=d*c-g*u,g=l,f=f+this.B_re[e]*d-this.B_im[e]*g,_=_+this.B_im[e]*d+this.B_re[e]*g;return t.x=_*this.a+this.x0,t.y=f*this.a+this.y0,t},inverse:function(t){var e,i,s=t.x,n=t.y,r=s-this.x0,o=(n-this.y0)/this.a,a=r/this.a,h=1,l=0,c=0,u=0;for(e=1;e<=6;e++)i=l*o+h*a,h=h*o-l*a,l=i,c=c+this.C_re[e]*h-this.C_im[e]*l,u=u+this.C_im[e]*h+this.C_re[e]*l;for(var d=0;d<this.iterations;d++){var g,f=c,_=u,p=o,m=a;for(e=2;e<=6;e++)g=_*c+f*u,f=f*c-_*u,_=g,p+=(e-1)*(this.B_re[e]*f-this.B_im[e]*_),m+=(e-1)*(this.B_im[e]*f+this.B_re[e]*_);f=1,_=0;var y=this.B_re[1],v=this.B_im[1];for(e=2;e<=6;e++)g=_*c+f*u,f=f*c-_*u,_=g,y+=e*(this.B_re[e]*f-this.B_im[e]*_),v+=e*(this.B_im[e]*f+this.B_re[e]*_);var M=y*y+v*v;c=(p*y+m*v)/M,u=(m*y-p*v)/M}var w=c,x=u,E=1,S=0;for(e=1;e<=9;e++)E*=w,S+=this.D[e]*E;var b=this.lat0+S*Eh*1e5,P=this.long0+x;return t.x=P,t.y=b,t},names:["New_Zealand_Map_Grid","nzmg"]},Jc={init:function(){},forward:function(t){var e=t.x,i=t.y,s=ll(e-this.long0,this.over),n=this.x0+this.a*s,r=this.y0+this.a*Math.log(Math.tan(Math.PI/4+i/2.5))*1.25;return t.x=n,t.y=r,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e=ll(this.long0+t.x/this.a,this.over),i=2.5*(Math.atan(Math.exp(.8*t.y/this.a))-Math.PI/4);return t.x=e,t.y=i,t},names:["Miller_Cylindrical","mill"]},tu={init:function(){this.long0=this.long0||0,this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=_c(this.es)},forward:function(t){var e,i,s=t.x,n=t.y;if(s=ll(s-this.long0,this.over),this.sphere){if(this.m)for(var r=this.n*Math.sin(n),o=20;o;--o){var a=(this.m*n+Math.sin(n)-r)/(this.m+Math.cos(n));if(n-=a,Math.abs(a)<bh)break}else n=1!==this.n?Math.asin(this.n*Math.sin(n)):n;e=this.a*this.C_x*s*(this.m+Math.cos(n)),i=this.a*this.C_y*n}else{var h=Math.sin(n),l=Math.cos(n);i=this.a*pc(n,h,l,this.en),e=this.a*s*l/Math.sqrt(1-this.es*h*h)}return t.x=e,t.y=i,t},inverse:function(t){var e,i,s;return t.x-=this.x0,i=t.x/this.a,t.y-=this.y0,e=t.y/this.a,this.sphere?(e/=this.C_y,i/=this.C_x*(this.m+Math.cos(e)),this.m?e=Wc((this.m*e+Math.sin(e))/this.n):1!==this.n&&(e=Wc(Math.sin(e)/this.n)),i=ll(i+this.long0,this.over),e=qc(e)):(e=mc(t.y/this.a,this.es,this.en),(s=Math.abs(e))<Sh?(s=Math.sin(e),i=ll(this.long0+t.x*Math.sqrt(1-this.es*s*s)/(this.a*Math.cos(e)),this.over)):s-bh<Sh&&(i=this.long0)),t.x=i,t.y=e,t},names:["Sinusoidal","sinu"]},eu={init:function(){this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0},forward:function(t){for(var e=t.x,i=t.y,s=ll(e-this.long0,this.over),n=i,r=Math.PI*Math.sin(i);;){var o=-(n+Math.sin(n)-r)/(1+Math.cos(n));if(n+=o,Math.abs(o)<bh)break}n/=2,Math.PI/2-Math.abs(i)<bh&&(s=0);var a=.900316316158*this.a*s*Math.cos(n)+this.x0,h=1.4142135623731*this.a*Math.sin(n)+this.y0;return t.x=a,t.y=h,t},inverse:function(t){var e,i;t.x-=this.x0,t.y-=this.y0,i=t.y/(1.4142135623731*this.a),Math.abs(i)>.999999999999&&(i=.999999999999),e=Math.asin(i);var s=ll(this.long0+t.x/(.900316316158*this.a*Math.cos(e)),this.over);s<-Math.PI&&(s=-Math.PI),s>Math.PI&&(s=Math.PI),i=(2*e+Math.sin(2*e))/Math.PI,Math.abs(i)>1&&(i=1);var n=Math.asin(i);return t.x=s,t.y=n,t},names:["Mollweide","moll"]},iu={init:function(){Math.abs(this.lat1+this.lat2)<bh||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=kc(this.es),this.e1=Fc(this.es),this.e2=zc(this.es),this.e3=Dc(this.es),this.sin_phi=Math.sin(this.lat1),this.cos_phi=Math.cos(this.lat1),this.ms1=al(this.e,this.sin_phi,this.cos_phi),this.ml1=Nc(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<bh?this.ns=this.sin_phi:(this.sin_phi=Math.sin(this.lat2),this.cos_phi=Math.cos(this.lat2),this.ms2=al(this.e,this.sin_phi,this.cos_phi),this.ml2=Nc(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=Nc(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))},forward:function(t){var e,i=t.x,s=t.y;if(this.sphere)e=this.a*(this.g-s);else{var n=Nc(this.e0,this.e1,this.e2,this.e3,s);e=this.a*(this.g-n)}var r=this.ns*ll(i-this.long0,this.over),o=this.x0+e*Math.sin(r),a=this.y0+this.rh-e*Math.cos(r);return t.x=o,t.y=a,t},inverse:function(t){var e,i,s,n;t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns>=0?(i=Math.sqrt(t.x*t.x+t.y*t.y),e=1):(i=-Math.sqrt(t.x*t.x+t.y*t.y),e=-1);var r=0;return 0!==i&&(r=Math.atan2(e*t.x,e*t.y)),this.sphere?(n=ll(this.long0+r/this.ns,this.over),s=qc(this.g-i/this.a),t.x=n,t.y=s,t):(s=Uc(this.g-i/this.a,this.e0,this.e1,this.e2,this.e3),n=ll(this.long0+r/this.ns,this.over),t.x=n,t.y=s,t)},names:["Equidistant_Conic","eqdc"]},su={init:function(){this.R=this.a},forward:function(t){var e,i,s=t.x,n=t.y,r=ll(s-this.long0,this.over);Math.abs(n)<=bh&&(e=this.x0+this.R*r,i=this.y0);var o=Wc(2*Math.abs(n/Math.PI));(Math.abs(r)<=bh||Math.abs(Math.abs(n)-Sh)<=bh)&&(e=this.x0,i=n>=0?this.y0+Math.PI*this.R*Math.tan(.5*o):this.y0+Math.PI*this.R*-Math.tan(.5*o));var a=.5*Math.abs(Math.PI/r-r/Math.PI),h=a*a,l=Math.sin(o),c=Math.cos(o),u=c/(l+c-1),d=u*u,g=u*(2/l-1),f=g*g,_=Math.PI*this.R*(a*(u-f)+Math.sqrt(h*(u-f)*(u-f)-(f+h)*(d-f)))/(f+h);r<0&&(_=-_),e=this.x0+_;var p=h+u;return _=Math.PI*this.R*(g*p-a*Math.sqrt((f+h)*(h+1)-p*p))/(f+h),i=n>=0?this.y0+_:this.y0-_,t.x=e,t.y=i,t},inverse:function(t){var e,i,s,n,r,o,a,h,l,c,u,d;return t.x-=this.x0,t.y-=this.y0,u=Math.PI*this.R,r=(s=t.x/u)*s+(n=t.y/u)*n,u=3*(n*n/(h=-2*(o=-Math.abs(n)*(1+r))+1+2*n*n+r*r)+(2*(a=o-2*n*n+s*s)*a*a/h/h/h-9*o*a/h/h)/27)/(l=(o-a*a/3/h)/h)/(c=2*Math.sqrt(-l/3)),Math.abs(u)>1&&(u=u>=0?1:-1),d=Math.acos(u)/3,i=t.y>=0?(-c*Math.cos(d+Math.PI/3)-a/3/h)*Math.PI:-(-c*Math.cos(d+Math.PI/3)-a/3/h)*Math.PI,e=Math.abs(s)<bh?this.long0:ll(this.long0+Math.PI*(r-1+Math.sqrt(1+2*(s*s-n*n)+r*r))/2/s,this.over),t.x=e,t.y=i,t},names:["Van_der_Grinten_I","VanDerGrinten","Van_der_Grinten","vandg"]},nu={init:function(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0),this.f=this.es/(1+Math.sqrt(1-this.es))},forward:function(t){var e,i,s,n,r,o,a,h,l,c,u,d=t.x,g=t.y,f=Math.sin(t.y),_=Math.cos(t.y),p=ll(d-this.long0,this.over);return this.sphere?Math.abs(this.sin_p12-1)<=bh?(t.x=this.x0+this.a*(Sh-g)*Math.sin(p),t.y=this.y0-this.a*(Sh-g)*Math.cos(p),t):Math.abs(this.sin_p12+1)<=bh?(t.x=this.x0+this.a*(Sh+g)*Math.sin(p),t.y=this.y0+this.a*(Sh+g)*Math.cos(p),t):(l=this.sin_p12*f+this.cos_p12*_*Math.cos(p),h=(a=Math.acos(l))?a/Math.sin(a):1,t.x=this.x0+this.a*h*_*Math.sin(p),t.y=this.y0+this.a*h*(this.cos_p12*f-this.sin_p12*_*Math.cos(p)),t):(e=kc(this.es),i=Fc(this.es),s=zc(this.es),n=Dc(this.es),Math.abs(this.sin_p12-1)<=bh?(r=this.a*Nc(e,i,s,n,Sh),o=this.a*Nc(e,i,s,n,g),t.x=this.x0+(r-o)*Math.sin(p),t.y=this.y0-(r-o)*Math.cos(p),t):Math.abs(this.sin_p12+1)<=bh?(r=this.a*Nc(e,i,s,n,Sh),o=this.a*Nc(e,i,s,n,g),t.x=this.x0+(r+o)*Math.sin(p),t.y=this.y0+(r+o)*Math.cos(p),t):Math.abs(d)<bh&&Math.abs(g-this.lat0)<bh?(t.x=t.y=0,t):(c=function(t,e,i,s,n,r){const o=s-e,a=Math.atan((1-r)*Math.tan(t)),h=Math.atan((1-r)*Math.tan(i)),l=Math.sin(a),c=Math.cos(a),u=Math.sin(h),d=Math.cos(h);let g,f,_,p,m,y,v,M,w,x,E,S,b,P,C,R=o,I=100;do{if(f=Math.sin(R),_=Math.cos(R),p=Math.sqrt(d*f*(d*f)+(c*u-l*d*_)*(c*u-l*d*_)),0===p)return{azi1:0,s12:0};m=l*u+c*d*_,y=Math.atan2(p,m),v=c*d*f/p,M=1-v*v,w=0!==M?m-2*l*u/M:0,x=r/16*M*(4+r*(4-3*M)),g=R,R=o+(1-x)*r*v*(y+x*p*(w+x*m*(2*w*w-1)))}while(Math.abs(R-g)>1e-12&&--I>0);return 0===I?{azi1:NaN,s12:NaN}:(E=M*(n*n-n*(1-r)*(n*(1-r)))/(n*(1-r)*(n*(1-r))),S=1+E/16384*(4096+E*(E*(320-175*E)-768)),b=E/1024*(256+E*(E*(74-47*E)-128)),P=b*p*(w+b/4*(m*(2*w*w-1)-b/6*w*(4*p*p-3)*(4*w*w-3))),C=n*(1-r)*S*(y-P),{azi1:Math.atan2(d*f,c*u-l*d*_),s12:C})}(this.lat0,this.long0,g,d,this.a,this.f),u=c.azi1,t.x=c.s12*Math.sin(u),t.y=c.s12*Math.cos(u),t))},inverse:function(t){var e,i,s,n,r,o,a,h,l,c,u,d,g,f,_;if(t.x-=this.x0,t.y-=this.y0,this.sphere){if((e=Math.sqrt(t.x*t.x+t.y*t.y))>2*Sh*this.a)return;return i=e/this.a,s=Math.sin(i),n=Math.cos(i),r=this.long0,Math.abs(e)<=bh?o=this.lat0:(o=Wc(n*this.sin_p12+t.y*s*this.cos_p12/e),a=Math.abs(this.lat0)-Sh,r=Math.abs(a)<=bh?this.lat0>=0?ll(this.long0+Math.atan2(t.x,-t.y),this.over):ll(this.long0-Math.atan2(-t.x,t.y),this.over):ll(this.long0+Math.atan2(t.x*s,e*this.cos_p12*n-t.y*this.sin_p12*s),this.over)),t.x=r,t.y=o,t}return h=kc(this.es),l=Fc(this.es),c=zc(this.es),u=Dc(this.es),Math.abs(this.sin_p12-1)<=bh?(o=Uc(((d=this.a*Nc(h,l,c,u,Sh))-(e=Math.sqrt(t.x*t.x+t.y*t.y)))/this.a,h,l,c,u),r=ll(this.long0+Math.atan2(t.x,-1*t.y),this.over),t.x=r,t.y=o,t):Math.abs(this.sin_p12+1)<=bh?(d=this.a*Nc(h,l,c,u,Sh),o=Uc(((e=Math.sqrt(t.x*t.x+t.y*t.y))-d)/this.a,h,l,c,u),r=ll(this.long0+Math.atan2(t.x,t.y),this.over),t.x=r,t.y=o,t):(g=Math.atan2(t.x,t.y),f=Math.sqrt(t.x*t.x+t.y*t.y),_=function(t,e,i,s,n,r){const o=Math.atan((1-r)*Math.tan(t)),a=Math.sin(o),h=Math.cos(o),l=Math.sin(i),c=Math.cos(i),u=Math.atan2(a,h*c),d=h*l,g=1-d*d,f=g*(n*n-n*(1-r)*(n*(1-r)))/(n*(1-r)*(n*(1-r))),_=1+f/16384*(4096+f*(f*(320-175*f)-768)),p=f/1024*(256+f*(f*(74-47*f)-128));let m,y,v,M,w,x=s/(n*(1-r)*_),E=100;do{y=Math.cos(2*u+x),v=Math.sin(x),M=Math.cos(x),w=p*v*(y+p/4*(M*(2*y*y-1)-p/6*y*(4*v*v-3)*(4*y*y-3))),m=x,x=s/(n*(1-r)*_)+w}while(Math.abs(x-m)>1e-12&&--E>0);if(0===E)return{lat2:NaN,lon2:NaN};const S=a*v-h*M*c,b=r/16*g*(4+r*(4-3*g));return{lat2:Math.atan2(a*M+h*v*c,(1-r)*Math.sqrt(d*d+S*S)),lon2:e+(Math.atan2(v*l,h*M-a*v*c)-(1-b)*r*d*(x+b*v*(y+b*M*(2*y*y-1))))}}(this.lat0,this.long0,g,f,this.a,this.f),t.x=_.lon2,t.y=_.lat2,t)},names:["Azimuthal_Equidistant","aeqd"]},ru={init:function(){this.sin_p14=Math.sin(this.lat0||0),this.cos_p14=Math.cos(this.lat0||0)},forward:function(t){var e,i,s,n,r,o,a,h=t.x,l=t.y;return s=ll(h-(this.long0||0),this.over),e=Math.sin(l),i=Math.cos(l),n=Math.cos(s),((r=this.sin_p14*e+this.cos_p14*i*n)>0||Math.abs(r)<=bh)&&(o=1*this.a*i*Math.sin(s),a=(this.y0||0)+1*this.a*(this.cos_p14*e-this.sin_p14*i*n)),t.x=o,t.y=a,t},inverse:function(t){var e,i,s,n,r,o,a,h,l;return t.x-=this.x0||0,t.y-=this.y0||0,i=Wc((e=Math.sqrt(t.x*t.x+t.y*t.y))/this.a),s=Math.sin(i),n=Math.cos(i),h=this.long0||0,l=this.lat0||0,o=h,Math.abs(e)<=bh?(a=l,t.x=o,t.y=a,t):(a=Wc(n*this.sin_p14+t.y*s*this.cos_p14/e),r=Math.abs(l)-Sh,Math.abs(r)<=bh?(o=ll(l>=0?h+Math.atan2(t.x,-t.y):h-Math.atan2(-t.x,t.y),this.over),t.x=o,t.y=a,t):(o=ll(h+Math.atan2(t.x*s,e*this.cos_p14*n-t.y*this.sin_p14*s),this.over),t.x=o,t.y=a,t))},names:["ortho"]};function ou(t,e,i,s){var n;return t<bh?(s.value=1,n=0):(n=Math.atan2(e,i),Math.abs(n)<=Rh?s.value=1:n>Rh&&n<=Sh+Rh?(s.value=2,n-=Sh):n>Sh+Rh||n<=-(Sh+Rh)?(s.value=3,n=n>=0?n-Gh:n+Gh):(s.value=4,n+=Sh)),n}function au(t,e){var i=t+e;return i<-Gh?i+=Ih:i>+Gh&&(i-=Ih),i}const hu={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=Sh-Rh/2?this.face=5:this.lat0<=-(Sh-Rh/2)?this.face=6:Math.abs(this.long0)<=Rh?this.face=1:Math.abs(this.long0)<=Sh+Rh?this.face=this.long0>0?2:4:this.face=3,0!==this.es&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)},forward:function(t){var e,i,s,n,r,o,a={x:0,y:0},h={value:0};if(t.x-=this.long0,e=0!==this.es?Math.atan(this.one_minus_f_squared*Math.tan(t.y)):t.y,i=t.x,5===this.face)n=Sh-e,i>=Rh&&i<=Sh+Rh?(h.value=1,s=i-Sh):i>Sh+Rh||i<=-(Sh+Rh)?(h.value=2,s=i>0?i-Gh:i+Gh):i>-(Sh+Rh)&&i<=-Rh?(h.value=3,s=i+Sh):(h.value=4,s=i);else if(6===this.face)n=Sh+e,i>=Rh&&i<=Sh+Rh?(h.value=1,s=-i+Sh):i<Rh&&i>=-Rh?(h.value=2,s=-i):i<-Rh&&i>=-(Sh+Rh)?(h.value=3,s=-i-Sh):(h.value=4,s=i>0?-i+Gh:-i-Gh);else{var l,c,u,d,g,f;2===this.face?i=au(i,+Sh):3===this.face?i=au(i,+Gh):4===this.face&&(i=au(i,-Sh)),d=Math.sin(e),g=Math.cos(e),f=Math.sin(i),l=g*Math.cos(i),c=g*f,u=d,1===this.face?s=ou(n=Math.acos(l),u,c,h):2===this.face?s=ou(n=Math.acos(c),u,-l,h):3===this.face?s=ou(n=Math.acos(-l),u,-c,h):4===this.face?s=ou(n=Math.acos(-c),u,l,h):(n=s=0,h.value=1)}return o=Math.atan(12/Gh*(s+Math.acos(Math.sin(s)*Math.cos(Rh))-Sh)),r=Math.sqrt((1-Math.cos(n))/(Math.cos(o)*Math.cos(o))/(1-Math.cos(Math.atan(1/Math.cos(s))))),2===h.value?o+=Sh:3===h.value?o+=Gh:4===h.value&&(o+=1.5*Gh),a.x=r*Math.cos(o),a.y=r*Math.sin(o),a.x=a.x*this.a+this.x0,a.y=a.y*this.a+this.y0,t.x=a.x,t.y=a.y,t},inverse:function(t){var e,i,s,n,r,o,a,h,l,c,u,d,g={lam:0,phi:0},f={value:0};if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,i=Math.atan(Math.sqrt(t.x*t.x+t.y*t.y)),e=Math.atan2(t.y,t.x),t.x>=0&&t.x>=Math.abs(t.y)?f.value=1:t.y>=0&&t.y>=Math.abs(t.x)?(f.value=2,e-=Sh):t.x<0&&-t.x>=Math.abs(t.y)?(f.value=3,e=e<0?e+Gh:e-Gh):(f.value=4,e+=Sh),l=Gh/12*Math.tan(e),r=Math.sin(l)/(Math.cos(l)-1/Math.sqrt(2)),o=Math.atan(r),(a=1-(s=Math.cos(e))*s*(n=Math.tan(i))*n*(1-Math.cos(Math.atan(1/Math.cos(o)))))<-1?a=-1:a>1&&(a=1),5===this.face)h=Math.acos(a),g.phi=Sh-h,1===f.value?g.lam=o+Sh:2===f.value?g.lam=o<0?o+Gh:o-Gh:3===f.value?g.lam=o-Sh:g.lam=o;else if(6===this.face)h=Math.acos(a),g.phi=h-Sh,1===f.value?g.lam=-o+Sh:2===f.value?g.lam=-o:3===f.value?g.lam=-o-Sh:g.lam=o<0?-o-Gh:-o+Gh;else{var _,p,m;l=(_=a)*_,p=(l+=(m=l>=1?0:Math.sqrt(1-l)*Math.sin(o))*m)>=1?0:Math.sqrt(1-l),2===f.value?(l=p,p=-m,m=l):3===f.value?(p=-p,m=-m):4===f.value&&(l=p,p=m,m=-l),2===this.face?(l=_,_=-p,p=l):3===this.face?(_=-_,p=-p):4===this.face&&(l=_,_=p,p=-l),g.phi=Math.acos(-m)-Sh,g.lam=Math.atan2(p,_),2===this.face?g.lam=au(g.lam,-Sh):3===this.face?g.lam=au(g.lam,-Gh):4===this.face&&(g.lam=au(g.lam,+Sh))}return 0!==this.es&&(c=g.phi<0?1:0,u=Math.tan(g.phi),d=this.b/Math.sqrt(u*u+this.one_minus_f_squared),g.phi=Math.atan(Math.sqrt(this.a*this.a-d*d)/(this.one_minus_f*d)),c&&(g.phi=-g.phi)),g.lam+=this.long0,t.x=g.lam,t.y=g.phi,t},names:["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"]};var lu=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-9.86701e-7],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,1.8736e-8],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,9.34959e-7],[.7986,-.00755338,-500009e-10,9.35324e-7],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],cu=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-1.26793e-9,4.22642e-10],[.124,.0124,5.07171e-9,-1.60604e-9],[.186,.0123999,-1.90189e-8,6.00152e-9],[.248,.0124002,7.10039e-8,-2.24e-8],[.31,.0123992,-2.64997e-7,8.35986e-8],[.372,.0124029,9.88983e-7,-3.11994e-7],[.434,.0123893,-369093e-11,-4.35621e-7],[.4958,.0123198,-102252e-10,-3.45523e-7],[.5571,.0121916,-154081e-10,-5.82288e-7],[.6176,.0119938,-241424e-10,-5.25327e-7],[.6769,.011713,-320223e-10,-5.16405e-7],[.7346,.0113541,-397684e-10,-6.09052e-7],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-1.40374e-9],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],uu=.8487,du=1.3523,gu=Ch/5,fu=1/gu,_u=function(t,e){return t[0]+e*(t[1]+e*(t[2]+e*t[3]))};const pu={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"},forward:function(t){var e=ll(t.x-this.long0,this.over),i=Math.abs(t.y),s=Math.floor(i*gu);s<0?s=0:s>=18&&(s=17);var n={x:_u(lu[s],i=Ch*(i-fu*s))*e,y:_u(cu[s],i)};return t.y<0&&(n.y=-n.y),n.x=n.x*this.a*uu+this.x0,n.y=n.y*this.a*du+this.y0,n},inverse:function(t){var e={x:(t.x-this.x0)/(this.a*uu),y:Math.abs(t.y-this.y0)/(this.a*du)};if(e.y>=1)e.x/=lu[18][0],e.y=t.y<0?-Sh:Sh;else{var i=Math.floor(18*e.y);for(i<0?i=0:i>=18&&(i=17);;)if(cu[i][0]>e.y)--i;else{if(!(cu[i+1][0]<=e.y))break;++i}var s=cu[i],n=5*(e.y-s[0])/(cu[i+1][0]-s[0]);n=function(t,e,i,s){for(var n=e;s;--s){var r=t(n);if(n-=r,Math.abs(r)<1e-10)break}return n}(function(t){return(_u(s,t)-e.y)/function(t,e){return t[1]+e*(2*t[2]+3*e*t[3])}(s,t)},n,0,100),e.x/=_u(lu[i],n),e.y=(5*i+n)*Ph,t.y<0&&(e.y=-e.y)}return e.x=ll(e.x+this.long0,this.over),e},names:["Robinson","robin"]},mu={init:function(){this.name="geocent"},forward:function(t){return Fl(t,this.es,this.a)},inverse:function(t){return zl(t,this.es,this.a,this.b)},names:["Geocentric","geocentric","geocent","Geocent"]};var yu={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};const vu={init:function(){if(Object.keys(yu).forEach(function(t){if(void 0===this[t])this[t]=yu[t].def;else{if(yu[t].num&&isNaN(this[t]))throw new Error("Invalid parameter value, must be numeric "+t+" = "+this[t]);yu[t].num&&(this[t]=parseFloat(this[t]))}yu[t].degrees&&(this[t]=this[t]*Ph)}.bind(this)),Math.abs(Math.abs(this.lat0)-Sh)<bh?this.mode=this.lat0<0?1:0:Math.abs(this.lat0)<bh?this.mode=2:(this.mode=3,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw new Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var t=this.tilt,e=this.azi;this.cg=Math.cos(e),this.sg=Math.sin(e),this.cw=Math.cos(t),this.sw=Math.sin(t)},forward:function(t){t.x-=this.long0;var e,i,s,n,r=Math.sin(t.y),o=Math.cos(t.y),a=Math.cos(t.x);switch(this.mode){case 3:i=this.sinph0*r+this.cosph0*o*a;break;case 2:i=o*a;break;case 1:i=-r;break;case 0:i=r}switch(e=(i=this.pn1/(this.p-i))*o*Math.sin(t.x),this.mode){case 3:i*=this.cosph0*r-this.sinph0*o*a;break;case 2:i*=r;break;case 0:i*=-o*a;break;case 1:i*=o*a}return n=1/((s=i*this.cg+e*this.sg)*this.sw*this.h1+this.cw),e=(e*this.cg-i*this.sg)*this.cw*n,i=s*n,t.x=e*this.a,t.y=i*this.a,t},inverse:function(t){t.x/=this.a,t.y/=this.a;var e,i,s,n={x:t.x,y:t.y};s=1/(this.pn1-t.y*this.sw),e=this.pn1*t.x*s,i=this.pn1*t.y*this.cw*s,t.x=e*this.cg+i*this.sg,t.y=i*this.cg-e*this.sg;var r=Mc(t.x,t.y);if(Math.abs(r)<bh)n.x=0,n.y=t.y;else{var o,a;switch(a=1-r*r*this.pfact,a=(this.p-Math.sqrt(a))/(this.pn1/r+r/this.pn1),o=Math.sqrt(1-a*a),this.mode){case 3:n.y=Math.asin(o*this.sinph0+t.y*a*this.cosph0/r),t.y=(o-this.sinph0*Math.sin(n.y))*r,t.x*=a*this.cosph0;break;case 2:n.y=Math.asin(t.y*a/r),t.y=o*r,t.x*=a;break;case 0:n.y=Math.asin(o),t.y=-t.y;break;case 1:n.y=-Math.asin(o)}n.x=Math.atan2(t.x,t.y)}return t.x=n.x+this.long0,t.y=n.y,t},names:["Tilted_Perspective","tpers"]},Mu={init:function(){if(this.flip_axis="x"===this.sweep?1:0,this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,0!==this.es){var t=1-this.es,e=1/t;this.radius_p=Math.sqrt(t),this.radius_p2=t,this.radius_p_inv2=e,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")},forward:function(t){var e,i,s,n,r=t.x,o=t.y;if(r-=this.long0,"ellipse"===this.shape){o=Math.atan(this.radius_p2*Math.tan(o));var a=this.radius_p/Mc(this.radius_p*Math.cos(o),Math.sin(o));if(i=a*Math.cos(r)*Math.cos(o),s=a*Math.sin(r)*Math.cos(o),n=a*Math.sin(o),(this.radius_g-i)*i-s*s-n*n*this.radius_p_inv2<0)return t.x=Number.NaN,t.y=Number.NaN,t;e=this.radius_g-i,this.flip_axis?(t.x=this.radius_g_1*Math.atan(s/Mc(n,e)),t.y=this.radius_g_1*Math.atan(n/e)):(t.x=this.radius_g_1*Math.atan(s/e),t.y=this.radius_g_1*Math.atan(n/Mc(s,e)))}else"sphere"===this.shape&&(e=Math.cos(o),i=Math.cos(r)*e,s=Math.sin(r)*e,n=Math.sin(o),e=this.radius_g-i,this.flip_axis?(t.x=this.radius_g_1*Math.atan(s/Mc(n,e)),t.y=this.radius_g_1*Math.atan(n/e)):(t.x=this.radius_g_1*Math.atan(s/e),t.y=this.radius_g_1*Math.atan(n/Mc(s,e))));return t.x=t.x*this.a,t.y=t.y*this.a,t},inverse:function(t){var e,i,s,n,r=-1,o=0,a=0;if(t.x=t.x/this.a,t.y=t.y/this.a,"ellipse"===this.shape){this.flip_axis?(a=Math.tan(t.y/this.radius_g_1),o=Math.tan(t.x/this.radius_g_1)*Mc(1,a)):(o=Math.tan(t.x/this.radius_g_1),a=Math.tan(t.y/this.radius_g_1)*Mc(1,o));var h=a/this.radius_p;if(e=o*o+h*h+r*r,(s=(i=2*this.radius_g*r)*i-4*e*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;n=(-i-Math.sqrt(s))/(2*e),r=this.radius_g+n*r,o*=n,a*=n,t.x=Math.atan2(o,r),t.y=Math.atan(a*Math.cos(t.x)/r),t.y=Math.atan(this.radius_p_inv2*Math.tan(t.y))}else if("sphere"===this.shape){if(this.flip_axis?(a=Math.tan(t.y/this.radius_g_1),o=Math.tan(t.x/this.radius_g_1)*Math.sqrt(1+a*a)):(o=Math.tan(t.x/this.radius_g_1),a=Math.tan(t.y/this.radius_g_1)*Math.sqrt(1+o*o)),e=o*o+a*a+r*r,(s=(i=2*this.radius_g*r)*i-4*e*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;n=(-i-Math.sqrt(s))/(2*e),r=this.radius_g+n*r,o*=n,a*=n,t.x=Math.atan2(o,r),t.y=Math.atan(a*Math.cos(t.x)/r)}return t.x=t.x+this.long0,t},names:["Geostationary Satellite View","Geostationary_Satellite","geos"]};var wu=1.340264,xu=-.081106,Eu=893e-6,Su=.003796,bu=Math.sqrt(3)/2;const Pu={init:function(){this.es=0,this.long0=void 0!==this.long0?this.long0:0,this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0},forward:function(t){var e=ll(t.x-this.long0,this.over),i=t.y,s=Math.asin(bu*Math.sin(i)),n=s*s,r=n*n*n;return t.x=e*Math.cos(s)/(bu*(wu+3*xu*n+r*(7*Eu+9*Su*n))),t.y=s*(wu+xu*n+r*(Eu+Su*n)),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t},inverse:function(t){t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a;var e,i,s,n,r=t.y;for(n=0;n<12&&(r-=s=(r*(wu+xu*(e=r*r)+(i=e*e*e)*(Eu+Su*e))-t.y)/(wu+3*xu*e+i*(7*Eu+9*Su*e)),!(Math.abs(s)<1e-9));++n);return i=(e=r*r)*e*e,t.x=bu*t.x*(wu+3*xu*e+i*(7*Eu+9*Su*e))/Math.cos(r),t.y=Math.asin(Math.sin(r)/bu),t.x=ll(t.x+this.long0,this.over),t},names:["eqearth","Equal Earth","Equal_Earth"]};var Cu=1e-10;function Ru(t){var e,i,s,n=ll(t.x-(this.long0||0),this.over),r=t.y;return e=this.am1+this.m1-pc(r,i=Math.sin(r),s=Math.cos(r),this.en),i=s*n/(e*Math.sqrt(1-this.es*i*i)),t.x=e*Math.sin(i),t.y=this.am1-e*Math.cos(i),t.x=this.a*t.x+(this.x0||0),t.y=this.a*t.y+(this.y0||0),t}function Iu(t){var e,i,s,n;if(t.x=(t.x-(this.x0||0))/this.a,t.y=(t.y-(this.y0||0))/this.a,i=Mc(t.x,t.y=this.am1-t.y),n=mc(this.am1+this.m1-i,this.es,this.en),(e=Math.abs(n))<Sh)e=Math.sin(n),s=i*Math.atan2(t.x,t.y)*Math.sqrt(1-this.es*e*e)/Math.cos(n);else{if(!(Math.abs(e-Sh)<=Cu))throw new Error;s=0}return t.x=ll(s+(this.long0||0),this.over),t.y=qc(n),t}function Gu(t){var e,i,s=ll(t.x-(this.long0||0),this.over),n=t.y;return i=this.cphi1+this.phi1-n,Math.abs(i)>Cu?(t.x=i*Math.sin(e=s*Math.cos(n)/i),t.y=this.cphi1-i*Math.cos(e)):t.x=t.y=0,t.x=this.a*t.x+(this.x0||0),t.y=this.a*t.y+(this.y0||0),t}function Au(t){var e,i;t.x=(t.x-(this.x0||0))/this.a,t.y=(t.y-(this.y0||0))/this.a;var s=Mc(t.x,t.y=this.cphi1-t.y);if(i=this.cphi1+this.phi1-s,Math.abs(i)>Sh)throw new Error;return e=Math.abs(Math.abs(i)-Sh)<=Cu?0:s*Math.atan2(t.x,t.y)/Math.cos(i),t.x=ll(e+(this.long0||0),this.over),t.y=qc(i),t}const Tu={init:function(){var t;if(this.phi1=this.lat1,Math.abs(this.phi1)<Cu)throw new Error;this.es?(this.en=_c(this.es),this.m1=pc(this.phi1,this.am1=Math.sin(this.phi1),t=Math.cos(this.phi1),this.en),this.am1=t/(Math.sqrt(1-this.es*this.am1*this.am1)*this.am1),this.inverse=Iu,this.forward=Ru):(Math.abs(this.phi1)+Cu>=Sh?this.cphi1=0:this.cphi1=1/Math.tan(this.phi1),this.inverse=Au,this.forward=Gu)},names:["bonne","Bonne (Werner lat_1=90)"]},Ou={OBLIQUE:{forward:function(t,e){let{x:i,y:s}=e;i+=t.long0;const n=Math.cos(i),r=Math.sin(s),o=Math.cos(s);e.x=ll(Math.atan2(o*Math.sin(i),t.sphip*o*n+t.cphip*r)+t.lamp),e.y=Math.asin(t.sphip*r-t.cphip*o*n);const a=t.obliqueProjection.forward(e);return t.isIdentity&&(a.x*=Ch,a.y*=Ch),a},inverse:function(t,e){t.isIdentity&&(e.x*=Ph,e.y*=Ph);const i=t.obliqueProjection.inverse(e);let{x:s,y:n}=i;if(s<Number.MAX_VALUE){s-=t.lamp;const i=Math.cos(s),r=Math.sin(n),o=Math.cos(n);e.x=Math.atan2(o*Math.sin(s),t.sphip*o*i-t.cphip*r),e.y=Math.asin(t.sphip*r+t.cphip*o*i)}return e.x=ll(e.x+t.long0),e}},TRANSVERSE:{forward:function(t,e){let{x:i,y:s}=e;i+=t.long0;const n=Math.cos(s),r=Math.cos(i);e.x=ll(Math.atan2(n*Math.sin(i),Math.sin(s))+t.lamp),e.y=Math.asin(-1*n*r);const o=t.obliqueProjection.forward(e);return t.isIdentity&&(o.x*=Ch,o.y*=Ch),o},inverse:function(t,e){t.isIdentity&&(e.x*=Ph,e.y*=Ph);const i=t.obliqueProjection.inverse(e);let{x:s,y:n}=i;if(s<Number.MAX_VALUE){const i=Math.cos(n);s-=t.lamp,e.x=Math.atan2(i*Math.sin(s),-1*Math.sin(n)),e.y=Math.asin(i*Math.cos(s))}return e.x=ll(e.x+t.long0),e}}},Lu={ROTATE:{o_alpha:"oAlpha",o_lon_c:"oLongC",o_lat_c:"oLatC"},NEW_POLE:{o_lat_p:"oLatP",o_lon_p:"oLongP"},NEW_EQUATOR:{o_lon_1:"oLong1",o_lat_1:"oLat1",o_lon_2:"oLong2",o_lat_2:"oLat2"}},Nu={init:function(){if(this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.title=this.title||"General Oblique Transformation",this.isIdentity=gl.includes(this.o_proj),!this.o_proj)throw new Error("Missing parameter: o_proj");if("ob_tran"===this.o_proj)throw new Error("Invalid value for o_proj: "+this.o_proj);const t=this.projStr.replace("+proj=ob_tran","").replace("+o_proj=","+proj=").trim(),e=kl(t);if(!e)throw new Error("Invalid parameter: o_proj. Unknown projection "+this.o_proj);let i;e.long0=0,this.obliqueProjection=e;const s=Object.keys(Lu),n=t=>{if(void 0===this[t])return;const e=parseFloat(this[t])*Ph;if(isNaN(e))throw new Error("Invalid value for "+t+": "+this[t]);return e};for(let t=0;t<s.length;t++){const e=s[t],r=Lu[e],o=Object.entries(r);if(o.some(([t])=>void 0!==this[t])){i=r;for(let t=0;t<o.length;t++){const[e,i]=o[t],s=n(e);if(void 0===s)throw new Error("Missing parameter: "+e+".");this[i]=s}break}}if(!i)throw new Error("No valid parameters provided for ob_tran projection.");const{lamp:r,phip:o}=function(t,e){let i,s;if(e===Lu.ROTATE){let e=t.oLongC,n=t.oLatC,r=t.oAlpha;if(Math.abs(Math.abs(n)-Sh)<=bh)throw new Error("Invalid value for o_lat_c: "+t.o_lat_c+" should be < 90°");s=e+Math.atan2(-1*Math.cos(r),-1*Math.sin(r)*Math.sin(n)),i=Math.asin(Math.cos(n)*Math.sin(r))}else if(e===Lu.NEW_POLE)s=t.oLongP,i=t.oLatP;else{let e=t.oLong1,n=t.oLat1,r=t.oLong2,o=t.oLat2,a=Math.abs(n);if(Math.abs(n)>Sh-bh)throw new Error("Invalid value for o_lat_1: "+t.o_lat_1+" should be < 90°");if(Math.abs(o)>Sh-bh)throw new Error("Invalid value for o_lat_2: "+t.o_lat_2+" should be < 90°");if(Math.abs(n-o)<bh)throw new Error("Invalid value for o_lat_1 and o_lat_2: o_lat_1 should be different from o_lat_2");if(a<bh)throw new Error("Invalid value for o_lat_1: o_lat_1 should be different from zero");s=Math.atan2(Math.cos(n)*Math.sin(o)*Math.cos(e)-Math.sin(n)*Math.cos(o)*Math.cos(r),Math.sin(n)*Math.cos(o)*Math.sin(r)-Math.cos(n)*Math.sin(o)*Math.sin(e)),i=Math.atan(-1*Math.cos(s-e)/Math.tan(n))}return{lamp:s,phip:i}}(this,i);this.lamp=r,Math.abs(o)>bh?(this.cphip=Math.cos(o),this.sphip=Math.sin(o),this.projectionType=Ou.OBLIQUE):this.projectionType=Ou.TRANSVERSE},forward:function(t){return this.projectionType.forward(this,t)},inverse:function(t){return this.projectionType.inverse(this,t)},names:["General Oblique Transformation","General_Oblique_Transformation","ob_tran"]},ku=Object.assign(function(t,e,i){var s,n,r,o=!1;return void 0===e?(n=Yl(t),s=Zl,o=!0):(void 0!==e.x||Array.isArray(e))&&(i=e,n=Yl(t),s=Zl,o=!0),s||(s=Yl(t)),n||(n=Yl(e)),i?Vl(s,n,i):(r={forward:function(t,e){return Vl(s,n,t,e)},inverse:function(t,e){return Vl(n,s,t,e)}},o&&(r.oProj=n),r)},{defaultDatum:"WGS84",Proj:kl,WGS84:new kl("WGS84"),Point:uc,toPoint:Kl,defs:nl,nadgrid:function(t,e,i){return e instanceof ArrayBuffer?function(t,e,i){var s=!0;void 0!==i&&!1===i.includeErrorFields&&(s=!1);var n=new DataView(e),r=function(t){var e=t.getInt32(8,!1);return 11!==e&&(11!==(e=t.getInt32(8,!0))&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}(n),o=function(t,e){return{nFields:t.getInt32(8,e),nSubgridFields:t.getInt32(24,e),nSubgrids:t.getInt32(40,e),shiftType:Al(t,56,64).trim(),fromSemiMajorAxis:t.getFloat64(120,e),fromSemiMinorAxis:t.getFloat64(136,e),toSemiMajorAxis:t.getFloat64(152,e),toSemiMinorAxis:t.getFloat64(168,e)}}(n,r),a=function(t,e,i,s){for(var n=176,r=[],o=0;o<e.nSubgrids;o++){var a=Ol(t,n,i),h=Ll(t,n,a,i,s),l=Math.round(1+(a.upperLongitude-a.lowerLongitude)/a.longitudeInterval),c=Math.round(1+(a.upperLatitude-a.lowerLatitude)/a.latitudeInterval);r.push({ll:[Gl(a.lowerLongitude),Gl(a.lowerLatitude)],del:[Gl(a.longitudeInterval),Gl(a.latitudeInterval)],lim:[l,c],count:a.gridNodeCount,cvs:Tl(h)});var u=16;!1===s&&(u=8),n+=176+a.gridNodeCount*u}return r}(n,o,r,s),h={header:o,subgrids:a};return Pl[t]=h,h}(t,e,i):{ready:Cl(t,e)}},transform:Wl,mgrs:ec,version:"__VERSION__"});var Fu;(Fu=ku).Proj.projections.add(yc),Fu.Proj.projections.add(Ec),Fu.Proj.projections.add(Sc),Fu.Proj.projections.add(Cc),Fu.Proj.projections.add(Ic),Fu.Proj.projections.add(Gc),Fu.Proj.projections.add(Tc),Fu.Proj.projections.add(Oc),Fu.Proj.projections.add(Lc),Fu.Proj.projections.add(Bc),Fu.Proj.projections.add(Xc),Fu.Proj.projections.add(Zc),Fu.Proj.projections.add(Vc),Fu.Proj.projections.add(Yc),Fu.Proj.projections.add(Hc),Fu.Proj.projections.add($c),Fu.Proj.projections.add(Qc),Fu.Proj.projections.add(Jc),Fu.Proj.projections.add(tu),Fu.Proj.projections.add(eu),Fu.Proj.projections.add(iu),Fu.Proj.projections.add(su),Fu.Proj.projections.add(nu),Fu.Proj.projections.add(ru),Fu.Proj.projections.add(hu),Fu.Proj.projections.add(pu),Fu.Proj.projections.add(mu),Fu.Proj.projections.add(vu),Fu.Proj.projections.add(Mu),Fu.Proj.projections.add(Pu),Fu.Proj.projections.add(Tu),Fu.Proj.projections.add(Nu);const zu=ku;let Du=null;var ju=[896,448,224,112,56,28,14,7,3.5,1.75,.875,.4375,.21875,.109375],qu=[156543.03392800014,78271.51696400007,39135.758482000034,19567.879241000017,9783.939620500008,4891.969810250004,2445.984905125002,1222.992452562501,611.4962262812505,305.74811314062526,152.87405657031263,76.43702828515632,38.21851414257816,19.10925707128908,9.55462853564454,4.77731426782227,2.388657133911135,1.1943285669555674,.5971642834777837,.29858214173889186,.14929107086944593,.07464553543472296,.03732276771736148,.01866138385868074],Uu=[-238375,1376256],Bu=300,Ku=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom"];function Xu(t){return"world"===t?{resolutions:qu,defaultMinZoom:6,maxZoom:20}:{resolutions:ju,defaultMinZoom:0,maxZoom:ju.length-1}}var Wu=function(t,e){var i=null,s=function(){for(var s=arguments.length,n=new Array(s),r=0;r<s;r++)n[r]=arguments[r];clearTimeout(i),i=setTimeout(function(){t.apply(void 0,n)},e)};return s.cancel=function(){i&&(clearTimeout(i),i=null)},s};function Zu(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,s=Array(e);i<e;i++)s[i]=t[i];return s}function Vu(t){var e=t.map,i=t.source,s=t.events,n=t.eventBus,r=t.getZoom,o=t.getCenter,a=t.getBounds,h=t.getResolution,l=!1,c=[],u=[],d=e.getView(),g=d.getMinZoom(),f=d.getMaxZoom(),_=function(t){var e=function(){if(l)return null;var t=r();return{center:o(),bounds:a(),resolution:h(),zoom:t,isAtMaxZoom:t+.01>=f,isAtMinZoom:t-.01<=g}}();e&&n.emit(t,e)},p=function(t,e,i){t.on(e,i),c.push([t,e,i])};!function(t){var e=t.map,i=t.emit,s=t.eventBus,n=t.events,r=!1;(0,t.on)(t.source,"tileloadend",function(){r||(r=!0,s.emit(n.MAP_LOADED))}),e.once("rendercomplete",function(){return i(n.MAP_FIRST_IDLE)})}({source:i,map:e,emit:_,eventBus:n,events:s,on:p}),function(t){var e=t.map,i=t.view,s=t.emit,n=t.eventBus,r=t.events,o=t.on,a=t.debouncers,h=!1,l=Wu(function(){h=!1,s(r.MAP_MOVE_END)},500);a.push(l);var c,u,d=(c=function(){return s(r.MAP_MOVE)},u=0,function(){var t=Date.now();t-u>=10&&(u=t,c.apply(void 0,arguments))});o(i,"change",function(){h||(h=!0,n.emit(r.MAP_MOVE_START)),l()}),o(e,"postrender",function(){h&&d()})}({map:e,view:e.getView(),emit:_,eventBus:n,events:s,on:p,debouncers:u}),function(t){var e=t.map,i=t.eventBus,s=t.events,n=t.on,r=null;n(e,"pointerdown",function(t){r=t.pixel}),n(e,"click",function(t){if(r){var e=t.pixel[0]-r[0],n=t.pixel[1]-r[1];if(Math.hypot(e,n)>6)return}i.emit(s.MAP_CLICK,{point:{x:t.pixel[0],y:t.pixel[1]},coords:t.coordinate})})}({map:e,eventBus:n,events:s,on:p}),p(e,"postrender",function(){return n.emit(s.MAP_RENDER)});var m=Wu(function(){return _(s.MAP_DATA_CHANGE)},500);return u.push(m),p(i,"tileloadend",m),{remove:function(){l=!0,u.forEach(function(t){return t.cancel()}),c.forEach(function(t){var e,i,s=(i=3,function(t){if(Array.isArray(t))return t}(e=t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var s,n,r,o,a=[],h=!0,l=!1;try{if(r=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;h=!1}else for(;!(h=(s=r.call(i)).done)&&(a.push(s.value),a.length!==e);h=!0);}catch(t){l=!0,n=t}finally{try{if(!h&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(l)throw n}}return a}}(e,i)||function(t,e){if(t){if("string"==typeof t)return Zu(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)?Zu(t,e):void 0}}(e,i)||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.")}()),n=s[0],r=s[1],o=s[2];return n.un(r,o)})}}}const Yu=[0,0,0],Hu=class{constructor(t){let e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,it(function(t){const e=((t,e)=>e-t)||v;return t.every(function(i,s){if(0===s)return!0;const n=e(t[s-1],i);return!(n>0||0===n)})}(this.resolutions_),"`resolutions` must be sorted in descending order"),!t.origins)for(let t=0,i=this.resolutions_.length-1;t<i;++t)if(e){if(this.resolutions_[t]/this.resolutions_[t+1]!==e){e=void 0;break}}else e=this.resolutions_[t]/this.resolutions_[t+1];this.zoomFactor_=e,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,it(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const i=t.extent;void 0===i||this.origin_||this.origins_||(this.origin_=qt(i)),it(!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,it(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,it(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=void 0!==i?i:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],void 0!==t.sizes?this.fullTileRanges_=t.sizes.map((t,e)=>{const s=new Qa(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(i){const t=this.getTileRangeForExtentAndZ(i,e);s.minX=Math.max(t.minX,s.minX),s.maxX=Math.min(t.maxX,s.maxX),s.minY=Math.max(t.minY,s.minY),s.maxY=Math.min(t.maxY,s.maxY)}return s}):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const s=this.getTileRangeForExtentAndZ(t,e);for(let t=s.minX,n=s.maxX;t<=n;++t)for(let n=s.minY,r=s.maxY;n<=r;++n)i([e,t,n])}forEachTileCoordParentTileRange(t,e,i,s){let n,r,o,a=null,h=t[0]-1;for(2===this.zoomFactor_?(r=t[1],o=t[2]):a=this.getTileCoordExtent(t,s);h>=this.minZoom;){if(void 0!==r&&void 0!==o?(r=Math.floor(r/2),o=Math.floor(o/2),n=$a(r,r,o,o,i)):n=this.getTileRangeForExtentAndZ(a,h,i),e(h,n))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getOrigins(){return this.origins_}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(2===this.zoomFactor_){const i=2*t[1],s=2*t[2];return $a(i,i+1,s,s+1,e)}const s=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(s,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const s=t[0],n=t[1],r=t[2];if(e===s)return $a(n,r,n,r,i);if(this.zoomFactor_){const t=Math.pow(this.zoomFactor_,e-s),o=Math.floor(n*t),a=Math.floor(r*t);return e<s?$a(o,o,a,a,i):$a(o,Math.floor(t*(n+1))-1,a,Math.floor(t*(r+1))-1,i)}const o=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(o,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,Yu);const s=Yu[1],n=Yu[2];return this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,Yu),$a(s,Yu[1],n,Yu[2],i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),s=hr(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*s[0]*i,e[1]-(t[2]+.5)*s[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),s=this.getResolution(t[0]),n=hr(this.getTileSize(t[0]),this.tmpSize_),r=i[0]+t[1]*n[0]*s,o=i[1]-(t[2]+1)*n[1]*s;return bt(r,o,r+n[0]*s,o+n[1]*s,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,s,n){const r=this.getZForResolution(i),o=i/this.getResolution(r),a=this.getOrigin(r),h=hr(this.getTileSize(r),this.tmpSize_);let l=o*(t-a[0])/i/h[0],c=o*(a[1]-e)/i/h[1];return s?(l=pt(l,5)-1,c=pt(c,5)-1):(l=_t(l,5),c=_t(c,5)),ah(r,l,c,n)}getTileCoordForXYAndZ_(t,e,i,s,n){const r=this.getOrigin(i),o=this.getResolution(i),a=hr(this.getTileSize(i),this.tmpSize_);let h=(t-r[0])/o/a[0],l=(r[1]-e)/o/a[1];return s?(h=pt(h,5)-1,l=pt(l,5)-1):(h=_t(h,5),l=_t(l,5)),ah(i,h,l,n)}getTileCoordForCoordAndZ(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){return at(M(this.resolutions_,t,e||0),this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return Ki(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,i=new Array(e);for(let s=this.minZoom;s<e;++s)i[s]=this.getTileRangeForExtentAndZ(t,s);this.fullTileRanges_=i}};function $u(t){let e=t.getDefaultTileGrid();return e||(e=function(t){return function(t,e,i,s){s=void 0!==s?s:"top-left";const n=Qu(t,e,i);return new Hu({extent:t,origin:kt(t,s),resolutions:n,tileSize:i})}(Ju(t),void 0,void 0,void 0)}(t),t.setDefaultTileGrid(e)),e}function Qu(t,e,i,s){e=void 0!==e?e:42,i=hr(void 0!==i?i:256);const n=Dt(t),r=Bt(t);s=s>0?s:Math.max(r/i[0],n/i[1]);const o=e+1,a=new Array(o);for(let t=0;t<o;++t)a[t]=s/Math.pow(2,t);return a}function Ju(t){let e=(t=$e(t)).getExtent();if(!e){const i=180*ie.degrees/t.getMetersPerUnit();e=bt(-i,-i,i,i)}return e}const td=/\{z\}/g,ed=/\{x\}/g,id=/\{y\}/g,sd=/\{-y\}/g;function nd(t,e){return function(i,s,n){if(!i)return;let r;const o=i[0];if(e){const t=e.getFullTileRange(o);t&&(r=t.getHeight()-1)}return function(t,e,i,s,n){return t.replace(td,e.toString()).replace(ed,i.toString()).replace(id,s.toString()).replace(sd,function(){if(void 0===n)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(n-s).toString()})}(t,o,i[1],i[2],r)}}function rd(t){return t?"function"==typeof t?t:(Array.isArray(t)||(t=[t]),e=>t):null}const od=class extends O{constructor(t){super(),this.projection=$e(t.projection),this.attributions_=rd(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_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=rd(t),this.changed()}setState(t){this.state_=t,this.changed()}};class ad extends b{constructor(t,e){super(t),this.tile=e}}const hd=class extends od{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&&hr(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),[256,256]),this.tmpSize=[0,0],this.key_=t.key||A(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,s,n,r){return I()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:$u(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const s=this.getTileGridForProjection(i),n=this.getTilePixelRatio(e),r=hr(s.getTileSize(t),this.tmpSize);return 1==n?r:(o=r,a=n,void 0===(h=this.tmpSize)&&(h=[0,0]),h[0]=o[0]*a+.5|0,h[1]=o[1]*a+.5|0,h);var o,a,h}getTileCoordForTileUrlFunction(t,e){const i=void 0!==e?e:this.getProjection(),s=void 0!==e?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=function(t,e,i){const s=e[0],n=t.getTileCoordCenter(e),r=Ju(i);if(!xt(r,n)){const e=Bt(r),i=Math.ceil((r[0]-n[0])/e);return n[0]+=e*i,t.getTileCoordForCoordAndZ(n,s)}return e}(s,t,i)),function(t,e){const i=t[0],s=t[1],n=t[2];if(e.getMinZoom()>i||i>e.getMaxZoom())return!1;const r=e.getFullTileRange(i);return!r||r.containsXY(s,n)}(t,s)?t:null}clear(){}refresh(){this.clear(),super.refresh()}};class ld extends hd{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===ld.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=A(e),s=e.getState();let n;1==s?(this.tileLoadingKeys_[i]=!0,n="tileloadstart"):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],n=3==s?"tileloaderror":2==s?"tileloadend":void 0),null!=n&&this.dispatchEvent(new ad(n,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,void 0!==e?this.setKey(e):this.changed()}setUrl(t){const e=function(t){const e=[];let i=/\{([a-z])-([a-z])\}/.exec(t);if(i){const s=i[1].charCodeAt(0),n=i[2].charCodeAt(0);let r;for(r=s;r<=n;++r)e.push(t.replace(i[0],String.fromCharCode(r)));return e}if(i=/\{(\d+)-(\d+)\}/.exec(t),i){const s=parseInt(i[2],10);for(let n=parseInt(i[1],10);n<=s;n++)e.push(t.replace(i[0],n.toString()));return e}return e.push(t),e}(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(function(t,e){const i=t.length,s=new Array(i);for(let n=0;n<i;++n)s[n]=nd(t[n],e);return function(t){return 1===t.length?t[0]:function(e,i,s){if(!e)return;const n=function(t){return e=t[0],(t[1]<<e)+t[2];var e}(e),r=dt(n,t.length);return t[r](e,i,s)}}(s)}(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}const cd=ld;function ud(t,e){if(K){const i=t.getCrossOrigin();let s="same-origin",n="same-origin";"anonymous"===i||""===i?(s="cors",n="omit"):"use-credentials"===i&&(s="cors",n="include");const r={mode:s,credentials:n,referrerPolicy:t.getReferrerPolicy()};return void fetch(e,r).then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.blob()}).then(t=>createImageBitmap(t)).then(e=>{const i=t.getImage();i.width=e.width,i.height=e.height,i.getContext("2d").drawImage(e,0,0),e.close?.(),i.dispatchEvent(new Event("load"))}).catch(()=>{t.getImage().dispatchEvent(new Event("error"))})}t.getImage().src=e}const dd=class extends cd{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:ud,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:void 0===t.interpolate||t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy=t.referrerPolicy,this.tileClass=void 0!==t.tileClass?t.tileClass:Ya,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!si(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||si(e,t)))return this.tileGrid;const i=A(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=$u(t)),this.tileGridForProjection[i]}createTile_(t,e,i,s,n,r){const o=[t,e,i],a=this.getTileCoordForTileUrlFunction(o,n),h=a?this.tileUrlFunction(a,s,n):void 0,l=new this.tileClass(o,void 0!==h?0:4,void 0!==h?h:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return l.key=r,l.addEventListener(u,this.handleTileChange.bind(this)),l}getTile(t,e,i,s,n,r){const o=this.getProjection();if(!o||!n||si(o,n))return this.getTileInternal(t,e,i,s,o||n);const a=[t,e,i],h=this.getKey(),l=this.getTileGridForProjection(o),c=this.getTileGridForProjection(n),u=this.getTileCoordForTileUrlFunction(a,n),d=new rh(o,l,n,c,a,u,this.getTilePixelRatio(s),this.getGutter(),(t,e,i,s)=>this.getTileInternal(t,e,i,s,o,r),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return d.key=h,d}getTileInternal(t,e,i,s,n,r){const o=this.getKey(),a=hh(this,o,t,e,i);if(r&&r.containsKey(a))return r.get(a);const h=this.createTile_(t,e,i,s,n,o);return r?.set(a,h),h}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const i=$e(t);if(i){const t=A(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}},gd=class extends dd{constructor(t){const e=void 0!==(t=t||{}).projection?t.projection:"EPSG:3857",i=void 0!==t.tileGrid?t.tileGrid:function(t){const e=t||{},i=e.extent||$e("EPSG:3857").getExtent(),s={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:Qu(i,e.maxZoom,e.tileSize,e.maxResolution)};return new Hu(s)}({extent:Ju(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,interpolate:t.interpolate,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=void 0!==t.gutter?t.gutter:0}getGutter(){return this.gutter_}};function fd(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,s=Array(e);i<e;i++)s[i]=t[i];return s}var _d=function(t){return function(e,i){var s=t(i,"Tile")||{},n=s.url||i,r=s.headers||{};fetch(n,{headers:r}).then(function(t){return t.blob()}).then(function(t){e.getImage().src=URL.createObjectURL(t)}).catch(function(){return e.setState(3)})}};function pd(t,e){var i=new Hu({resolutions:ju,origin:Uu,tileSize:256});return new gd({projection:"EPSG:27700",tileGrid:i,tileUrlFunction:function(e){var i,s,n=(s=3,function(t){if(Array.isArray(t))return t}(i=e)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var s,n,r,o,a=[],h=!0,l=!1;try{if(r=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;h=!1}else for(;!(h=(s=r.call(i)).done)&&(a.push(s.value),a.length!==e);h=!0);}catch(t){l=!0,n=t}finally{try{if(!h&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(l)throw n}}return a}}(i,s)||function(t,e){if(t){if("string"==typeof t)return fd(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)?fd(t,e):void 0}}(i,s)||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.")}()),r=n[0],o=n[1],a=n[2];return t.replace("{z}",r).replace("{x}",o).replace("{y}",a)},tileLoadFunction:e?_d(e):void 0})}function md(t){var e=t.tileLayer,i=t.transformRequest,s=t.events,n=t.eventBus,r=function(t){var r=pd(t.url,i);e.setSource(r),n.emit(s.MAP_STYLE_CHANGE,{mapStyleId:t.id})};return n.on(s.MAP_SET_STYLE,r),{remove:function(){n.off(s.MAP_SET_STYLE,r)}}}function yd(t,e,i){if(null!==t)for(var s,n,r,o,a,h,l,c,u=0,d=0,g=t.type,f="FeatureCollection"===g,_="Feature"===g,p=f?t.features.length:1,m=0;m<p;m++){a=(c=!!(l=f?t.features[m].geometry:_?t.geometry:t)&&"GeometryCollection"===l.type)?l.geometries.length:1;for(var y=0;y<a;y++){var v=0,M=0;if(null!==(o=c?l.geometries[y]:l)){h=o.coordinates;var w=o.type;switch(u=!i||"Polygon"!==w&&"MultiPolygon"!==w?0:1,w){case null:break;case"Point":if(!1===e(h,d,m,v,M))return!1;d++,v++;break;case"LineString":case"MultiPoint":for(s=0;s<h.length;s++){if(!1===e(h[s],d,m,v,M))return!1;d++,"MultiPoint"===w&&v++}"LineString"===w&&v++;break;case"Polygon":case"MultiLineString":for(s=0;s<h.length;s++){for(n=0;n<h[s].length-u;n++){if(!1===e(h[s][n],d,m,v,M))return!1;d++}"MultiLineString"===w&&v++,"Polygon"===w&&M++}"Polygon"===w&&v++;break;case"MultiPolygon":for(s=0;s<h.length;s++){for(M=0,n=0;n<h[s].length;n++){for(r=0;r<h[s][n].length-u;r++){if(!1===e(h[s][n][r],d,m,v,M))return!1;d++}M++}v++}break;case"GeometryCollection":for(s=0;s<o.geometries.length;s++)if(!1===yd(o.geometries[s],e,i))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}var vd=function(t,e={}){if(null!=t.bbox&&!0!==e.recompute)return t.bbox;const i=[1/0,1/0,-1/0,-1/0];return yd(t,t=>{i[0]>t[0]&&(i[0]=t[0]),i[1]>t[1]&&(i[1]=t[1]),i[2]<t[0]&&(i[2]=t[0]),i[3]<t[1]&&(i[3]=t[1])}),i};function Md(t){return function(t){if(Array.isArray(t))return Ed(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||xd(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.")}()}function wd(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 s,n,r,o,a=[],h=!0,l=!1;try{if(r=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;h=!1}else for(;!(h=(s=r.call(i)).done)&&(a.push(s.value),a.length!==e);h=!0);}catch(t){l=!0,n=t}finally{try{if(!h&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(l)throw n}}return a}}(t,e)||xd(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.")}()}function xd(t,e){if(t){if("string"==typeof t)return Ed(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)?Ed(t,e):void 0}}function Ed(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,s=Array(e);i<e;i++)s[i]=t[i];return s}var Sd=function(t){var e=t/1609.344;if(e<.5)return"".concat(Math.round(t),"m");if(e<10){var i=Number.parseFloat(e.toFixed(1)),s=1===i?"mile":"miles";return"".concat(i," ").concat(s)}var n=Math.round(e);return"".concat(n," miles")};function bd(t){return bd="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},bd(t)}function Pd(){var t,e,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",n=i.toStringTag||"@@toStringTag";function r(i,s,n,r){var h=s&&s.prototype instanceof a?s:a,l=Object.create(h.prototype);return Cd(l,"_invoke",function(i,s,n){var r,a,h,l=0,c=n||[],u=!1,d={p:0,n:0,v:t,a:g,f:g.bind(t,4),d:function(e,i){return r=e,a=0,h=t,d.n=i,o}};function g(i,s){for(a=i,h=s,e=0;!u&&l&&!n&&e<c.length;e++){var n,r=c[e],g=d.p,f=r[2];i>3?(n=f===s)&&(h=r[(a=r[4])?5:(a=3,3)],r[4]=r[5]=t):r[0]<=g&&((n=i<2&&g<r[1])?(a=0,d.v=s,d.n=r[1]):g<f&&(n=i<3||r[0]>s||s>f)&&(r[4]=i,r[5]=s,d.n=f,a=0))}if(n||i>1)return o;throw u=!0,s}return function(n,c,f){if(l>1)throw TypeError("Generator is already running");for(u&&1===c&&g(c,f),a=c,h=f;(e=a<2?t:h)||!u;){r||(a?a<3?(a>1&&(d.n=-1),g(a,h)):d.n=h:d.v=h);try{if(l=2,r){if(a||(n="next"),e=r[n]){if(!(e=e.call(r,h)))throw TypeError("iterator result is not an object");if(!e.done)return e;h=e.value,a<2&&(a=0)}else 1===a&&(e=r.return)&&e.call(r),a<2&&(h=TypeError("The iterator does not provide a '"+n+"' method"),a=1);r=t}else if((e=(u=d.n<0)?h:i.call(s,d))!==o)break}catch(e){r=t,a=1,h=e}finally{l=1}}return{value:e,done:u}}}(i,n,r),!0),l}var o={};function a(){}function h(){}function l(){}e=Object.getPrototypeOf;var c=[][s]?e(e([][s]())):(Cd(e={},s,function(){return this}),e),u=l.prototype=a.prototype=Object.create(c);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,Cd(t,n,"GeneratorFunction")),t.prototype=Object.create(u),t}return h.prototype=l,Cd(u,"constructor",l),Cd(l,"constructor",h),h.displayName="GeneratorFunction",Cd(l,n,"GeneratorFunction"),Cd(u),Cd(u,n,"Generator"),Cd(u,s,function(){return this}),Cd(u,"toString",function(){return"[object Generator]"}),(Pd=function(){return{w:r,m:d}})()}function Cd(t,e,i,s){var n=Object.defineProperty;try{n({},"",{})}catch(t){n=0}Cd=function(t,e,i,s){function r(e,i){Cd(t,e,function(t){return this._invoke(e,i,t)})}e?n?n(t,e,{value:i,enumerable:!s,configurable:!s,writable:!s}):t[e]=i:(r("next",0),r("throw",1),r("return",2))},Cd(t,e,i,s)}function Rd(t,e,i,s,n,r,o){try{var a=t[r](o),h=a.value}catch(t){return void i(t)}a.done?e(h):Promise.resolve(h).then(s,n)}function Id(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,Gd(s.key),s)}}function Gd(t){var e=function(t){if("object"!=bd(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=bd(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==bd(e)?e:e+""}var Ad="EPSG:27700",Td=function(t){if(t){var e=t.top,i=void 0===e?0:e,s=t.right,n=void 0===s?0:s,r=t.bottom,o=void 0===r?0:r,a=t.left;return[i,n,o,void 0===a?0:a]}};zu.defs(Ad,"+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs"),function(t){Du=t;const e=Object.keys(t.defs),i=e.length;let s,n;for(s=0;s<i;++s){const i=e[s];if(!pe(i)){const e=t.defs(i);let s=e.units;s||"longlat"!==e.projName||(s="degrees"),He(new se({code:i,axisOrientation:e.axis,metersPerUnit:e.to_meter,units:s}))}}for(s=0;s<i;++s){const r=e[s],o=pe(r);for(n=0;n<i;++n){const i=e[n],s=pe(i);if(!ve(r,i))if(t.defs[r]===t.defs[i])Je([o,s]);else{const e=t(r,i);ii(o,s,fi(o,s,e.forward),fi(s,o,e.inverse))}}}}(zu);var Od=function(){return t=function t(e){var i=e.mapProviderConfig,s=void 0===i?{}:i,n=e.events,r=e.eventBus;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.events=n,this.eventBus=r,this.capabilities={supportedShortcuts:Ku,supportsMapSizes:!1},Object.assign(this,s)},e=[{key:"initMap",value:(i=Pd().m(function t(e){var i,s,n,r,o,a,h,l,c,u,d,g,f,_,p,m,y,v;return Pd().w(function(t){for(;;)switch(t.n){case 0:s=e.container,n=e.padding,r=e.mapStyle,o=e.mapSize,a=e.center,h=e.zoom,l=e.bounds,c=e.minZoom,u=e.maxZoom,d=e.transformRequest,this.mapStyleId=null==r?void 0:r.id,this.mapSize=o,g=this.events,f=this.eventBus,_=pd(r.url,d),p=new Mh({source:_}),m=Xu(null!==(i=this.zoomAlignment)&&void 0!==i?i:"uk"),y=new rs({projection:Ad,center:a,zoom:null!=h?h:m.defaultMinZoom,minZoom:Math.max(null!=c?c:m.defaultMinZoom,m.defaultMinZoom),maxZoom:null!=u?u:m.maxZoom,resolutions:m.resolutions,constrainResolution:!1,padding:Td(n)}),v=new Ba({target:s,layers:[p],view:y,controls:[],interactions:Js({doubleClickZoom:!1})}),l&&v.once("rendercomplete",function(){y.fit(l,{size:v.getSize(),duration:0})}),this.mapEventHandles=Vu({map:v,source:_,events:g,eventBus:f,getZoom:this.getZoom.bind(this),getCenter:this.getCenter.bind(this),getBounds:this.getBounds.bind(this),getResolution:this.getResolution.bind(this)}),this.appEventHandles=md({tileLayer:p,transformRequest:d,events:g,eventBus:f})||[],this.map=v,this.view=y,this.tileLayer=p,this.source=_,f.emit(g.MAP_READY,{map:this.map,mapStyleId:this.mapStyleId,mapSize:this.mapSize,crs:this.crs});case 1:return t.a(2)}},t,this)}),s=function(){var t=this,e=arguments;return new Promise(function(s,n){var r=i.apply(t,e);function o(t){Rd(r,s,n,o,a,"next",t)}function a(t){Rd(r,s,n,o,a,"throw",t)}o(void 0)})},function(t){return s.apply(this,arguments)})},{key:"destroyMap",value:function(){var t,e;null===(t=this.mapEventHandles)||void 0===t||t.remove(),null===(e=this.appEventHandles)||void 0===e||e.remove(),this.mapEventHandles=null,this.appEventHandles=null,this.map&&(this.map.setTarget(null),this.map=null),this.view=null,this.tileLayer=null,this.source=null}},{key:"setView",value:function(t){var e=t.center,i=t.zoom;this.view.animate({center:null!=e?e:this.view.getCenter(),zoom:null!=i?i:this.view.getZoom(),duration:Bu})}},{key:"zoomIn",value:function(t){this.view.animate({zoom:this.view.getZoom()+t,duration:Bu})}},{key:"zoomOut",value:function(t){this.view.animate({zoom:this.view.getZoom()-t,duration:Bu})}},{key:"panBy",value:function(t){var e=this.view.getCenter(),i=this.view.getResolution();this.view.animate({center:[e[0]+t[0]*i,e[1]-t[1]*i],duration:Bu})}},{key:"fitToBounds",value:function(t){var e=Array.isArray(t)?t:hi(vd(t),"EPSG:4326","EPSG:27700");this.view.fit(e,{duration:Bu})}},{key:"setPadding",value:function(t){this.view.padding=Td(t)}},{key:"getCenter",value:function(){var t=this.view.getCenter();return[Math.round(t[0]*Math.pow(10,2))/Math.pow(10,2),Math.round(t[1]*Math.pow(10,2))/Math.pow(10,2)]}},{key:"getZoom",value:function(){return this.view.getZoom()}},{key:"getBounds",value:function(){return this.view.calculateExtent(this.map.getSize()).map(function(t){return Math.round(100*t)/100})}},{key:"getFeaturesAtPoint",value:function(t,e){return[]}},{key:"getVisibleFeatures",value:function(t){return[]}},{key:"getAreaDimensions",value:function(){return function(t){if(!t)return"";var e=wd(t,4),i=e[0],s=e[1],n=e[2],r=e[3],o=n-i;return"".concat(Sd(r-s)," by ").concat(Sd(o))}((e=(t=this.map).getSize(),s=(i=wd(t.getView().padding||[0,0,0,0],4))[0],n=i[1],r=i[2],o=[i[3],e[1]-r],a=[e[0]-n,s],h=t.getCoordinateFromPixel(o),l=t.getCoordinateFromPixel(a),h&&l?[h[0],h[1],l[0],l[1]]:null));var t,e,i,s,n,r,o,a,h,l}},{key:"getCardinalMove",value:function(t,e){return function(t,e){var i=e[0]-t[0],s=e[1]-t[1],n=[];return Math.abs(s)>1&&n.push("".concat(s>0?"north":"south"," ").concat(Sd(Math.abs(s)))),Math.abs(i)>1&&n.push("".concat(i>0?"east":"west"," ").concat(Sd(Math.abs(i)))),n.join(", ")}(t,e)}},{key:"getResolution",value:function(){return this.view.getResolution()}},{key:"mapToScreen",value:function(t){if(!this.map)return{x:0,y:0};var e=this.map.getPixelFromCoordinate(t);return e?{x:e[0],y:e[1]}:{x:0,y:0}}},{key:"screenToMap",value:function(t){return this.map.getCoordinateFromPixel([t.x,t.y])}},{key:"isGeometryObscured",value:function(t,e){return function(t,e,i){var s=i.getTargetElement().getBoundingClientRect(),n=function(t){return vd(t)}(t),r=wd(n,4),o=r[0],a=r[1],h=r[2],l=r[3],c=[[o,a],[o,l],[h,a],[h,l]].map(function(t){return i.getPixelFromCoordinate(t)}).filter(Boolean);if(!c.length)return!1;var u=Math.min.apply(Math,Md(c.map(function(t){return t[0]}))),d=Math.max.apply(Math,Md(c.map(function(t){return t[0]}))),g=Math.min.apply(Math,Md(c.map(function(t){return t[1]}))),f=Math.max.apply(Math,Md(c.map(function(t){return t[1]}))),_=e.left-s.left,p=e.top-s.top,m=e.right-s.left,y=e.bottom-s.top;return u<m&&d>_&&g<y&&f>p}(t,e,this.map)}}],e&&Id(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i,s}()}}]);