@defra/interactive-map 0.0.40-alpha → 0.0.42-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.
- package/dist/css/index.css +1 -1
- package/dist/esm/im-core.js +1 -1
- package/dist/esm/im-shell.js +1 -1
- package/dist/umd/im-core.js +1 -1
- package/dist/umd/index.js +1 -1
- package/docs/api/button-definition.md +7 -8
- package/docs/api/control-definition.md +17 -1
- package/docs/api/panel-definition.md +5 -0
- package/docs/api/slots.md +50 -6
- package/docs/assets/images/slot-map.svg +61 -262
- package/docs/examples/add-polygons.mdx +8 -2
- package/docs/examples/add-symbols.mdx +8 -2
- package/docs/examples/draw-tools.mdx +3 -3
- package/docs/plugins/datasets.md +23 -15
- package/docs/plugins/draw.md +79 -16
- package/docs/plugins/map-key.md +147 -0
- package/docs/plugins/search.md +1 -1
- package/docs/plugins.md +5 -1
- package/govuk-prototype-kit.config.json +2 -0
- package/jest.setup.js +5 -0
- package/package.json +9 -1
- package/plugins/beta/draw-es/dist/esm/im-draw-es-plugin.js +1 -1
- package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +1 -1
- package/plugins/beta/draw-ml/dist/umd/im-draw-ml-plugin.js +1 -1
- package/plugins/beta/draw-ol/dist/esm/im-draw-ol-plugin.js +1 -1
- package/plugins/beta/map-styles/dist/umd/im-map-styles-plugin.js +1 -1
- package/plugins/beta/map-styles/dist/umd/index.js +1 -1
- package/plugins/beta/use-location/dist/esm/im-use-location-plugin.js +1 -1
- package/plugins/beta/use-location/dist/umd/im-use-location-plugin.js +1 -1
- package/plugins/beta/use-location/src/manifest.js +1 -1
- package/plugins/datasets/dist/css/index.css +1 -1
- package/plugins/datasets/dist/esm/esriLayerAdapter.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-ml-adapter.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-plugin.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-esri-adapter.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-ml-adapter.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-plugin.js +1 -1
- package/plugins/datasets/dist/umd/index.js +1 -1
- package/plugins/datasets/src/adapters/esri/esriLayerAdapter.test.js +175 -0
- package/plugins/datasets/src/adapters/esri/registry/esriDataset.test.js +55 -0
- package/plugins/datasets/src/adapters/loadLayerAdapter.test.js +61 -0
- package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.test.js +14 -0
- package/plugins/datasets/src/api/setOpacity.test.js +9 -0
- package/plugins/datasets/src/components/LayersMenu/LayersMenu.jsx +10 -25
- package/plugins/datasets/src/components/LayersMenu/LayersMenu.test.jsx +0 -42
- package/plugins/datasets/src/datasets.scss +0 -1
- package/plugins/datasets/src/fetch/createDynamicSource.js +135 -129
- package/plugins/datasets/src/fetch/createDynamicSource.test.js +318 -0
- package/plugins/datasets/src/fetch/fetchGeoJSON.test.js +83 -0
- package/plugins/datasets/src/index.test.js +36 -0
- package/plugins/datasets/src/initialise/DatasetsInit.jsx +17 -7
- package/plugins/datasets/src/initialise/DatasetsInit.test.jsx +262 -0
- package/plugins/datasets/src/initialise/initialiseDatasets.js +16 -4
- package/plugins/datasets/src/initialise/initialiseDatasets.test.js +42 -0
- package/plugins/datasets/src/manifest.js +0 -38
- package/plugins/datasets/src/manifest.test.js +49 -0
- package/plugins/datasets/src/reducers/datasetsToMenu.test.js +54 -1
- package/plugins/datasets/src/reducers/pluginState.js +3 -16
- package/plugins/datasets/src/reducers/pluginState.test.js +23 -0
- package/plugins/datasets/src/registry/dataset.js +13 -1
- package/plugins/datasets/src/registry/dataset.test.js +61 -0
- package/plugins/datasets/src/registry/datasetRegistry.js +12 -6
- package/plugins/datasets/src/registry/datasetRegistry.test.js +16 -4
- package/plugins/datasets/src/registry/isVisibleWhen.js +6 -3
- package/plugins/datasets/src/registry/isVisibleWhen.test.js +11 -1
- package/plugins/datasets/src/utils/bbox.test.js +125 -0
- package/plugins/draw/dist/esm/im-draw-ml-adapter.js +1 -1
- package/plugins/draw/dist/esm/im-draw-ol-adapter.js +1 -1
- package/plugins/draw/dist/esm/im-draw-plugin.js +1 -1
- package/plugins/draw/dist/esm/index.js +1 -1
- package/plugins/draw/dist/umd/im-draw-ml-adapter.js +2 -1
- package/plugins/draw/dist/umd/im-draw-ml-adapter.js.LICENSE.txt +1 -0
- package/plugins/draw/dist/umd/im-draw-ol-adapter.js +1 -1
- package/plugins/draw/dist/umd/im-draw-plugin.js +1 -1
- package/plugins/draw/dist/umd/index.js +1 -1
- package/plugins/draw/src/DrawInit.jsx +10 -2
- package/plugins/draw/src/DrawInit.test.jsx +51 -10
- package/plugins/draw/src/adapters/maplibre/MaplibreDrawAdapter.js +91 -11
- package/plugins/draw/src/adapters/maplibre/MaplibreDrawAdapter.test.js +246 -4
- package/plugins/draw/src/adapters/maplibre/mapboxDraw.js +109 -14
- package/plugins/draw/src/adapters/maplibre/mapboxDraw.test.js +174 -11
- package/plugins/draw/src/adapters/maplibre/modes/drawMode/clickHandlers.test.js +12 -0
- package/plugins/draw/src/adapters/maplibre/modes/drawMode/lifecycle.js +9 -1
- package/plugins/draw/src/adapters/maplibre/modes/drawMode/lifecycle.test.js +24 -3
- package/plugins/draw/src/adapters/maplibre/modes/drawPointMode.js +194 -0
- package/plugins/draw/src/adapters/maplibre/modes/drawPointMode.test.js +457 -0
- package/plugins/draw/src/adapters/maplibre/modes/editPointMode/__helpers__/harness.js +102 -0
- package/plugins/draw/src/adapters/maplibre/modes/editPointMode/keyboardHandlers.js +82 -0
- package/plugins/draw/src/adapters/maplibre/modes/editPointMode/keyboardHandlers.test.js +83 -0
- package/plugins/draw/src/adapters/maplibre/modes/editPointMode/pointOperations.js +55 -0
- package/plugins/draw/src/adapters/maplibre/modes/editPointMode/pointOperations.test.js +62 -0
- package/plugins/draw/src/adapters/maplibre/modes/editPointMode/pointerHandlers.js +138 -0
- package/plugins/draw/src/adapters/maplibre/modes/editPointMode/pointerHandlers.test.js +197 -0
- package/plugins/draw/src/adapters/maplibre/modes/editPointMode/touchHandlers.js +92 -0
- package/plugins/draw/src/adapters/maplibre/modes/editPointMode/touchHandlers.test.js +101 -0
- package/plugins/draw/src/adapters/maplibre/modes/editPointMode/undoHandlers.js +46 -0
- package/plugins/draw/src/adapters/maplibre/modes/editPointMode/undoHandlers.test.js +42 -0
- package/plugins/draw/src/adapters/maplibre/modes/editPointMode.js +151 -0
- package/plugins/draw/src/adapters/maplibre/modes/editPointMode.test.js +156 -0
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/keyboardHandlers.js +4 -27
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/keyboardHandlers.test.js +24 -39
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/pointerHandlers.js +4 -5
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/touchHandlers.js +20 -23
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/touchHandlers.test.js +25 -5
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/undoHandlers.js +6 -36
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/undoHandlers.test.js +7 -49
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/vertexOperations.js +3 -53
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/vertexOperations.test.js +8 -33
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode.js +29 -72
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode.test.js +10 -3
- package/plugins/draw/src/adapters/maplibre/pointSymbolImages.js +158 -0
- package/plugins/draw/src/adapters/maplibre/pointSymbolImages.test.js +314 -0
- package/plugins/draw/src/adapters/maplibre/snap/prototypePatches.js +6 -1
- package/plugins/draw/src/adapters/maplibre/snap/prototypePatches.test.js +21 -0
- package/plugins/draw/src/adapters/maplibre/snap/snapInstance.js +6 -2
- package/plugins/draw/src/adapters/maplibre/snap/snapInstance.test.js +12 -0
- package/plugins/draw/src/adapters/maplibre/styles.js +38 -11
- package/plugins/draw/src/adapters/maplibre/styles.test.js +39 -0
- package/plugins/draw/src/adapters/maplibre/utils/editModeEvents.js +79 -0
- package/plugins/draw/src/adapters/maplibre/utils/editModeEvents.test.js +135 -0
- package/plugins/draw/src/adapters/maplibre/utils/geometryValidation.js +42 -0
- package/plugins/draw/src/adapters/maplibre/utils/geometryValidation.test.js +85 -0
- package/plugins/draw/src/adapters/maplibre/utils/keyboardShortcuts.js +34 -0
- package/plugins/draw/src/adapters/maplibre/utils/keyboardShortcuts.test.js +78 -0
- package/plugins/draw/src/adapters/maplibre/utils/snapHelpers.js +16 -3
- package/plugins/draw/src/adapters/maplibre/utils/snapHelpers.test.js +21 -3
- package/plugins/draw/src/adapters/maplibre/utils/snapMovement.js +59 -0
- package/plugins/draw/src/adapters/maplibre/utils/snapMovement.test.js +73 -0
- package/plugins/draw/src/adapters/maplibre/utils/touchDragMath.js +33 -0
- package/plugins/draw/src/adapters/maplibre/utils/touchDragMath.test.js +70 -0
- package/plugins/draw/src/adapters/openlayers/OLDrawAdapter.js +27 -2
- package/plugins/draw/src/adapters/openlayers/OLDrawAdapter.test.js +93 -0
- package/plugins/draw/src/adapters/openlayers/__helpers__/harness.js +9 -0
- package/plugins/draw/src/adapters/openlayers/core/OLDrawManager.js +19 -1
- package/plugins/draw/src/adapters/openlayers/core/OLDrawManager.test.js +34 -1
- package/plugins/draw/src/adapters/openlayers/core/styles.js +73 -1
- package/plugins/draw/src/adapters/openlayers/core/styles.test.js +122 -3
- package/plugins/draw/src/adapters/openlayers/draw/DrawMode.test.js +12 -0
- package/plugins/draw/src/adapters/openlayers/draw/drawInput.js +8 -2
- package/plugins/draw/src/adapters/openlayers/edit/EditMode.test.js +31 -0
- package/plugins/draw/src/adapters/openlayers/edit/keyboardHandler.js +9 -5
- package/plugins/draw/src/adapters/openlayers/edit/keyboardHandler.test.js +33 -0
- package/plugins/draw/src/adapters/openlayers/edit/modifyInteraction.js +5 -3
- package/plugins/draw/src/adapters/openlayers/edit/modifyInteraction.test.js +11 -0
- package/plugins/draw/src/adapters/openlayers/edit/nudge.js +10 -3
- package/plugins/draw/src/adapters/openlayers/edit/nudge.test.js +24 -1
- package/plugins/draw/src/adapters/openlayers/edit/touchHandler.js +18 -13
- package/plugins/draw/src/adapters/openlayers/edit/touchHandler.test.js +46 -1
- package/plugins/draw/src/adapters/openlayers/olDraw.js +11 -4
- package/plugins/draw/src/adapters/openlayers/olDraw.test.js +48 -6
- package/plugins/draw/src/adapters/openlayers/point/drawPointMode.js +156 -0
- package/plugins/draw/src/adapters/openlayers/point/drawPointMode.test.js +246 -0
- package/plugins/draw/src/adapters/openlayers/point/editPointMode.js +267 -0
- package/plugins/draw/src/adapters/openlayers/point/editPointMode.test.js +327 -0
- package/plugins/draw/src/adapters/openlayers/point/pointDragInteraction.js +71 -0
- package/plugins/draw/src/adapters/openlayers/point/pointOps.js +34 -0
- package/plugins/draw/src/adapters/openlayers/point/pointOps.test.js +32 -0
- package/plugins/draw/src/adapters/openlayers/point/pointSelectionState.js +82 -0
- package/plugins/draw/src/adapters/openlayers/point/pointSelectionState.test.js +107 -0
- package/plugins/draw/src/adapters/openlayers/point/pointSymbolImages.js +83 -0
- package/plugins/draw/src/adapters/openlayers/point/pointSymbolImages.test.js +214 -0
- package/plugins/draw/src/adapters/openlayers/snap/snapIndicator.js +3 -1
- package/plugins/draw/src/adapters/openlayers/snap/snapInteraction.js +6 -9
- package/plugins/draw/src/adapters/openlayers/snap/snapInteraction.test.js +15 -4
- package/plugins/draw/src/adapters/openlayers/utils/olCoords.js +1 -1
- package/plugins/draw/src/api/addFeature.js +16 -1
- package/plugins/draw/src/api/addFeature.test.js +62 -5
- package/plugins/draw/src/api/createNewShape.js +41 -0
- package/plugins/draw/src/api/createNewShape.test.js +63 -0
- package/plugins/draw/src/api/editFeature.js +7 -4
- package/plugins/draw/src/api/editFeature.test.js +16 -0
- package/plugins/draw/src/api/newLine.js +2 -40
- package/plugins/draw/src/api/newPoint.js +42 -0
- package/plugins/draw/src/api/newPoint.test.js +117 -0
- package/plugins/draw/src/api/newPolygon.js +2 -40
- package/plugins/draw/src/api/setStyle.js +43 -0
- package/plugins/draw/src/api/setStyle.test.js +75 -0
- package/plugins/draw/src/events.js +17 -10
- package/plugins/draw/src/events.test.js +14 -0
- package/plugins/draw/src/manifest.js +18 -6
- package/plugins/draw/src/manifest.test.js +32 -1
- package/plugins/draw/src/reducer.test.js +7 -0
- package/plugins/draw/src/utils/stripInternalProperties.js +19 -0
- package/plugins/draw/src/utils/stripInternalProperties.test.js +50 -0
- package/plugins/draw/src/utils/symbolKeys.js +5 -0
- package/plugins/draw/src/validation/liveDrawChecks.test.js +54 -0
- package/plugins/draw/src/validation/liveStroke.test.js +64 -1
- package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/umd/index.js +1 -1
- package/plugins/interact/src/hooks/useHighlightSync.js +33 -12
- package/plugins/interact/src/hooks/useHighlightSync.test.js +96 -25
- package/plugins/interact/src/manifest.js +1 -1
- package/plugins/interact/src/utils/featureQueries.js +18 -0
- package/plugins/interact/src/utils/featureQueries.test.js +15 -0
- package/plugins/interact/src/utils/spatial.js +9 -3
- package/plugins/interact/src/utils/spatial.test.js +12 -1
- package/plugins/map-key/dist/css/index.css +68 -0
- package/plugins/map-key/dist/esm/im-map-key-plugin.js +1 -0
- package/plugins/map-key/dist/esm/index.js +1 -0
- package/plugins/map-key/dist/umd/im-map-key-plugin.js +2 -0
- package/plugins/map-key/dist/umd/im-map-key-plugin.js.LICENSE.txt +1 -0
- package/plugins/map-key/dist/umd/index.js +2 -0
- package/plugins/map-key/dist/umd/index.js.LICENSE.txt +1 -0
- package/plugins/map-key/package.json +28 -0
- package/plugins/map-key/src/components/Key/EmptyKey.jsx +7 -0
- package/plugins/{datasets → map-key}/src/components/Key/EmptyKey.test.jsx +2 -2
- package/plugins/map-key/src/components/Key/Key.jsx +43 -0
- package/plugins/{datasets → map-key}/src/components/Key/Key.module.scss +21 -14
- package/plugins/map-key/src/components/Key/Key.test.jsx +73 -0
- package/plugins/map-key/src/components/Key/KeyGroupItem.jsx +16 -0
- package/plugins/map-key/src/components/Key/KeyGroupItem.test.jsx +53 -0
- package/plugins/map-key/src/components/Key/KeyItem.jsx +26 -0
- package/plugins/map-key/src/components/Key/KeyItem.test.jsx +67 -0
- package/plugins/map-key/src/components/Key/KeySvg.jsx +41 -0
- package/plugins/{datasets → map-key}/src/components/Key/KeySvg.test.jsx +14 -12
- package/plugins/map-key/src/components/Key/KeySvgLine.jsx +22 -0
- package/plugins/{datasets → map-key}/src/components/Key/KeySvgLine.test.jsx +1 -1
- package/plugins/{datasets → map-key}/src/components/Key/KeySvgPattern.jsx +7 -2
- package/plugins/{datasets → map-key}/src/components/Key/KeySvgPattern.test.jsx +8 -2
- package/plugins/map-key/src/components/Key/KeySvgRect.jsx +26 -0
- package/plugins/{datasets → map-key}/src/components/Key/KeySvgRect.test.jsx +1 -1
- package/plugins/{datasets → map-key}/src/components/Key/KeySvgSymbol.jsx +8 -3
- package/plugins/{datasets → map-key}/src/components/Key/KeySvgSymbol.test.jsx +17 -6
- package/plugins/map-key/src/components/Key/MapKey.jsx +53 -0
- package/plugins/map-key/src/components/Key/MapKey.test.jsx +147 -0
- package/plugins/{datasets → map-key}/src/components/Key/svgProperties.js +2 -2
- package/plugins/{datasets → map-key}/src/components/Key/svgProperties.test.js +2 -2
- package/plugins/map-key/src/index.js +13 -0
- package/plugins/map-key/src/index.test.js +31 -0
- package/plugins/map-key/src/initialise/MapKeyInit.jsx +15 -0
- package/plugins/map-key/src/initialise/MapKeyInit.test.jsx +39 -0
- package/plugins/map-key/src/manifest.js +30 -0
- package/plugins/map-key/src/manifest.test.js +63 -0
- package/plugins/map-key/src/mapKey.scss +4 -0
- package/plugins/map-key/src/registry/getDatasetRegistry.js +6 -0
- package/plugins/map-key/src/registry/getDatasetRegistry.test.js +23 -0
- package/plugins/map-key/src/registry/index.js +3 -0
- package/plugins/map-key/src/registry/index.test.js +15 -0
- package/plugins/menu/dist/css/index.css +80 -0
- package/plugins/menu/dist/esm/im-menu-plugin.js +1 -0
- package/plugins/menu/dist/esm/index.js +1 -0
- package/plugins/menu/dist/umd/im-menu-plugin.js +1 -0
- package/plugins/menu/dist/umd/index.js +2 -0
- package/plugins/menu/dist/umd/index.js.LICENSE.txt +1 -0
- package/plugins/menu/package.json +28 -0
- package/plugins/menu/src/components/Menu/CheckboxGroupWrapper.jsx +21 -0
- package/plugins/menu/src/components/Menu/GroupLegend.jsx +17 -0
- package/plugins/menu/src/components/Menu/GroupLegend.test.jsx +68 -0
- package/plugins/menu/src/components/Menu/Menu.jsx +19 -0
- package/plugins/menu/src/components/Menu/Menu.module.scss +90 -0
- package/plugins/menu/src/components/Menu/Menu.test.jsx +161 -0
- package/plugins/menu/src/components/Menu/MenuCheckbox.jsx +35 -0
- package/plugins/menu/src/components/Menu/MenuCheckbox.test.jsx +93 -0
- package/plugins/menu/src/components/Menu/MenuGroup.jsx +11 -0
- package/plugins/{datasets/src/components/LayersMenu/LayersMenuRadio.jsx → menu/src/components/Menu/MenuRadio.jsx} +6 -4
- package/plugins/{datasets/src/components/LayersMenu/LayersMenuRadio.test.jsx → menu/src/components/Menu/MenuRadio.test.jsx} +18 -18
- package/plugins/menu/src/components/Menu/RadioGroupWrapper.jsx +32 -0
- package/plugins/{datasets/src/components/LayersMenu/LayersRadioGroupWrapper.test.jsx → menu/src/components/Menu/RadioGroupWrapper.test.jsx} +21 -21
- package/plugins/menu/src/components/Menu/useIdPrefix.jsx +4 -0
- package/plugins/menu/src/index.js +13 -0
- package/plugins/menu/src/index.test.js +31 -0
- package/plugins/menu/src/initialise/MenuInit.jsx +24 -0
- package/plugins/menu/src/initialise/MenuInit.test.jsx +50 -0
- package/plugins/menu/src/initialise/createMenu.js +10 -0
- package/plugins/menu/src/initialise/createMenu.test.js +37 -0
- package/plugins/menu/src/manifest.js +35 -0
- package/plugins/menu/src/manifest.test.js +63 -0
- package/plugins/menu/src/menu.scss +4 -0
- package/plugins/menu/src/reducers/menuStateReducer.test.js +38 -0
- package/plugins/menu/src/reducers/pluginState.js +35 -0
- package/plugins/menu/src/reducers/pluginState.test.js +57 -0
- package/plugins/menu/src/registry/getDatasetRegistry.js +9 -0
- package/plugins/menu/src/registry/getDatasetRegistry.test.js +23 -0
- package/plugins/menu/src/registry/index.js +3 -0
- package/plugins/menu/src/registry/index.test.js +15 -0
- package/plugins/menu/src/registry/isVisibleWhen.js +43 -0
- package/plugins/menu/src/registry/isVisibleWhen.test.js +48 -0
- package/plugins/search/dist/css/index.css +1 -1
- package/plugins/search/dist/esm/im-search-plugin.js +1 -1
- package/plugins/search/dist/esm/index.js +1 -1
- package/plugins/search/dist/umd/im-search-plugin.js +1 -1
- package/plugins/search/dist/umd/index.js +1 -1
- package/plugins/search/src/Search.jsx +2 -3
- package/plugins/search/src/components/Form/Form.module.scss +9 -20
- package/plugins/search/src/index.js +0 -1
- package/plugins/search/src/index.test.js +2 -4
- package/plugins/search/src/manifest.js +1 -1
- package/plugins/search/src/search.scss +17 -16
- package/providers/beta/openlayers/dist/esm/im-openlayers-provider.js +1 -1
- package/providers/beta/openlayers/dist/umd/im-openlayers-provider.js +1 -1
- package/providers/beta/openlayers/dist/umd/index.js +1 -1
- package/providers/beta/openlayers/src/openlayersProvider.js +4 -1
- package/providers/beta/openlayers/src/openlayersProvider.test.js +18 -0
- package/providers/beta/openlayers/src/utils/highlightFeatures.js +52 -5
- package/providers/beta/openlayers/src/utils/highlightFeatures.test.js +176 -0
- package/providers/beta/openlayers/src/utils/symbolImages.js +40 -0
- package/providers/beta/openlayers/src/utils/symbolImages.test.js +58 -0
- package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
- package/providers/maplibre/dist/umd/index.js +1 -1
- package/providers/maplibre/src/utils/drawLayerBuckets.js +14 -0
- package/providers/maplibre/src/utils/drawLayerBuckets.test.js +18 -0
- package/providers/maplibre/src/utils/highlightFeatures.js +80 -55
- package/providers/maplibre/src/utils/highlightFeatures.test.js +156 -17
- package/providers/maplibre/src/utils/hoverCursor.js +30 -14
- package/providers/maplibre/src/utils/hoverCursor.test.js +35 -0
- package/providers/maplibre/src/utils/patternImages.js +1 -1
- package/providers/maplibre/src/utils/symbolImages.js +41 -3
- package/providers/maplibre/src/utils/symbolImages.test.js +40 -6
- package/rollup.esm.mjs +11 -1
- package/src/App/components/Actions/Actions.test.jsx +47 -0
- package/src/App/components/Hints/Hints.test.jsx +13 -0
- package/src/App/components/KeyboardHelp/KeyboardHelp.jsx +25 -23
- package/src/App/components/KeyboardHelp/KeyboardHelp.test.jsx +22 -5
- package/src/App/components/MoveControls/MoveControls.module.scss +41 -10
- package/src/App/components/Panel/Panel.jsx +65 -8
- package/src/App/components/Panel/Panel.module.scss +49 -15
- package/src/App/components/Panel/Panel.test.jsx +114 -1
- package/src/App/components/Tabs/Tabs.jsx +43 -17
- package/src/App/components/Tabs/Tabs.module.scss +32 -5
- package/src/App/components/Tabs/Tabs.test.jsx +40 -10
- package/src/App/components/Tooltip/Tooltip.test.jsx +12 -14
- package/src/App/hooks/useFeatureItems.js +16 -7
- package/src/App/hooks/useFeatureItems.test.js +57 -0
- package/src/App/hooks/useLayoutMeasurements.js +95 -84
- package/src/App/hooks/useLayoutMeasurements.test.js +61 -1
- package/src/App/layout/Layout.jsx +9 -10
- package/src/App/layout/Layout.test.jsx +2 -0
- package/src/App/layout/layout.module.scss +31 -17
- package/src/App/registry/pluginRegistry.js +1 -1
- package/src/App/registry/pluginRegistry.test.js +12 -0
- package/src/App/renderer/HtmlElementHost.jsx +18 -5
- package/src/App/renderer/HtmlElementHost.test.jsx +54 -0
- package/src/App/renderer/groupByKey.js +28 -0
- package/src/App/renderer/groupByKey.test.js +39 -0
- package/src/App/renderer/groupIntoTabs.js +42 -0
- package/src/App/renderer/groupIntoTabs.test.js +95 -0
- package/src/App/renderer/mapButtons.js +97 -129
- package/src/App/renderer/mapButtons.test.js +67 -83
- package/src/App/renderer/mapControls.js +4 -1
- package/src/App/renderer/mapControls.test.js +32 -0
- package/src/App/renderer/mapPanels.js +53 -11
- package/src/App/renderer/mapPanels.test.js +95 -2
- package/src/App/renderer/orderItems.js +28 -0
- package/src/App/renderer/orderItems.test.js +50 -0
- package/src/App/renderer/slotAggregator.js +2 -18
- package/src/App/renderer/slotHelpers.js +3 -1
- package/src/App/renderer/slotHelpers.test.js +5 -0
- package/src/App/renderer/slots.js +3 -0
- package/src/App/store/AppProvider.jsx +1 -0
- package/src/App/store/appDispatchMiddleware.js +1 -1
- package/src/App/store/appDispatchMiddleware.test.js +8 -0
- package/src/config/appConfig.js +2 -2
- package/src/config/events.js +2 -0
- package/src/scss/settings/_colors.scss +1 -0
- package/src/scss/settings/_dimensions.scss +2 -3
- package/src/scss/settings/_transition.scss +1 -1
- package/src/services/eventBus.js +44 -0
- package/src/services/eventBus.test.js +83 -0
- package/src/services/symbolRegistry.js +1 -1
- package/src/types.js +31 -3
- package/webpack.umd.mjs +2 -0
- package/plugins/datasets/src/components/Key/EmptyKey.jsx +0 -7
- package/plugins/datasets/src/components/Key/Key.jsx +0 -50
- package/plugins/datasets/src/components/Key/KeyGroupItem.jsx +0 -18
- package/plugins/datasets/src/components/Key/KeyItem.jsx +0 -23
- package/plugins/datasets/src/components/Key/KeySvg.jsx +0 -22
- package/plugins/datasets/src/components/Key/KeySvgLine.jsx +0 -19
- package/plugins/datasets/src/components/Key/KeySvgRect.jsx +0 -22
- package/plugins/datasets/src/components/LayersMenu/LayersRadioGroupWrapper.jsx +0 -41
- /package/plugins/{datasets → menu}/src/reducers/menuStateReducer.js +0 -0
- /package/{providers/maplibre/src → src}/utils/rasteriseToImageData.js +0 -0
- /package/{providers/maplibre/src → src}/utils/rasteriseToImageData.test.js +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see im-openlayers-provider.js.LICENSE.txt */
|
|
2
|
-
"use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[142],{480(t,e,i){function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function r(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,s(n.key),n)}}function s(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}i.r(e),i.d(e,{default:()=>Gb});var o=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},(e=[{key:"isBaseMapReady",value:function(){throw new Error(this.name+" must implement isBaseMapReady()")}}])&&r(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();const a="add",l="remove",h="propertychange";function u(t){for(const e in t)delete t[e]}function c(t){let e;for(e in t)return!1;return!e}function d(t,e,i,n,r){if(r){const r=i;i=function(s){return t.removeEventListener(e,i),r.call(n??this,s)}}else n&&n!==t&&(i=i.bind(n));const s={target:t,type:e,listener:i};return t.addEventListener(e,i),s}function f(t,e,i,n){return d(t,e,i,n,!0)}function p(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),u(t))}const g="change",m="contextmenu",y="click",_="keydown",v="keypress",x="touchmove",w="wheel",b=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function S(t,e){return t>e?1:t<e?-1:0}function M(t,e){return t<e?1:t>e?-1:0}function E(t,e,i){if(t[0]<=e)return 0;const n=t.length;if(e<=t[n-1])return n-1;if("function"==typeof i){for(let r=1;r<n;++r){const n=t[r];if(n===e)return r;if(n<e)return i(e,t[r-1],n)>0?r-1:r}return n-1}if(i>0){for(let i=1;i<n;++i)if(t[i]<e)return i-1;return n-1}if(i<0){for(let i=1;i<n;++i)if(t[i]<=e)return i;return n-1}for(let i=1;i<n;++i){if(t[i]==e)return i;if(t[i]<e)return t[i-1]-e<e-t[i]?i-1:i}return n-1}function C(t,e,i){for(;e<i;){const n=t[e];t[e]=t[i],t[i]=n,++e,--i}}function P(t,e){const i=Array.isArray(e)?e:[e],n=i.length;for(let e=0;e<n;e++)t[t.length]=i[e]}function I(t,e){const i=t.length;if(i!==e.length)return!1;for(let n=0;n<i;n++)if(t[n]!==e[n])return!1;return!0}function T(){return!0}function R(){return!1}function k(){}function A(t){let e,i,n;return function(){const r=Array.prototype.slice.call(arguments);return i&&this===n&&I(r,i)||(n=this,i=r,e=t.apply(this,arguments)),e}}function G(t){return function(){let e;try{e=t()}catch(t){return Promise.reject(t)}return e instanceof Promise?e:Promise.resolve(e)}()}const O=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},F=class extends b{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e="string"==typeof t,i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const r=e?new O(t):t;r.target||(r.target=this.eventTarget_||this);const s=this.dispatching_||(this.dispatching_={}),o=this.pendingRemovals_||(this.pendingRemovals_={});let a;i in s||(s[i]=0,o[i]=0),++s[i];for(let t=0,e=n.length;t<e;++t)if(a="handleEvent"in n[t]?n[t].handleEvent(r):n[t].call(this,r),!1===a||r.propagationStopped){a=!1;break}if(0===--s[i]){let t=o[i];for(delete o[i];t--;)this.removeEventListener(i,k);delete s[i]}return a}disposeInternal(){this.listeners_&&u(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return!!this.listeners_&&(t?t in this.listeners_:Object.keys(this.listeners_).length>0)}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=k,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}};class L extends F{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(g)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=d(this,t[r],e);return n}return d(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const n=t.length;i=new Array(n);for(let r=0;r<n;++r)i[r]=f(this,t[r],e)}else i=f(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)p(t[e]);else p(t)}(i);else if(Array.isArray(t))for(let i=0,n=t.length;i<n;++i)this.removeEventListener(t[i],e);else this.removeEventListener(t,e)}}L.prototype.on,L.prototype.once,L.prototype.un;const j=L;function N(){throw new Error("Unimplemented abstract method.")}let D=0;function z(t){return t.ol_uid||(t.ol_uid=String(++D))}class q extends O{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}const $=class extends j{constructor(t){super(),this.on,this.once,this.un,z(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 q(i,t,e)),i=h,this.hasListener(i)&&this.dispatchEvent(new q(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const n=this.values_||(this.values_={});if(i)n[t]=e;else{const i=n[t];n[t]=e,i!==e&&this.notify(t,i)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],c(this.values_)&&(this.values_=null),e||this.notify(t,i)}}},B="length";class U extends O{constructor(t,e,i){super(t),this.element=e,this.index=i}}const W=class extends ${constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t??[],this.unique_)for(let t=1,e=this.array_.length;t<e;++t)this.assertUnique_(this.array_[t],t);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(B)}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 U(a,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new U(l,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 U(l,i,t)),this.dispatchEvent(new U(a,e,t))}updateLength_(){this.set(B,this.array_.length)}assertUnique_(t,e){const i=this.array_;for(let n=0,r=i.length;n<r;++n)if(i[n]===t&&n!==e)throw new Error("Duplicate item added to a unique collection")}},X=class extends O{constructor(t,e,i){super(t),this.map=e,this.frameState=void 0!==i?i:null}},V=class extends X{constructor(t,e,i,n,r,s){super(t,e,r),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=void 0!==n&&n,this.activePointers=s}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()}},K={SINGLECLICK:"singleclick",CLICK:y,DBLCLICK:"dblclick",POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Y="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",Z=(Y.includes("safari")&&!Y.includes("chrom")&&(Y.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(Y)),Y.includes("webkit")&&!Y.includes("edge")),H=Y.includes("macintosh"),J="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,Q="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,tt="undefined"!=typeof Image&&Image.prototype.decode,et=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}(),it="pointerdown",nt=class extends F{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_=d(i,it,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=d(i,"pointermove",this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(x,this.boundHandleTouchMove_,!!et&&{passive:!1})}emulateClick_(t){let e=new V(K.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new V(K.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const e=new V(K.SINGLECLICK,this.map_,t);this.dispatchEvent(e)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==K.POINTERUP||e.type==K.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!=K.POINTERDOWN&&e.type!=K.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new V(K.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(p),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 V(K.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(d(t,K.POINTERMOVE,this.handlePointerMove_,this),d(t,K.POINTERUP,this.handlePointerUp_,this),d(this.element_,K.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==t&&this.dragListenerKeys_.push(d(this.element_.getRootNode(),K.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new V(K.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 V(K.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_&&(p(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(x,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(p(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(p),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},rt="postrender",st="loadstart",ot="loadend",at="layergroup",lt="size",ht="target",ut="view";function ct(t,e){if(!t)throw new Error(e)}const dt=1/0,ft=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,u(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 n=this.keyFunction_(i);return delete this.queuedElements_[n],i}enqueue(t){ct(!(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!=dt&&(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_,n=e.length,r=e[t],s=i[t],o=t;for(;t<n>>1;){const r=this.getLeftChildIndex_(t),s=this.getRightChildIndex_(t),o=s<n&&i[s]<i[r]?s:r;e[t]=e[o],i[t]=i[o],t=o}e[t]=r,i[t]=s,this.siftDown_(o,t)}siftDown_(t,e){const i=this.elements_,n=this.priorities_,r=i[e],s=n[e];for(;e>t;){const t=this.getParentIndex_(e);if(!(n[t]>s))break;i[e]=i[t],n[e]=n[t],e=t}i[e]=r,n[e]=s}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const r=e.length;let s,o,a;for(o=0;o<r;++o)s=e[o],a=t(s),a==dt?delete this.queuedElements_[this.keyFunction_(s)]:(i[n]=a,e[n++]=s);e.length=n,i.length=n,this.heapify_()}},pt=class extends ft{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(g,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(g,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())}}},gt={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function mt(t,e,i){return Math.min(Math.max(t,e),i)}function yt(t,e,i,n,r,s){const o=r-i,a=s-n;if(0!==o||0!==a){const l=((t-i)*o+(e-n)*a)/(o*o+a*a);l>1?(i=r,n=s):l>0&&(i+=o*l,n+=a*l)}return _t(t,e,i,n)}function _t(t,e,i,n){const r=i-t,s=n-e;return r*r+s*s}function vt(t){return 180*t/Math.PI}function xt(t){return t*Math.PI/180}function wt(t,e){const i=t%e;return i*e<0?i+e:i}function bt(t,e,i){return t+i*(e-t)}function St(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function Mt(t,e){return Math.round(St(t,e))}function Et(t,e){return Math.floor(St(t,e))}function Ct(t,e){return Math.ceil(St(t,e))}function Pt(t,e,i){if(t>=e&&t<i)return t;const n=i-e;return((t-e)%n+n)%n+e}function It(t,e,i){return function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;const l=e?0:s[0]*r,h=e?0:s[1]*r,u=a?a[0]:0,c=a?a[1]:0;let d=t[0]+l/2+u,f=t[2]-l/2+u,p=t[1]+h/2+c,g=t[3]-h/2+c;d>f&&(d=(f+d)/2,f=d),p>g&&(p=(g+p)/2,g=p);let m=mt(n[0],d,f),y=mt(n[1],p,g);if(o&&i&&r){const t=30*r;m+=-t*Math.log(1+Math.max(0,d-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-f)/t),y+=-t*Math.log(1+Math.max(0,p-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-g)/t)}return[m,y]}}function Tt(t){return t}function Rt(t){const e=[1/0,1/0,-1/0,-1/0];for(let i=0,n=t.length;i<n;++i)Ut(e,t[i]);return e}function kt(t,e,i){return i?(i[0]=t[0]-e,i[1]=t[1]-e,i[2]=t[2]+e,i[3]=t[3]+e,i):[t[0]-e,t[1]-e,t[2]+e,t[3]+e]}function At(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t.slice()}function Gt(t,e,i){let n,r;return n=e<t[0]?t[0]-e:t[2]<e?e-t[2]:0,r=i<t[1]?t[1]-i:t[3]<i?i-t[3]:0,n*n+r*r}function Ot(t,e){return Lt(t,e[0],e[1])}function Ft(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function Lt(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function jt(t,e){const i=t[0],n=t[1],r=t[2],s=t[3],o=e[0],a=e[1];let l=0;return o<i?l|=16:o>r&&(l|=4),a<n?l|=8:a>s&&(l|=2),0===l&&(l=1),l}function Nt(t,e,i,n,r){return r?(r[0]=t,r[1]=e,r[2]=i,r[3]=n,r):[t,e,i,n]}function Dt(t){return Nt(1/0,1/0,-1/0,-1/0,t)}function zt(t,e){const i=t[0],n=t[1];return Nt(i,n,i,n,e)}function qt(t,e,i,n,r){return Wt(Dt(r),t,e,i,n)}function $t(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function Bt(t,e){return e[0]<t[0]&&(t[0]=e[0]),e[2]>t[2]&&(t[2]=e[2]),e[1]<t[1]&&(t[1]=e[1]),e[3]>t[3]&&(t[3]=e[3]),t}function Ut(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 Wt(t,e,i,n,r){for(;i<n;i+=r)Xt(t,e[i],e[i+1]);return t}function Xt(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 Vt(t,e){let i;return i=e(Yt(t)),i||(i=e(Zt(t)),i||(i=e(re(t)),i||(i=e(ne(t)),i||!1)))}function Kt(t){let e=0;return ae(t)||(e=se(t)*ee(t)),e}function Yt(t){return[t[0],t[1]]}function Zt(t){return[t[2],t[1]]}function Ht(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function Jt(t,e){let i;if("bottom-left"===e)i=Yt(t);else if("bottom-right"===e)i=Zt(t);else if("top-left"===e)i=ne(t);else{if("top-right"!==e)throw new Error("Invalid corner");i=re(t)}return i}function Qt(t,e,i,n,r){const[s,o,a,l,h,u,c,d]=te(t,e,i,n);return Nt(Math.min(s,a,h,c),Math.min(o,l,u,d),Math.max(s,a,h,c),Math.max(o,l,u,d),r)}function te(t,e,i,n){const r=e*n[0]/2,s=e*n[1]/2,o=Math.cos(i),a=Math.sin(i),l=r*o,h=r*a,u=s*o,c=s*a,d=t[0],f=t[1];return[d-l+c,f-h-u,d-l-c,f-h+u,d+l-c,f+h+u,d+l+c,f+h-u,d-l+c,f-h-u]}function ee(t){return t[3]-t[1]}function ie(t,e,i){const n=i||[1/0,1/0,-1/0,-1/0];return oe(t,e)?(t[0]>e[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]<e[2]?n[2]=t[2]:n[2]=e[2],t[3]<e[3]?n[3]=t[3]:n[3]=e[3]):Dt(n),n}function ne(t){return[t[0],t[3]]}function re(t){return[t[2],t[3]]}function se(t){return t[2]-t[0]}function oe(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function ae(t){return t[2]<t[0]||t[3]<t[1]}function le(t,e){const i=e.getExtent(),n=Ht(t);if(e.canWrapX()&&(n[0]<i[0]||n[0]>=i[2])){const e=se(i),r=Math.floor((n[0]-i[0])/e)*e;t[0]-=r,t[2]-=r}return t}function he(t,e,i){if(e.canWrapX()){const n=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[n[0],t[1],n[2],t[3]]];le(t,e);const r=se(n);if(se(t)>r&&!i)return[[n[0],t[1],n[2],t[3]]];if(t[0]<n[0])return[[t[0]+r,t[1],n[2],t[3]],[n[0],t[1],t[2],t[3]]];if(t[2]>n[2])return[[t[0],t[1],n[2],t[3]],[n[0],t[1],t[2]-r,t[3]]]}return[t]}function ue(t,e){let i=!0;for(let n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function ce(t,e){const i=Math.cos(e),n=Math.sin(e),r=t[0]*i-t[1]*n,s=t[1]*i+t[0]*n;return t[0]=r,t[1]=s,t}function de(t,e){if(e.canWrapX()){const i=se(e.getExtent()),n=fe(t,e,i);n&&(t[0]-=n*i)}return t}function fe(t,e,i){const n=e.getExtent();let r=0;return e.canWrapX()&&(t[0]<n[0]||t[0]>n[2])&&(i=i||se(n),r=Math.floor((t[0]-n[0])/i)),r}function pe(t){return Math.pow(t,3)}function ge(t){return 1-pe(1-t)}function me(t){return 3*t*t-2*t*t*t}function ye(t){return t}const _e=2,ve=3;let xe=1;function we(...t){xe>_e||console.warn(...t)}function be(...t){xe>ve||console.error(...t)}const Se={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937},Me=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||Se[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_}},Ee=6378137,Ce=Math.PI*Ee,Pe=[-Ce,-Ce,Ce,Ce],Ie=[-180,-85,180,85],Te=Ee*Math.log(Math.tan(Math.PI/2));class Re extends Me{constructor(t){super({code:t,units:"m",extent:Pe,global:!0,worldExtent:Ie,getPointResolution:function(t,e){return t/Math.cosh(e[1]/Ee)}})}}const ke=[new Re("EPSG:3857"),new Re("EPSG:102100"),new Re("EPSG:102113"),new Re("EPSG:900913"),new Re("http://www.opengis.net/def/crs/EPSG/0/3857"),new Re("http://www.opengis.net/gml/srs/epsg.xml#3857")];const Ae=[-180,-90,180,90],Ge=6378137*Math.PI/180;class Oe extends Me{constructor(t,e){super({code:t,units:"degrees",extent:Ae,axisOrientation:e,global:!0,metersPerUnit:Ge,worldExtent:Ae})}}const Fe=[new Oe("CRS:84"),new Oe("EPSG:4326","neu"),new Oe("urn:ogc:def:crs:OGC:1.3:CRS84"),new Oe("urn:ogc:def:crs:OGC:2:84"),new Oe("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Oe("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Oe("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Le={};function je(t){return Le[t]||Le[t.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}let Ne={};function De(t,e,i){const n=t.getCode(),r=e.getCode();n in Ne||(Ne[n]={}),Ne[n][r]=i}function ze(t,e){return t in Ne&&e in Ne[t]?Ne[t][e]:null}const qe=.9996,$e=.00669438,Be=$e*$e,Ue=Be*$e,We=$e/(1-$e),Xe=Math.sqrt(1-$e),Ve=(1-Xe)/(1+Xe),Ke=Ve*Ve,Ye=Ke*Ve,Ze=Ye*Ve,He=Ze*Ve,Je=.9983242984503243,Qe=15*Be/256+45*Ue/1024,ti=35*Ue/3072,ei=1.5*Ve-27/32*Ye+269/512*He,ii=21/16*Ke-55/32*Ze,ni=151/96*Ye-417/128*He,ri=1097/512*Ze,si=6378137;function oi(t,e,i){const n=t-5e5,r=(i.north?e:e-1e7)/qe/(si*Je),s=r+ei*Math.sin(2*r)+ii*Math.sin(4*r)+ni*Math.sin(6*r)+ri*Math.sin(8*r),o=Math.sin(s),a=o*o,l=Math.cos(s),h=o/l,u=h*h,c=u*u,d=1-$e*a,f=Math.sqrt(1-$e*a),p=We*l**2,g=p*p,m=n/(si/f*qe),y=m*m,_=y*m,v=_*m,x=v*m,w=s-h/((1-$e)/d)*(y/2-v/24*(5+3*u+10*p-4*g-9*We))+x*m/720*(61+90*u+298*p+45*c-252*We-3*g);let b=(m-_/6*(1+2*u+p)+x/120*(5-2*p+28*u-3*g+8*We+24*c))/l;return b=Pt(b+xt(li(i.number)),-Math.PI,Math.PI),[vt(b),vt(w)]}function ai(t,e,i){t=Pt(t,-180,180),e<-80?e=-80:e>84&&(e=84);const n=xt(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,h=xt(t),u=xt(li(i.number)),c=si/Math.sqrt(1-$e*r**2),d=We*s**2,f=s*Pt(h-u,-Math.PI,Math.PI),p=f*f,g=p*f,m=g*f,y=m*f,_=y*f,v=si*(Je*n-.002514607064228144*Math.sin(2*n)+Qe*Math.sin(4*n)-ti*Math.sin(6*n)),x=qe*c*(f+g/6*(1-a+d)+y/120*(5-18*a+l+72*d-58*We))+5e5;let w=qe*(v+c*o*(p/2+m/24*(5-a+9*d+4*d**2)+_/720*(61-58*a+l+600*d-330*We)));return i.north||(w+=1e7),[x,w]}function li(t){return 6*(t-1)-180+3}const hi=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function ui(t){let e=0;for(const i of hi){const n=t.match(i);if(n){e=parseInt(n[1]);break}}if(!e)return null;let i=0,n=!1;return e>32700&&e<32761?i=e-32700:e>32600&&e<32661&&(n=!0,i=e-32600),i?{number:i,north:n}:null}function ci(t,e){return function(i,n,r,s){const o=i.length;r=r>1?r:2,s=s??r,n||(n=r>2?i.slice():new Array(o));for(let r=0;r<o;r+=s){const s=i[r],o=i[r+1],a=t(s,o,e);n[r]=a[0],n[r+1]=a[1]}return n}}function di(t,e,i){i=i||6371008.8;const n=xt(t[1]),r=xt(e[1]),s=(r-n)/2,o=xt(e[0]-t[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(r);return 2*i*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}const fi=[function(t){const e=ui(t.getCode());return e?{forward:ci(ai,e),inverse:ci(oi,e)}:null}],pi=[function(t){return ui(t)?new Me({code:t,units:"m"}):null}];let gi=!0;function mi(t,e){if(void 0!==e)for(let i=0,n=t.length;i<n;++i)e[i]=t[i];else e=t.slice();return e}function yi(t){!function(t,e){Le[t]=e}(t.getCode(),t),De(t,t,mi)}function _i(t){if("string"!=typeof t)return t;const e=je(t);if(e)return e;for(const e of pi){const i=e(t);if(i)return i}return null}function vi(t,e,i,n){let r;const s=(t=_i(t)).getPointResolutionFunc();if(s){if(r=s(e,i),n&&n!==t.getUnits()){const e=t.getMetersPerUnit();e&&(r=r*e/Se[n])}}else{const s=t.getUnits();if("degrees"==s&&!n||"degrees"==n)r=e;else{const o=Ei(t,_i("EPSG:4326"));if(o||"degrees"===s){let t=[i[0]-e/2,i[1],i[0]+e/2,i[1],i[0],i[1]-e/2,i[0],i[1]+e/2];t=o(t,t,2),r=(di(t.slice(0,2),t.slice(2,4))+di(t.slice(4,6),t.slice(6,8)))/2}else r=e*t.getMetersPerUnit();const a=n?Se[n]:t.getMetersPerUnit();void 0!==a&&(r/=a)}}return r}function xi(t){!function(t){t.forEach(yi)}(t),t.forEach(function(e){t.forEach(function(t){e!==t&&De(e,t,mi)})})}function wi(t,e){return t?"string"==typeof t?_i(t):t:_i(e)}function bi(t){return function(e,i,n,r){const s=e.length;n=void 0!==n?n:2,r=r??n,i=void 0!==i?i:new Array(s);for(let o=0;o<s;o+=r){const s=t(e.slice(o,o+n)),a=s.length;for(let t=0,n=r;t<n;++t)i[o+t]=t>=a?e[o+t]:s[t]}return i}}function Si(t,e,i,n){const r=_i(t),s=_i(e);De(r,s,bi(i)),De(s,r,bi(n))}function Mi(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();return(t.getCode()===e.getCode()||Ei(t,e)===mi)&&i}function Ei(t,e){const i=t.getCode(),n=e.getCode();let r=ze(i,n);if(r)return r;let s=null,o=null;for(const i of fi)s||(s=i(t)),o||(o=i(e));if(!s&&!o)return null;const a="EPSG:4326";if(o)if(s)r=Ci(s.inverse,o.forward);else{const t=ze(i,a);t&&(r=Ci(t,o.forward))}else{const t=ze(a,n);t&&(r=Ci(s.inverse,t))}return r&&(yi(t),yi(e),De(t,e,r)),r}function Ci(t,e){return function(i,n,r,s){return n=t(i,n,r,s),e(n,n,r,s)}}function Pi(t,e){return Ei(_i(t),_i(e))}function Ii(t,e,i){const n=Pi(e,i);if(!n){const t=_i(e).getCode(),n=_i(i).getCode();throw new Error(`No transform available between ${t} and ${n}`)}return n(t,void 0,t.length)}function Ti(t,e,i,n){return function(t,e,i,n){if(ae(t))return Dt(i);let r=[];if(n>1){const e=t[2]-t[0],i=t[3]-t[1];for(let s=0;s<n;++s)r.push(t[0]+e*s/n,t[1],t[2],t[1]+i*s/n,t[2]-e*s/n,t[3],t[0],t[3]-i*s/n)}else r=[t[0],t[1],t[2],t[1],t[2],t[3],t[0],t[3]];e(r,r,2);const s=[],o=[];for(let t=0,e=r.length;t<e;t+=2)s.push(r[t]),o.push(r[t+1]);return function(t,e,i){return Nt(Math.min.apply(null,t),Math.min.apply(null,e),Math.max.apply(null,t),Math.max.apply(null,e),i)}(s,o,i)}(t,Pi(e,i),void 0,n)}let Ri=null;function ki(){return Ri}function Ai(t,e){return t}function Gi(t,e){return gi&&!ue(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(gi=!1,we("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t}function Oi(t,e){return t}function Fi(t,e){return t}function Li(t,e){return t}function ji(t,e,i){return function(n){let r,s;if(t.canWrapX()){const e=t.getExtent(),o=se(e);s=fe(n=n.slice(0),t,o),s&&(n[0]=n[0]-s*o),n[0]=mt(n[0],e[0],e[2]),n[1]=mt(n[1],e[1],e[3]),r=i(n)}else r=i(n);return s&&e.canWrapX()&&(r[0]+=s*se(e.getExtent())),r}}var Ni,Di,zi;xi(ke),xi(Fe),Ni=ke,Di=function(t,e,i,n){const r=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(r));for(let i=0;i<r;i+=n){e[i]=Ce*t[i]/180;let n=Ee*Math.log(Math.tan(Math.PI*(+t[i+1]+90)/360));n>Te?n=Te:n<-Te&&(n=-Te),e[i+1]=n}return e},zi=function(t,e,i,n){const r=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(r));for(let i=0;i<r;i+=n)e[i]=180*t[i]/Ce,e[i+1]=360*Math.atan(Math.exp(t[i+1]/Ee))/Math.PI-90;return e},Fe.forEach(function(t){Ni.forEach(function(e){De(t,e,Di),De(e,t,zi)})});const qi=new Array(6);function $i(t){return Ui(t,1,0,0,1,0,0)}function Bi(t,e){const i=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=e[0],h=e[1],u=e[2],c=e[3],d=e[4],f=e[5];return t[0]=i*l+r*h,t[1]=n*l+s*h,t[2]=i*u+r*c,t[3]=n*u+s*c,t[4]=i*d+r*f+o,t[5]=n*d+s*f+a,t}function Ui(t,e,i,n,r,s,o){return t[0]=e,t[1]=i,t[2]=n,t[3]=r,t[4]=s,t[5]=o,t}function Wi(t,e){const i=e[0],n=e[1];return e[0]=t[0]*i+t[2]*n+t[4],e[1]=t[1]*i+t[3]*n+t[5],e}function Xi(t,e,i){return Bi(t,Ui(qi,e,0,0,i,0,0))}function Vi(t,e,i,n,r,s,o,a){const l=Math.sin(s),h=Math.cos(s);return t[0]=n*h,t[1]=r*l,t[2]=-n*l,t[3]=r*h,t[4]=o*n*h-a*n*l+e,t[5]=o*r*l+a*r*h+i,t}function Ki(t,e){const i=(n=e)[0]*n[3]-n[1]*n[2];var n;ct(0!==i,"Transformation matrix cannot be inverted");const r=e[0],s=e[1],o=e[2],a=e[3],l=e[4],h=e[5];return t[0]=a/i,t[1]=-s/i,t[2]=-o/i,t[3]=r/i,t[4]=(o*h-a*l)/i,t[5]=-(r*h-s*l)/i,t}const Yi=[1e5,1e5,1e5,1e5,2,2];function Zi(t){return t.substring(7,t.length-1).split(",").map(parseFloat)}function Hi(t,e,i,n,r,s,o){s=s||[],o=o||2;let a=0;for(let l=e;l<i;l+=n){const e=t[l],i=t[l+1];s[a++]=r[0]*e+r[2]*i+r[4],s[a++]=r[1]*e+r[3]*i+r[5];for(let e=2;e<o;e++)s[a++]=t[l+e]}return s&&s.length!=a&&(s.length=a),s}function Ji(t,e,i,n,r,s,o){o=o||[];const a=Math.cos(r),l=Math.sin(r),h=s[0],u=s[1];let c=0;for(let r=e;r<i;r+=n){const e=t[r]-h,i=t[r+1]-u;o[c++]=h+e*a-i*l,o[c++]=u+e*l+i*a;for(let e=r+2;e<r+n;++e)o[c++]=t[e]}return o&&o.length!=c&&(o.length=c),o}const Qi=[1,0,0,1,0,0],tn=[NaN,NaN],en=class extends ${constructor(){super(),this.extent_=[1/0,1/0,-1/0,-1/0],this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=A((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return N()}closestPointXY(t,e,i,n){return N()}containsXY(t,e){return 0===this.closestPointXY(t,e,tn,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 N()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&Dt(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){N()}scale(t,e,i){N()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return N()}getType(){return N()}applyTransform(t){N()}intersectsExtent(t){return N()}translate(t,e){N()}transform(t,e){const i=_i(t),n="tile-pixels"==i.getUnits()?function(t,n,r){const s=i.getExtent(),o=i.getWorldExtent(),a=ee(o)/ee(s);Vi(Qi,o[0],o[3],a,-a,0,0,0);const l=Hi(t,0,t.length,r,Qi,n),h=Pi(i,e);return h?h(l,l,r):l}:Pi(i,e);return this.applyTransform(n),this}};function nn(t){let e;return 2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM"),e}function rn(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}const sn=class extends en{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return qt(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return N()}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=rn(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){N()}setLayout(t,e,i){let n;if(t)n=rn(t);else{for(let t=0;t<i;++t){if(0===e.length)return this.layout="XY",void(this.stride=2);e=e[0]}n=e.length,t=nn(n)}this.layout=t,this.stride=n}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();Ji(i,0,i.length,n,t,e,i),this.changed()}}scale(t,e,i){void 0===e&&(e=t),i||(i=Ht(this.getExtent()));const n=this.getFlatCoordinates();if(n){const r=this.getStride();!function(t,e,i,n,r,s,o,a){a=a||[];const l=o[0],h=o[1];let u=0;for(let e=0;e<i;e+=n){const i=t[e]-l,o=t[e+1]-h;a[u++]=l+r*i,a[u++]=h+s*o;for(let i=e+2;i<e+n;++i)a[u++]=t[i]}a&&a.length!=u&&(a.length=u)}(n,0,n.length,r,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();!function(t,e,i,n,r,s,o){o=o||[];let a=0;for(let e=0;e<i;e+=n){o[a++]=t[e]+r,o[a++]=t[e+1]+s;for(let i=e+2;i<e+n;++i)o[a++]=t[i]}o&&o.length!=a&&(o.length=a)}(i,0,i.length,n,t,e,i),this.changed()}}};function on(t,e,i,n){let r=0;const s=t[i-n],o=t[i-n+1];let a=0,l=0;for(;e<i;e+=n){const i=t[e]-s,n=t[e+1]-o;r+=l*i-a*n,a=i,l=n}return r/2}function an(t,e,i,n){let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s];r+=on(t,e,o,n),e=o}return r}function ln(t,e,i,n,r,s,o){const a=t[e],l=t[e+1],h=t[i]-a,u=t[i+1]-l;let c;if(0===h&&0===u)c=e;else{const d=((r-a)*h+(s-l)*u)/(h*h+u*u);if(d>1)c=i;else{if(d>0){for(let r=0;r<n;++r)o[r]=bt(t[e+r],t[i+r],d);return void(o.length=n)}c=e}}for(let e=0;e<n;++e)o[e]=t[c+e];o.length=n}function hn(t,e,i,n,r){let s=t[e],o=t[e+1];for(e+=n;e<i;e+=n){const i=t[e],n=t[e+1],a=_t(s,o,i,n);a>r&&(r=a),s=i,o=n}return r}function un(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];r=hn(t,e,o,n,r),e=o}return r}function cn(t,e,i,n,r,s,o,a,l,h,u){if(e==i)return h;let c,d;if(0===r){if(d=_t(o,a,t[e],t[e+1]),d<h){for(c=0;c<n;++c)l[c]=t[e+c];return l.length=n,d}return h}u=u||[NaN,NaN];let f=e+n;for(;f<i;)if(ln(t,f-n,f,n,o,a,u),d=_t(o,a,u[0],u[1]),d<h){for(h=d,c=0;c<n;++c)l[c]=u[c];l.length=n,f+=n}else f+=n*Math.max((Math.sqrt(d)-Math.sqrt(h))/r|0,1);if(s&&(ln(t,i-n,e,n,o,a,u),d=_t(o,a,u[0],u[1]),d<h)){for(h=d,c=0;c<n;++c)l[c]=u[c];l.length=n}return h}function dn(t,e,i,n,r,s,o,a,l,h,u){u=u||[NaN,NaN];for(let c=0,d=i.length;c<d;++c){const d=i[c];h=cn(t,e,d,n,r,s,o,a,l,h,u),e=d}return h}function fn(t,e,i,n){for(let r=0,s=i.length;r<s;++r){const s=i[r];for(let i=0;i<n;++i)t[e++]=s[i]}return e}function pn(t,e,i,n,r){r=r||[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=fn(t,e,i[o],n);r[s++]=a,e=a}return r.length=s,r}function gn(t,e,i,n,r){r=r||[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=pn(t,e,i[o],n,r[s]);0===a.length&&(a[0]=e),r[s++]=a,e=a[a.length-1]}return r.length=s,r}function mn(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=e;o<i;o+=n)r[s++]=t.slice(o,o+n);return r.length=s,r}function yn(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];r[s++]=mn(t,e,a,n,r[s]),e=a}return r.length=s,r}function _n(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];r[s++]=1===a.length&&a[0]===e?[]:yn(t,e,a,n,r[s]),e=a[a.length-1]}return r.length=s,r}function vn(t,e,i,n,r,s,o){const a=(i-e)/n;if(a<3){for(;e<i;e+=n)s[o++]=t[e],s[o++]=t[e+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[e,i-n];let u=0;for(;h.length>0;){const i=h.pop(),s=h.pop();let o=0;const a=t[s],c=t[s+1],d=t[i],f=t[i+1];for(let e=s+n;e<i;e+=n){const i=yt(t[e],t[e+1],a,c,d,f);i>o&&(u=e,o=i)}o>r&&(l[(u-e)/n]=1,s+n<u&&h.push(s,u),u+n<i&&h.push(u,i))}for(let i=0;i<a;++i)l[i]&&(s[o++]=t[e+i*n],s[o++]=t[e+i*n+1]);return o}function xn(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=vn(t,e,h,n,r,s,o),a.push(o),e=h}return o}function wn(t,e){return e*Math.round(t/e)}function bn(t,e,i,n,r,s,o){if(e==i)return o;let a,l,h=wn(t[e],r),u=wn(t[e+1],r);e+=n,s[o++]=h,s[o++]=u;do{if(a=wn(t[e],r),l=wn(t[e+1],r),(e+=n)==i)return s[o++]=a,s[o++]=l,o}while(a==h&&l==u);for(;e<i;){const i=wn(t[e],r),c=wn(t[e+1],r);if(e+=n,i==a&&c==l)continue;const d=a-h,f=l-u,p=i-h,g=c-u;d*g==f*p&&(d<0&&p<d||d==p||d>0&&p>d)&&(f<0&&g<f||f==g||f>0&&g>f)?(a=i,l=c):(s[o++]=a,s[o++]=l,h=a,u=l,a=i,l=c)}return s[o++]=a,s[o++]=l,o}function Sn(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=bn(t,e,h,n,r,s,o),a.push(o),e=h}return o}class Mn extends sn{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 Mn(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<Gt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(hn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),cn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return on(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return mn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=vn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Mn(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=fn(this.flatCoordinates,0,t,this.stride),this.changed()}}const En=Mn;class Cn extends sn{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Cn(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const r=this.flatCoordinates,s=_t(t,e,r[0],r[1]);if(s<n){const t=this.stride;for(let e=0;e<t;++e)i[e]=r[e];return i.length=t,s}return n}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return zt(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Lt(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=function(t,e,i){for(let n=0,r=i.length;n<r;++n)t[e++]=i[n];return e}(this.flatCoordinates,0,t,this.stride),this.changed()}}const Pn=Cn;function In(t,e,i,n,r){return!Vt(r,function(r){return!Tn(t,e,i,n,r[0],r[1])})}function Tn(t,e,i,n,r,s){let o=0,a=t[i-n],l=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];l<=s?n>s&&(i-a)*(s-l)-(r-a)*(n-l)>0&&o++:n<=s&&(i-a)*(s-l)-(r-a)*(n-l)<0&&o--,a=i,l=n}return 0!==o}function Rn(t,e,i,n,r,s){if(0===i.length)return!1;if(!Tn(t,e,i[0],n,r,s))return!1;for(let e=1,o=i.length;e<o;++e)if(Tn(t,i[e-1],i[e],n,r,s))return!1;return!0}function kn(t,e,i,n,r,s,o){let a,l,h,u,c,d,f;const p=r[s+1],g=[];for(let r=0,s=i.length;r<s;++r){const s=i[r];for(u=t[s-n],d=t[s-n+1],a=e;a<s;a+=n)c=t[a],f=t[a+1],(p<=d&&f<=p||d<=p&&p<=f)&&(h=(p-d)/(f-d)*(c-u)+u,g.push(h)),u=c,d=f}let m=NaN,y=-1/0;for(g.sort(S),u=g[0],a=1,l=g.length;a<l;++a){c=g[a];const r=Math.abs(c-u);r>y&&(h=(u+c)/2,Rn(t,e,i,n,h,p)&&(m=h,y=r)),u=c}return isNaN(m)&&(m=r[s]),o?(o.push(m,p,y),o):[m,p,y]}function An(t,e,i,n,r){let s=[];for(let o=0,a=i.length;o<a;++o){const a=i[o];s=kn(t,e,a,n,r,2*o,s),e=a[a.length-1]}return s}function Gn(t,e,i,n,r){let s;for(e+=n;e<i;e+=n)if(s=r(t.slice(e-n,e),t.slice(e,e+n)),s)return s;return!1}function On(t,e,i,n,r,s){return s=s??Wt([1/0,1/0,-1/0,-1/0],t,e,i,n),!!oe(r,s)&&(s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]||Gn(t,e,i,n,function(t,e){return function(t,e,i){let n=!1;const r=jt(t,e),s=jt(t,i);if(1===r||1===s)n=!0;else{const o=t[0],a=t[1],l=t[2],h=t[3],u=e[0],c=e[1],d=i[0],f=i[1],p=(f-c)/(d-u);let g,m;2&s&&!(2&r)&&(g=d-(f-h)/p,n=g>=o&&g<=l),n||!(4&s)||4&r||(m=f-(d-l)*p,n=m>=a&&m<=h),n||!(8&s)||8&r||(g=d-(f-a)/p,n=g>=o&&g<=l),n||!(16&s)||16&r||(m=f-(d-o)*p,n=m>=a&&m<=h)}return n}(r,t,e)}))}function Fn(t,e,i,n,r){return!!(On(t,e,i,n,r)||Tn(t,e,i,n,r[0],r[1])||Tn(t,e,i,n,r[0],r[3])||Tn(t,e,i,n,r[2],r[1])||Tn(t,e,i,n,r[2],r[3]))}function Ln(t,e,i,n,r){if(!Fn(t,e,i[0],n,r))return!1;if(1===i.length)return!0;for(let e=1,s=i.length;e<s;++e)if(In(t,i[e-1],i[e],n,r)&&!On(t,i[e-1],i[e],n,r))return!1;return!0}function jn(t,e,i,n){for(;e<i-n;){for(let r=0;r<n;++r){const s=t[e+r];t[e+r]=t[i-n+r],t[i-n+r]=s}e+=n,i-=n}}function Nn(t,e,i,n){let r=0,s=t[i-n],o=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];r+=(i-s)*(n+o),s=i,o=n}return 0===r?void 0:r>0}function Dn(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=Nn(t,e,o,n);if(0===s){if(r&&a||!r&&!a)return!1}else if(r&&!a||!r&&a)return!1;e=o}return!0}function zn(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];if(!Dn(t,e,o,n,r))return!1;o.length&&(e=o[o.length-1])}return!0}function qn(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=Nn(t,e,o,n);(0===s?r&&a||!r&&!a:r&&!a||!r&&a)&&jn(t,e,o,n),e=o}return e}function $n(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s)e=qn(t,e,i[s],n,r);return e}function Bn(t,e){const i=[];let n,r=0,s=0;for(let o=0,a=e.length;o<a;++o){const a=e[o],l=Nn(t,r,a,2);if(void 0===n&&(n=l),l===n)i.push(e.slice(s,o+1));else{if(0===i.length)continue;i[i.length-1].push(e[s])}s=o+1,r=a}return i}class Un extends sn{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?P(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Un(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Gt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(un(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),dn(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return Rn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return an(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),qn(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,yn(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=Ht(this.getExtent());this.flatInteriorPoint_=kn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Pn(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new En(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,n=[];let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=new En(e.slice(r,o),t);n.push(a),r=o}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Dn(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=qn(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Sn(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new Un(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return Ln(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=pn(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}const Wn=Un;function Xn(t){if(ae(t))throw new Error("Cannot create polygon from empty extent");const e=t[0],i=t[1],n=t[2],r=t[3],s=[e,i,e,r,n,r,n,i,e,i];return new Un(s,"XY",[s.length])}function Vn(t,e,i,n){const r=se(e)/i[0],s=ee(e)/i[1];return n?Math.min(t,Math.max(r,s)):Math.min(t,Math.min(r,s))}function Kn(t,e,i){let n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(n=Math.max(n,i),n/=Math.log(1+50*Math.max(0,i/t-1))/50+1),mt(n,i/2,2*e)}function Yn(t,e,i,n,r){return i=void 0===i||i,function(s,o,a,l){if(void 0!==s){const o=n?Vn(t,n,a,r):t;return i&&l?Kn(s,o,e):mt(s,e,o)}}}function Zn(t){if(void 0!==t)return 0}function Hn(t){if(void 0!==t)return t}function Jn(t,e){setTimeout(function(){t(e)},0)}function Qn(t){return!(t.sourceCenter&&t.targetCenter&&!ue(t.sourceCenter,t.targetCenter))&&t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation}function tr(t,e,i,n,r){const s=Math.cos(-r);let o=Math.sin(-r),a=t[0]*s-t[1]*o,l=t[1]*s+t[0]*o;return a+=(e[0]/2-i[0])*n,l+=(i[1]-e[1]/2)*n,o=-o,[a*s-l*o,l*s+a*o]}const er=class extends ${constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=wi(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){gi=!(void 0===t||t)}(),t.center&&(t.center=Gi(t.center,this.projection_)),t.extent&&(t.extent=Fi(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const t in gt)delete e[t];this.setProperties(e,!0);const i=function(t){let e,i,n;let r=void 0!==t.minZoom?t.minZoom:0,s=void 0!==t.maxZoom?t.maxZoom:28;const o=void 0!==t.zoomFactor?t.zoomFactor:2,a=void 0!==t.multiWorld&&t.multiWorld,l=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,h=void 0!==t.showFullExtent&&t.showFullExtent,u=wi(t.projection,"EPSG:3857"),c=u.getExtent();let d=t.constrainOnlyCenter,f=t.extent;if(a||f||!u.isGlobal()||(d=!1,f=c),void 0!==t.resolutions){const o=t.resolutions;i=o[r],n=void 0!==o[s]?o[s]:o[o.length-1],e=t.constrainResolution?function(t,e,i,n){return e=void 0===e||e,function(r,s,o,a){if(void 0!==r){const l=t[0],h=t[t.length-1],u=i?Vn(l,i,o,n):l;if(a)return e?Kn(r,u,h):mt(r,h,u);const c=Math.min(u,r),d=Math.floor(E(t,c,s));return t[d]>u&&d<t.length-1?t[d+1]:t[d]}}}(o,l,!d&&f,h):Yn(i,n,l,!d&&f,h)}else{const a=(c?Math.max(se(c),ee(c)):360*Se.degrees/u.getMetersPerUnit())/256/Math.pow(2,0),p=a/Math.pow(2,28);i=t.maxResolution,void 0!==i?r=0:i=a/Math.pow(o,r),n=t.minResolution,void 0===n&&(n=void 0!==t.maxZoom?void 0!==t.maxResolution?i/Math.pow(o,s):a/Math.pow(o,s):p),s=r+Math.floor(Math.log(i/n)/Math.log(o)),n=i/Math.pow(o,s-r),e=t.constrainResolution?function(t,e,i,n,r,s){return n=void 0===n||n,i=void 0!==i?i:0,function(o,a,l,h){if(void 0!==o){const u=r?Vn(e,r,l,s):e;if(h)return n?Kn(o,u,i):mt(o,i,u);const c=1e-9,d=Math.ceil(Math.log(e/u)/Math.log(t)-c),f=-a*(.5-c)+.5,p=Math.min(u,o),g=Math.floor(Math.log(e/p)/Math.log(t)+f),m=Math.max(d,g);return mt(e/Math.pow(t,m),i,u)}}}(o,i,n,l,!d&&f,h):Yn(i,n,l,!d&&f,h)}return{constraint:e,maxResolution:i,minResolution:n,minZoom:r,zoomFactor:o}}(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const n=function(t){if(void 0!==t.extent){const e=void 0===t.smoothExtentConstraint||t.smoothExtentConstraint;return It(t.extent,t.constrainOnlyCenter,e)}const e=wi(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,It(t,!1,!1)}return Tt}(t),r=i.constraint,s=function(t){if(void 0===t.enableRotation||t.enableRotation){const e=t.constrainRotation;return void 0===e||!0===e?function(){const t=xt(5);return function(e,i){return i||void 0===e?e:Math.abs(e)<=t?0:e}}():!1===e?Hn:"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):Hn}return Zn}(t);this.constraints_={center:n,resolution:r,rotation:s},this.setRotation(void 0!==t.rotation?t.rotation:0),this.setCenterInternal(void 0!==t.center?t.center:null),void 0!==t.resolution?this.setResolution(t.resolution):void 0!==t.zoom&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const n=t||[0,0,0,0];e=e||[0,0,0,0];const r=this.getResolution(),s=r/2*(n[3]-e[3]+e[1]-n[1]),o=r/2*(n[0]-e[0]+e[2]-n[2]);this.setCenterInternal([i[0]+s,i[1]-o])}}getUpdatedOptions_(t){const e=this.getProperties();return void 0!==e.resolution?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let t=0;t<e.length;++t){let i=arguments[t];i.center&&(i=Object.assign({},i),i.center=Gi(i.center,this.getProjection())),i.anchor&&(i=Object.assign({},i),i.anchor=Gi(i.anchor,this.getProjection())),e[t]=i}this.animateInternal.apply(this,e)}animateInternal(t){let e,i=arguments.length;i>1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n<i&&!this.isDef();++n){const t=arguments[n];t.center&&this.setCenterInternal(t.center),void 0!==t.zoom?this.setZoom(t.zoom):t.resolution&&this.setResolution(t.resolution),void 0!==t.rotation&&this.setRotation(t.rotation)}if(n===i)return void(e&&Jn(e,!0));let r=Date.now(),s=this.targetCenter_.slice(),o=this.targetResolution_,a=this.targetRotation_;const l=[];for(;n<i;++n){const t=arguments[n],i={start:r,complete:!1,anchor:t.anchor,duration:void 0!==t.duration?t.duration:1e3,easing:t.easing||me,callback:e};if(t.center&&(i.sourceCenter=s,i.targetCenter=t.center.slice(),s=i.targetCenter),void 0!==t.zoom?(i.sourceResolution=o,i.targetResolution=this.getResolutionForZoom(t.zoom),o=i.targetResolution):t.resolution&&(i.sourceResolution=o,i.targetResolution=t.resolution,o=i.targetResolution),void 0!==t.rotation){i.sourceRotation=a;const e=wt(t.rotation-a+Math.PI,2*Math.PI)-Math.PI;i.targetRotation=a+e,a=i.targetRotation}Qn(i)?i.complete=!0:r+=i.duration,l.push(i)}this.animations_.push(l),this.setHint(0,1),this.updateAnimations_()}getAnimating(){return this.hints_[0]>0}getInteracting(){return this.hints_[1]>0}cancelAnimations(){let t;this.setHint(0,-this.hints_[0]);for(let e=0,i=this.animations_.length;e<i;++e){const i=this.animations_[e];if(i[0].callback&&Jn(i[0].callback,!1),!t)for(let e=0,n=i.length;e<n;++e){const n=i[e];if(!n.complete){t=n.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(void 0!==this.updateAnimationKey_&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const n=this.animations_[i];let r=!0;for(let i=0,s=n.length;i<s;++i){const s=n[i];if(s.complete)continue;const o=t-s.start;let a=s.duration>0?o/s.duration:1;a>=1?(s.complete=!0,a=1):r=!1;const l=s.easing(a);if(s.sourceCenter){const t=s.sourceCenter[0],e=s.sourceCenter[1],i=s.targetCenter[0],n=s.targetCenter[1];this.nextCenter_=s.targetCenter;const r=t+l*(i-t),o=e+l*(n-e);this.targetCenter_=[r,o]}if(s.sourceResolution&&s.targetResolution){const t=1===l?s.targetResolution:s.sourceResolution+l*(s.targetResolution-s.sourceResolution);if(s.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,s.anchor)}this.nextResolution_=s.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==s.sourceRotation&&void 0!==s.targetRotation){const t=1===l?wt(s.targetRotation+Math.PI,2*Math.PI)-Math.PI:s.sourceRotation+l*(s.targetRotation-s.sourceRotation);if(s.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,s.anchor)}this.nextRotation_=s.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!s.complete)break}if(r){this.animations_[i]=null,this.setHint(0,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&Jn(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();var r,s;return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],ce(i,t-this.getRotation()),s=e,(r=i)[0]+=+s[0],r[1]+=+s[1]),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),r=this.getResolution();return void 0!==n&&void 0!==r&&(i=[e[0]-t*(e[0]-n[0])/r,e[1]-t*(e[1]-n[1])/r]),i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?Ai(t,this.getProjection()):t}getCenterInternal(){return this.get(gt.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 Oi(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();ct(e,"The view center is not defined");const i=this.getResolution();ct(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return ct(void 0!==n,"The view rotation is not defined"),Qt(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(gt.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(Fi(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=se(t)/e[0],n=ee(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return function(i){return e/Math.pow(t,i*n)}}getRotation(){return this.get(gt.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/r}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const r=this.padding_;if(r){const t=this.getViewportSizeMinusPadding_();n=tr(n,this.getViewportSize_(),[t[0]/2+r[3],t[1]/2+r[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const r=E(this.resolutions_,t,1);n=r,e=this.resolutions_[r],i=r==this.resolutions_.length-1?2:e/this.resolutions_[r+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=mt(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,mt(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(ct(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t))ct(!ae(t),"Cannot fit empty extent provided as `geometry`"),i=Xn(Fi(t,this.getProjection()));else if("Circle"===t.getType()){const e=Fi(t.getExtent(),this.getProjection());i=Xn(e),i.rotate(this.getRotation(),Ht(e))}else{const e=ki();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),r=t.getFlatCoordinates(),s=t.getStride();let o=1/0,a=1/0,l=-1/0,h=-1/0;for(let t=0,e=r.length;t<e;t+=s){const e=r[t]*i-r[t+1]*n,s=r[t]*n+r[t+1]*i;o=Math.min(o,e),a=Math.min(a,s),l=Math.max(l,e),h=Math.max(h,s)}return[o,a,l,h]}fitInternal(t,e){let i=(e=e||{}).size;i||(i=this.getViewportSizeMinusPadding_());const n=void 0!==e.padding?e.padding:[0,0,0,0],r=void 0!==e.nearest&&e.nearest;let s;s=void 0!==e.minResolution?e.minResolution:void 0!==e.maxZoom?this.getResolutionForZoom(e.maxZoom):0;const o=this.rotatedExtentForGeometry(t);let a=this.getResolutionForExtentInternal(o,[i[0]-n[1]-n[3],i[1]-n[0]-n[2]]);a=isNaN(a)?s:Math.max(a,s),a=this.getConstrainedResolution(a,r?0:1);const l=this.getRotation(),h=Math.sin(l),u=Math.cos(l),c=Ht(o);c[0]+=(n[1]-n[3])/2*a,c[1]+=(n[0]-n[2])/2*a;const d=c[0]*u-c[1]*h,f=c[1]*u+c[0]*h,p=this.getConstrainedCenter([d,f],a),g=e.callback?e.callback:k;void 0!==e.duration?this.animateInternal({resolution:a,center:p,duration:e.duration,easing:e.easing},g):(this.targetResolution_=a,this.targetCenter_=p,this.applyTargetState_(!1,!0),Jn(g,!0))}centerOn(t,e,i){this.centerOnInternal(Gi(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(tr(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,n){let r;const s=this.padding_;if(s&&t){const o=this.getViewportSizeMinusPadding_(-i),a=tr(t,n,[o[0]/2+s[3],o[1]/2+s[0]],e,i);r=[t[0]-a[0],t[1]-a[1]]}return r}isDef(){return!!this.getCenterInternal()&&void 0!==this.getResolution()}adjustCenter(t){const e=Ai(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&&Gi(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.getViewportSize_(this.getRotation()),r=this.constraints_.resolution(this.targetResolution_*t,0,n,i);e&&(this.targetCenter_=this.calculateCenterZoom(r,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=Gi(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(n,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t?Gi(t,this.getProjection()):t)}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,n=this.constraints_.rotation(this.targetRotation_,i),r=this.getViewportSize_(n),s=this.constraints_.resolution(this.targetResolution_,0,r,i),o=this.constraints_.center(this.targetCenter_,s,r,i,this.calculateCenterShift(this.targetCenter_,s,n,r));this.get(gt.ROTATION)!==n&&this.set(gt.ROTATION,n),this.get(gt.RESOLUTION)!==s&&(this.set(gt.RESOLUTION,s),this.set("zoom",this.getZoom(),!0)),o&&this.get(gt.CENTER)&&ue(this.get(gt.CENTER),o)||this.set(gt.CENTER,o),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=void 0!==t?t:200;const n=e||0,r=this.constraints_.rotation(this.targetRotation_),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,n,s),a=this.constraints_.center(this.targetCenter_,o,s,!1,this.calculateCenterShift(this.targetCenter_,o,r,s));if(0===t&&!this.cancelAnchor_)return this.targetResolution_=o,this.targetRotation_=r,this.targetCenter_=a,void this.applyTargetState_();i=i||(0===t?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,this.getResolution()===o&&this.getRotation()===r&&this.getCenterInternal()&&ue(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:a,resolution:o,duration:t,easing:ge,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(1,1)}endInteraction(t,e,i){i=i&&Gi(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)}},ir="ol-hidden",nr="ol-unselectable",rr="ol-control",sr="ol-collapsed",or=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"),ar=["style","variant","weight","size","lineHeight","family"],lr={normal:400,bold:700},hr=function(t){const e=t.match(or);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let t=0,n=ar.length;t<n;++t){const n=e[t+1];void 0!==n&&(i[ar[t]]="string"==typeof n?n.trim():n)}return isNaN(Number(i.weight))&&i.weight in lr&&(i.weight=lr[i.weight]),i.families=i.family.split(/,\s?/).map(t=>t.trim().replace(/^['"]|['"]$/g,"")),i};function ur(t,e,i,n){let r;return r=i&&i.length?i.shift():Q?new class extends OffscreenCanvas{style={}}(t??300,e??150):document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e),r.getContext("2d",n)}let cr;function dr(){return cr||(cr=ur(1,1)),cr}function fr(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function pr(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}function gr(){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 mr(t){return"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas}const yr=class extends ${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)p(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!==k&&this.listenerKeys.push(d(t,rt,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_="string"==typeof t?document.getElementById(t):t}},_r=class extends yr{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",n=void 0!==t.expandClassName?t.expandClassName:e+"-expand",r=void 0!==t.collapseLabel?t.collapseLabel:"›",s=void 0!==t.collapseClassName?t.collapseClassName:e+"-collapse";"string"==typeof r?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=r,this.collapseLabel_.className=s):this.collapseLabel_=r;const o=void 0!==t.label?t.label:"i";"string"==typeof o?(this.label_=document.createElement("span"),this.label_.textContent=o,this.label_.className=n):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(y,this.handleClick_.bind(this),!1);const l=e+" "+nr+" "+rr+(this.collapsed_&&this.collapsible_?" "+sr:"")+(this.collapsible_?"":" ol-uncollapsible"),h=this.element;h.className=l,h.appendChild(this.toggleButton_),h.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=>G(()=>t))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!I(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(sr),this.collapsed_?pr(this.collapseLabel_,this.label_):pr(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)}},vr=class extends yr{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:"⇧",n=void 0!==t.compassClassName?t.compassClassName:"ol-compass";this.label_=null,"string"==typeof i?(this.label_=document.createElement("span"),this.label_.className=n,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(n));const r=t.tipLabel?t.tipLabel:"Reset rotation",s=document.createElement("button");s.className=e+"-reset",s.setAttribute("type","button"),s.title=r,s.appendChild(this.label_),s.addEventListener(y,this.handleClick_.bind(this),!1);const o=e+" "+nr+" "+rr,a=this.element;a.className=o,a.appendChild(s),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(ir)}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:ge}):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(ir);t||0!==i?t&&0!==i&&this.element.classList.remove(ir):this.element.classList.add(ir)}this.label_.style.transform=t}this.rotation_=i}},xr=class extends yr{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,n=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",r=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",s=void 0!==t.zoomInLabel?t.zoomInLabel:"+",o=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",a=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",l=void 0!==t.zoomOutTipLabel?t.zoomOutTipLabel:"Zoom out",h=document.createElement("button");h.className=n,h.setAttribute("type","button"),h.title=a,h.appendChild("string"==typeof s?document.createTextNode(s):s),h.addEventListener(y,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=l,u.appendChild("string"==typeof o?document.createTextNode(o):o),u.addEventListener(y,this.handleClick_.bind(this,-i),!1);const c=e+" "+nr+" "+rr,d=this.element;d.className=c,d.appendChild(h),d.appendChild(u),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 n=e.getConstrainedZoom(i+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:ge})):e.setZoom(n)}}},wr=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 n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;const r=this.points_[e]-this.points_[i],s=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(s,r),this.initialVelocity_=Math.sqrt(r*r+s*s)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},br="active";function Sr(t,e,i,n){const r=t.getZoom();if(void 0===r)return;const s=t.getConstrainedZoom(r+e),o=t.getResolutionForZoom(s);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:i,duration:void 0!==n?n:250,easing:ge})}const Mr=class extends ${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(br)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(br,t)}setMap(t){this.map_=t}},Er=class extends Mr{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==K.DBLCLICK){const i=t.originalEvent,n=t.map,r=t.coordinate,s=i.shiftKey?-this.delta_:this.delta_;Sr(n.getView(),s,r,this.duration_),i.preventDefault(),e=!0}return!e}};function Cr(t){const e=arguments;return function(t){let i=!0;for(let n=0,r=e.length;n<r&&(i=i&&e[n](t),i);++n);return i}}const Pr=function(t){const e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Ir=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(),n=t.map.getOwnerDocument().activeElement;return i instanceof ShadowRoot?i.host.contains(n):e.contains(n)}(t)},Tr=T,Rr=function(t){const e=t.originalEvent;return"pointerId"in e&&0==e.button&&!(Z&&H&&e.ctrlKey)},kr=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},Ar=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Gr=function(t){const e=t.originalEvent,i=e.target.tagName;return"INPUT"!==i&&"SELECT"!==i&&"TEXTAREA"!==i&&!e.target.isContentEditable},Or=function(t){const e=t.originalEvent;return"pointerId"in e&&"mouse"==e.pointerType},Fr=function(t){const e=t.originalEvent;return"pointerId"in e&&e.isPrimary&&0===e.button};function Lr(t){const e=t.length;let i=0,n=0;for(let r=0;r<e;r++)i+=t[r].clientX,n+=t[r].clientY;return{clientX:i/e,clientY:n/e}}const jr=class extends Mr{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==K.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==K.POINTERUP){const e=this.handleUpEvent(t);this.handlingDownUpSequence=e&&this.targetPointers.length>0}}else if(t.type==K.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==K.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}},Nr=class extends jr{constructor(t){super({stopDown:R}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:Cr(kr,Fr);this.condition_=t.onFocusOnly?Cr(Ir,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const i=this.targetPointers,n=e.getEventPixel(Lr(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(n[0],n[1]),this.lastCentroid){const e=[this.lastCentroid[0]-n[0],n[1]-this.lastCentroid[1]],i=t.map.getView();r=e,s=i.getResolution(),r[0]*=s,r[1]*=s,ce(e,i.getRotation()),i.adjustCenterInternal(e)}}else this.kinetic_&&this.kinetic_.begin();var r,s;this.lastCentroid=n,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(),n=this.kinetic_.getAngle(),r=i.getCenterInternal(),s=e.getPixelFromCoordinateInternal(r),o=e.getCoordinateFromPixelInternal([s[0]-t*Math.cos(n),s[1]-t*Math.sin(n)]);i.animateInternal({center:i.getConstrainedCenter(o),duration:500,easing:ge})}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}},Dr=class extends jr{constructor(t){t=t||{},super({stopDown:R}),this.condition_=t.condition?t.condition:Pr,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!Or(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===Zn)return;const n=e.getSize(),r=t.pixel,s=Math.atan2(n[1]/2-r[1],r[0]-n[0]/2);if(void 0!==this.lastAngle_){const t=s-this.lastAngle_;i.adjustRotationInternal(-t)}this.lastAngle_=s}handleUpEvent(t){return!Or(t)||(t.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(t){return!!Or(t)&&(!(!Rr(t)||!this.condition_(t))&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0))}},zr=class extends b{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",n=this.element_.style;n.left=Math.min(t[0],e[0])+i,n.top=Math.min(t[1],e[1])+i,n.width=Math.abs(e[0]-t[0])+i,n.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 Wn([i])}getGeometry(){return this.geometry_}},qr="boxcancel";class $r extends O{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}const Br=class extends jr{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new zr(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??Rr,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const n=i[0]-e[0],r=i[1]-e[1];return n*n+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new $r("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 $r(e?"boxend":qr,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 $r("boxstart",t.coordinate,t)),!0)}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new $r(qr,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new $r(qr,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}},Ur=class extends Br{constructor(t){super({condition:(t=t||{}).condition?t.condition:Ar,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),n=e.getResolutionForExtentInternal(t),r=e.getResolution()/n;i=i.clone(),i.scale(r*r)}e.fitInternal(i,{duration:this.duration_,easing:ge})}},Wr="ArrowLeft",Xr="ArrowRight",Vr="ArrowDown",Kr=class extends Mr{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return kr(t)&&Gr(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==_){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==Vr||n==Wr||n==Xr||"ArrowUp"==n)){const r=t.map.getView(),s=r.getResolution()*this.pixelDelta_;let o=0,a=0;n==Vr?a=-s:n==Wr?o=-s:n==Xr?o=s:a=s;const l=[o,a];ce(l,r.getRotation()),function(t,e,i){const n=t.getCenterInternal();if(n){const r=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:ye,center:t.getConstrainedCenter(r)})}}(r,l,this.duration_),i.preventDefault(),e=!0}}return!e}},Yr=class extends Mr{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!function(t){const e=t.originalEvent;return H?e.metaKey:e.ctrlKey}(t)&&Gr(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==_||t.type==v){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&("+"===n||"-"===n)){const r=t.map,s="+"===n?this.delta_:-this.delta_;Sr(r.getView(),s,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}},Zr=class extends Mr{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:Tr;this.condition_=t.onFocusOnly?Cr(Ir,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(p),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(t),t){const e=t.getOwnerDocument();this.ctrlKeyListenerKeys_.push(d(e,"keydown",t=>{"Control"===t.key&&(this.ctrlKeyPressed_=!0)}),d(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!==w)return!0;const e=t.map,i=t.originalEvent;i.preventDefault();const n=i.ctrlKey&&!this.ctrlKeyPressed_;i.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=t.pixel);let r=i.deltaY;switch(i.deltaMode){case WheelEvent.DOM_DELTA_LINE:r*=40;break;case WheelEvent.DOM_DELTA_PAGE:r*=300}if(0===r)return!1;this.lastDelta_=r;const s=Date.now();void 0===this.startTime_&&(this.startTime_=s),(!this.mode_||s-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(r)<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_),n&&(r*=3),o.adjustZoom(-r/this.deltaPerZoom_,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=s,!1;this.totalDelta_+=r;const a=Math.max(this.timeout_-(s-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=-mt(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),Sr(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)}},Hr=class extends jr{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=R),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],n=this.targetPointers[1],r=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(void 0!==this.lastAngle_){const t=r-this.lastAngle_;this.rotationDelta_+=t,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=t}this.lastAngle_=r;const s=t.map,o=s.getView();o.getConstraints().rotation!==Zn&&(this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel(Lr(this.targetPointers))),this.rotating_&&(s.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}},Jr=class extends jr{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=R),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],n=this.targetPointers[1],r=i.clientX-n.clientX,s=i.clientY-n.clientY,o=Math.sqrt(r*r+s*s);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;const a=t.map,l=a.getView();1!=e&&(this.lastScaleDelta_=e),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(Lr(this.targetPointers))),a.render(),l.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 Qr(t){t=t||{};const e=new W,i=new wr(-.005,.05,100);return(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new Dr),(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new Er({delta:t.zoomDelta,duration:t.zoomDuration})),(void 0===t.dragPan||t.dragPan)&&e.push(new Nr({onFocusOnly:t.onFocusOnly,kinetic:i})),(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new Hr),(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new Jr({duration:t.zoomDuration})),(void 0===t.keyboard||t.keyboard)&&(e.push(new Kr),e.push(new Yr({delta:t.zoomDelta,duration:t.zoomDuration}))),(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new Zr({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration})),(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new Ur({duration:t.zoomDuration})),e}const ts="opacity",es="visible",is="extent",ns="zIndex",rs="maxResolution",ss="minResolution",os="maxZoom",as="minZoom",ls="source",hs=class extends ${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[ts]=void 0!==t.opacity?t.opacity:1,ct("number"==typeof e[ts],"Layer opacity must be a number"),e[es]=void 0===t.visible||t.visible,e[ns]=t.zIndex,e[rs]=void 0!==t.maxResolution?t.maxResolution:1/0,e[ss]=void 0!==t.minResolution?t.minResolution:0,e[as]=void 0!==t.minZoom?t.minZoom:-1/0,e[os]=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=mt(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 N()}getLayerStatesArray(t){return N()}getExtent(){return this.get(is)}getMaxResolution(){return this.get(rs)}getMinResolution(){return this.get(ss)}getMinZoom(){return this.get(as)}getMaxZoom(){return this.get(os)}getOpacity(){return this.get(ts)}getSourceState(){return N()}getVisible(){return this.get(es)}getZIndex(){return this.get(ns)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(is,t)}setMaxResolution(t){this.set(rs,t)}setMinResolution(t){this.set(ss,t)}setMaxZoom(t){this.set(os,t)}setMinZoom(t){this.set(as,t)}setOpacity(t){ct("number"==typeof t,"Layer opacity must be a number"),this.set(ts,t)}setVisible(t){this.set(es,t)}setZIndex(t){this.set(ns,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},us="addlayer",cs="removelayer";class ds extends O{constructor(t,e){super(t),this.layer=e}}const fs="layers";class ps extends hs{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(fs,this.handleLayersChanged_),i?Array.isArray(i)?i=new W(i.slice(),{unique:!0}):ct("function"==typeof i.getArray,"Expected `layers` to be an array or a `Collection`"):i=new W(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(p),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(d(t,a,this.handleLayersAdd_,this),d(t,l,this.handleLayersRemove_,this));for(const t in this.listenerKeys_)this.listenerKeys_[t].forEach(p);u(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 ds(us,i))}this.changed()}registerLayerListeners_(t){const e=[d(t,h,this.handleLayerChange_,this),d(t,g,this.handleLayerChange_,this)];t instanceof ps&&e.push(d(t,us,this.handleLayerGroupAdd_,this),d(t,cs,this.handleLayerGroupRemove_,this)),this.listenerKeys_[z(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new ds(us,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new ds(cs,t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new ds(us,e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=z(e);this.listenerKeys_[i].forEach(p),delete this.listenerKeys_[i],this.dispatchEvent(new ds(cs,e)),this.changed()}getLayers(){return this.get(fs)}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 ds(cs,t[e]))}this.set(fs,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 n=this.getLayerState();let r=n.zIndex;t||void 0!==n.zIndex||(r=0);for(let t=i,s=e.length;t<s;t++){const i=e[t];i.opacity*=n.opacity,i.visible=i.visible&&n.visible,i.maxResolution=Math.min(i.maxResolution,n.maxResolution),i.minResolution=Math.max(i.minResolution,n.minResolution),i.minZoom=Math.max(i.minZoom,n.minZoom),i.maxZoom=Math.min(i.maxZoom,n.maxZoom),void 0!==n.extent&&(void 0!==i.extent?i.extent=ie(i.extent,n.extent):i.extent=n.extent),void 0===i.zIndex&&(i.zIndex=r)}return e}getSourceState(){return"ready"}}const gs=ps,ms="prerender",ys="postrender",_s="precompose",vs="rendercomplete";function xs(t,e){if(!t.visible)return!1;const i=e.resolution;if(i<t.minResolution||i>=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}const ws=class extends hs{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(ls,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(ls)||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_&&(p(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=d(t,g,this.handleSourceChange_,this),"ready"===t.getState()&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const i=this.getMapInternal();let n;if(!t&&i&&(t=i.getView()),e=t instanceof er?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),e.layerStatesArray){if(n=e.layerStatesArray.find(t=>t.layer===this),!n)return!1}else n=this.getLayerState();const r=this.getExtent();return xs(n,e.viewState)&&(!r||oe(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];let i=e(t instanceof er?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_&&(p(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(p(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=d(t,_s,this.handlePrecompose_,this),this.mapRenderKey_=d(this,g,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);ct(!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(ls,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 bs(t,e,i=0,n=t.length-1,r=Ms){for(;n>i;){if(n-i>600){const s=n-i+1,o=e-i+1,a=Math.log(s),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);bs(t,e,Math.max(i,Math.floor(e-o*l/s+h)),Math.min(n,Math.floor(e+(s-o)*l/s+h)),r)}const s=t[e];let o=i,a=n;for(Ss(t,i,e),r(t[n],s)>0&&Ss(t,i,n);o<a;){for(Ss(t,o,a),o++,a--;r(t[o],s)<0;)o++;for(;r(t[a],s)>0;)a--}0===r(t[i],s)?Ss(t,i,a):(a++,Ss(t,a,n)),a<=e&&(i=a+1),e<=a&&(n=a-1)}}function Ss(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function Ms(t,e){return t<e?-1:t>e?1:0}class Es{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(!js(t,e))return i;const n=this.toBBox,r=[];for(;e;){for(let s=0;s<e.children.length;s++){const o=e.children[s],a=e.leaf?n(o):o;js(t,a)&&(e.leaf?i.push(o):Ls(t,a)?this._all(o,i):r.push(o))}e=r.pop()}return i}collides(t){let e=this.data;if(!js(t,e))return!1;const i=[];for(;e;){for(let n=0;n<e.children.length;n++){const r=e.children[n],s=e.leaf?this.toBBox(r):r;if(js(t,s)){if(e.leaf||Ls(t,s))return!0;i.push(r)}}e=i.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(let e=0;e<t.length;e++)this.insert(t[e]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Ns([]),this}remove(t,e){if(!t)return this;let i=this.data;const n=this.toBBox(t),r=[],s=[];let o,a,l;for(;i||r.length;){if(i||(i=r.pop(),a=r[r.length-1],o=s.pop(),l=!0),i.leaf){const n=Cs(t,i.children,e);if(-1!==n)return i.children.splice(n,1),r.push(i),this._condense(r),this}l||i.leaf||!Ls(i,n)?a?(o++,i=a.children[o],l=!1):i=null:(r.push(i),s.push(o),o=0,a=i,i=i.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,n){const r=i-e+1;let s,o=this._maxEntries;if(r<=o)return s=Ns(t.slice(e,i+1)),Ps(s,this.toBBox),s;n||(n=Math.ceil(Math.log(r)/Math.log(o)),o=Math.ceil(r/Math.pow(o,n-1))),s=Ns([]),s.leaf=!1,s.height=n;const a=Math.ceil(r/o),l=a*Math.ceil(Math.sqrt(o));Ds(t,e,i,l,this.compareMinX);for(let r=e;r<=i;r+=l){const e=Math.min(r+l-1,i);Ds(t,r,e,a,this.compareMinY);for(let i=r;i<=e;i+=a){const r=Math.min(i+a-1,e);s.children.push(this._build(t,i,r,n-1))}}return Ps(s,this.toBBox),s}_chooseSubtree(t,e,i,n){for(;n.push(e),!e.leaf&&n.length-1!==i;){let i,n=1/0,r=1/0;for(let s=0;s<e.children.length;s++){const o=e.children[s],a=As(o),l=Os(t,o)-a;l<r?(r=l,n=a<n?a:n,i=o):l===r&&a<n&&(n=a,i=o)}e=i||e.children[0]}return e}_insert(t,e,i){const n=i?t:this.toBBox(t),r=[],s=this._chooseSubtree(n,this.data,e,r);for(s.children.push(t),Ts(s,n);e>=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)}_split(t,e){const i=t[e],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);const s=this._chooseSplitIndex(i,r,n),o=Ns(i.children.splice(s,i.children.length-s));o.height=i.height,o.leaf=i.leaf,Ps(i,this.toBBox),Ps(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=Ns([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Ps(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let n,r=1/0,s=1/0;for(let o=e;o<=i-e;o++){const e=Is(t,0,o,this.toBBox),a=Is(t,o,i,this.toBBox),l=Fs(e,a),h=As(e)+As(a);l<r?(r=l,n=o,s=h<s?h:s):l===r&&h<s&&(s=h,n=o)}return n||i-e}_chooseSplitAxis(t,e,i){const n=t.leaf?this.compareMinX:Rs,r=t.leaf?this.compareMinY:ks;this._allDistMargin(t,e,i,n)<this._allDistMargin(t,e,i,r)&&t.children.sort(n)}_allDistMargin(t,e,i,n){t.children.sort(n);const r=this.toBBox,s=Is(t,0,e,r),o=Is(t,i-e,i,r);let a=Gs(s)+Gs(o);for(let n=e;n<i-e;n++){const e=t.children[n];Ts(s,t.leaf?r(e):e),a+=Gs(s)}for(let n=i-e-1;n>=e;n--){const e=t.children[n];Ts(o,t.leaf?r(e):e),a+=Gs(o)}return a}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)Ts(e[n],t)}_condense(t){for(let e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children,e.splice(e.indexOf(t[i]),1)):this.clear():Ps(t[i],this.toBBox)}}function Cs(t,e,i){if(!i)return e.indexOf(t);for(let n=0;n<e.length;n++)if(i(t,e[n]))return n;return-1}function Ps(t,e){Is(t,0,t.children.length,e,t)}function Is(t,e,i,n,r){r||(r=Ns(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=e;s<i;s++){const e=t.children[s];Ts(r,t.leaf?n(e):e)}return r}function Ts(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 Rs(t,e){return t.minX-e.minX}function ks(t,e){return t.minY-e.minY}function As(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Gs(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Os(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 Fs(t,e){const i=Math.max(t.minX,e.minX),n=Math.max(t.minY,e.minY),r=Math.min(t.maxX,e.maxX),s=Math.min(t.maxY,e.maxY);return Math.max(0,r-i)*Math.max(0,s-n)}function Ls(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function js(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function Ns(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Ds(t,e,i,n,r){const s=[e,i];for(;s.length;){if((i=s.pop())-(e=s.pop())<=n)continue;const o=e+Math.ceil((i-e)/n/2)*n;bs(t,o,e,i,r),s.push(e,o,o,i)}}const zs=[NaN,NaN,NaN,0];let qs;const $s=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Bs=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Us=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Ws=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Xs(t,e){return t.endsWith("%")?Number(t.substring(0,t.length-1))/e:Number(t)}function Vs(t){throw new Error('failed to parse "'+t+'" as color')}function Ks(t){if(t.toLowerCase().startsWith("rgb")){const e=t.match(Bs)||t.match($s)||t.match(Us);if(e){const t=e[4],i=100/255;return[mt(Xs(e[1],i)+.5|0,0,255),mt(Xs(e[2],i)+.5|0,0,255),mt(Xs(e[3],i)+.5|0,0,255),void 0!==t?mt(Xs(t,100),0,1):1]}Vs(t)}if(t.startsWith("#")){if(Ws.test(t)){const e=t.substring(1),i=e.length<=4?1:2,n=[0,0,0,255];for(let t=0,r=e.length;t<r;t+=i){let r=parseInt(e.substring(t,t+i),16);1===i&&(r+=r<<4),n[t/i]=r}return n[3]=n[3]/255,n}Vs(t)}const e=(qs||(qs=ur(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),qs);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&&Vs(t));const n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return Ks(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);const r=Array.from(e.getImageData(0,0,1,1).data);return r[3]=St(r[3]/255,3),r}const Ys={};let Zs=0;function Hs(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function Js(t){return t>.0031308?269.025*Math.pow(t,1/2.4)-14.025:3294.6*t}function Qs(t){return t>.2068965?Math.pow(t,3):108/841*(t-4/29)}function to(t){return t>10.314724?Math.pow((t+14.025)/269.025,2.4):t/3294.6}function eo(t){return t>.0088564?Math.pow(t,1/3):t/(108/841)+4/29}function io(t){const e=to(t[0]),i=to(t[1]),n=to(t[2]),r=eo(.222488403*e+.716873169*i+.06060791*n),s=500*(eo(.452247074*e+.399439023*i+.148375274*n)-r),o=200*(r-eo(.016863605*e+.117638439*i+.865350722*n)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,t[3]]}function no(t){if("none"===t)return zs;if(Ys.hasOwnProperty(t))return Ys[t];if(Zs>=1024){let t=0;for(const e in Ys)3&t++||(delete Ys[e],--Zs)}const e=Ks(t);4!==e.length&&Vs(t);for(const i of e)isNaN(i)&&Vs(t);return Ys[t]=e,++Zs,e}function ro(t){return Array.isArray(t)?t:no(t)}function so(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];return n!=(0|n)&&(n=n+.5|0),"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}function oo(t){return t[0]>0&&t[1]>0}function ao(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}let lo=0;const ho=1<<lo++,uo=1<<lo++,co=1<<lo++,fo=1<<lo++,po=1<<lo++,go=1<<lo++,mo=Math.pow(2,6)-1,yo={[ho]:"boolean",[uo]:"number",[co]:"string",[fo]:"color",[po]:"number[]",[go]:"size"},_o=Object.keys(yo).map(Number).sort(S);function vo(t){const e=[];for(const i of _o)xo(t,i)&&e.push(yo[i]);return 0===e.length?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function xo(t,e){return(t&e)===e}function wo(t,e){return t===e}class bo{constructor(t,e){if(!function(t){return t in yo}(t))throw new Error(`literal expressions must have a specific type, got ${vo(t)}`);this.type=t,this.value=e}}class So{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function Mo(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1}}function Eo(t,e,i){switch(typeof t){case"boolean":if(wo(e,co))return new bo(co,t?"true":"false");if(!xo(e,ho))throw new Error(`got a boolean, but expected ${vo(e)}`);return new bo(ho,t);case"number":if(wo(e,go))return new bo(go,ao(t));if(wo(e,ho))return new bo(ho,!!t);if(wo(e,co))return new bo(co,t.toString());if(!xo(e,uo))throw new Error(`got a number, but expected ${vo(e)}`);return new bo(uo,t);case"string":if(wo(e,fo))return new bo(fo,no(t));if(wo(e,ho))return new bo(ho,!!t);if(!xo(e,co))throw new Error(`got a string, but expected ${vo(e)}`);return new bo(co,t)}if(!Array.isArray(t))throw new Error("expression must be an array or a primitive value");if(0===t.length)throw new Error("empty expression");if("string"==typeof t[0])return function(t,e,i){const n=t[0],r=va[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(t,e,i)}(t,e,i);for(const e of t)if("number"!=typeof e)throw new Error("expected an array of numbers");if(wo(e,go)){if(2!==t.length)throw new Error(`expected an array of two values for a size, got ${t.length}`);return new bo(go,t)}if(wo(e,fo)){if(3===t.length)return new bo(fo,[...t,1]);if(4===t.length)return new bo(fo,t);throw new Error(`expected an array of 3 or 4 values for a color, got ${t.length}`)}if(!xo(e,po))throw new Error(`got an array of numbers, but expected ${vo(e)}`);return new bo(po,t)}const Co="get",Po="var",Io="concat",To="geometry-type",Ro="line-metric",ko="any",Ao="all",Go="!",Oo="resolution",Fo="zoom",Lo="time",jo="==",No="!=",Do=">",zo=">=",qo="<",$o="<=",Bo="*",Uo="/",Wo="+",Xo="-",Vo="clamp",Ko="%",Yo="^",Zo="abs",Ho="floor",Jo="ceil",Qo="round",ta="sin",ea="cos",ia="atan",na="sqrt",ra="match",sa="between",oa="interpolate",aa="coalesce",la="case",ha="in",ua="number",ca="string",da="array",fa="color",pa="id",ga="band",ma="palette",ya="to-string",_a="has",va={[Co]:Pa(Sa(1,1/0),xa),[Po]:Pa(Sa(1,1),function(t,e,i){const n=t[1];if("string"!=typeof n)throw new Error("expected a string argument for var operation");return i.variables.add(n),[new bo(co,n)]}),[_a]:Pa(Sa(1,1/0),xa),[pa]:Pa(function(t,e,i){i.featureId=!0},ba),[Io]:Pa(Sa(2,1/0),Ea(co)),[To]:Pa(function(t,e,i){i.geometryType=!0},ba),[Ro]:Pa(function(t,e,i){i.mCoordinate=!0},ba),[Oo]:Pa(wa,ba),[Fo]:Pa(wa,ba),[Lo]:Pa(wa,ba),[ko]:Pa(Sa(2,1/0),Ea(ho)),[Ao]:Pa(Sa(2,1/0),Ea(ho)),[Go]:Pa(Sa(1,1),Ea(ho)),[jo]:Pa(Sa(2,2),Ea(mo)),[No]:Pa(Sa(2,2),Ea(mo)),[Do]:Pa(Sa(2,2),Ea(uo)),[zo]:Pa(Sa(2,2),Ea(uo)),[qo]:Pa(Sa(2,2),Ea(uo)),[$o]:Pa(Sa(2,2),Ea(uo)),[Bo]:Pa(Sa(2,1/0),Ma),[aa]:Pa(Sa(2,1/0),Ma),[Uo]:Pa(Sa(2,2),Ea(uo)),[Wo]:Pa(Sa(2,1/0),Ea(uo)),[Xo]:Pa(Sa(2,2),Ea(uo)),[Vo]:Pa(Sa(3,3),Ea(uo)),[Ko]:Pa(Sa(2,2),Ea(uo)),[Yo]:Pa(Sa(2,2),Ea(uo)),[Zo]:Pa(Sa(1,1),Ea(uo)),[Ho]:Pa(Sa(1,1),Ea(uo)),[Jo]:Pa(Sa(1,1),Ea(uo)),[Qo]:Pa(Sa(1,1),Ea(uo)),[ta]:Pa(Sa(1,1),Ea(uo)),[ea]:Pa(Sa(1,1),Ea(uo)),[ia]:Pa(Sa(1,2),Ea(uo)),[na]:Pa(Sa(1,1),Ea(uo)),[ra]:Pa(Sa(4,1/0),Ca,function(t,e,i){const n=t.length-1,r=co|uo|ho,s=Eo(t[1],r,i),o=Eo(t[t.length-1],e,i),a=new Array(n-2);for(let e=0;e<n-2;e+=2){try{const n=Eo(t[e+2],s.type,i);a[e]=n}catch(t){throw new Error(`failed to parse argument ${e+1} of match expression: ${t.message}`)}try{const n=Eo(t[e+3],o.type,i);a[e+1]=n}catch(t){throw new Error(`failed to parse argument ${e+2} of match expression: ${t.message}`)}}return[s,...a,o]}),[sa]:Pa(Sa(3,3),Ea(uo)),[oa]:Pa(Sa(6,1/0),Ca,function(t,e,i){const n=t[1];let r;switch(n[0]){case"linear":r=1;break;case"exponential":const t=n[1];if("number"!=typeof t||t<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(t)} instead`);r=t;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}const s=new bo(uo,r);let o;try{o=Eo(t[2],uo,i)}catch(t){throw new Error(`failed to parse argument 1 in interpolate expression: ${t.message}`)}const a=new Array(t.length-3);for(let n=0;n<a.length;n+=2){try{const e=Eo(t[n+3],uo,i);a[n]=e}catch(t){throw new Error(`failed to parse argument ${n+2} for interpolate expression: ${t.message}`)}try{const r=Eo(t[n+4],e,i);a[n+1]=r}catch(t){throw new Error(`failed to parse argument ${n+3} for interpolate expression: ${t.message}`)}}return[s,o,...a]}),[la]:Pa(Sa(3,1/0),function(t,e,i){const n=t[0],r=t.length-1;if(r%2==0)throw new Error(`expected an odd number of arguments for ${n}, got ${r} instead`)},function(t,e,i){const n=Eo(t[t.length-1],e,i),r=new Array(t.length-1);for(let e=0;e<r.length-1;e+=2){try{const n=Eo(t[e+1],ho,i);r[e]=n}catch(t){throw new Error(`failed to parse argument ${e} of case expression: ${t.message}`)}try{const s=Eo(t[e+2],n.type,i);r[e+1]=s}catch(t){throw new Error(`failed to parse argument ${e+1} of case expression: ${t.message}`)}}return r[r.length-1]=n,r}),[ha]:Pa(Sa(2,2),function(t,e,i){let n,r=t[2];if(!Array.isArray(r))throw new Error('the second argument for the "in" operator must be an array');if("literal"===r[0]){if(r=r[1],!Array.isArray(r))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if("string"==typeof r[0])throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');n="string"==typeof r[0]?co:uo;const s=new Array(r.length);for(let t=0;t<s.length;t++)try{const e=Eo(r[t],n,i);s[t]=e}catch(e){throw new Error(`failed to parse haystack item ${t} for "in" expression: ${e.message}`)}return[Eo(t[1],n,i),...s]}),[ua]:Pa(Sa(1,1/0),Ea(mo)),[ca]:Pa(Sa(1,1/0),Ea(mo)),[da]:Pa(Sa(1,1/0),Ea(uo)),[fa]:Pa(Sa(1,4),Ea(uo)),[ga]:Pa(Sa(1,3),Ea(uo)),[ma]:Pa(Sa(2,2),function(t,e,i){let n;try{n=Eo(t[1],uo,i)}catch(t){throw new Error(`failed to parse first argument in palette expression: ${t.message}`)}const r=t[2];if(!Array.isArray(r))throw new Error("the second argument of palette must be an array");const s=new Array(r.length);for(let t=0;t<s.length;t++){let e;try{e=Eo(r[t],fo,i)}catch(e){throw new Error(`failed to parse color at index ${t} in palette expression: ${e.message}`)}if(!(e instanceof bo))throw new Error(`the palette color at index ${t} must be a literal value`);s[t]=e}return[n,...s]}),[ya]:Pa(Sa(1,1),Ea(ho|uo|co|fo))};function xa(t,e,i){const n=t.length-1,r=new Array(n);for(let e=0;e<n;++e){const n=t[e+1];switch(typeof n){case"number":r[e]=new bo(uo,n);break;case"string":r[e]=new bo(co,n);break;default:throw new Error(`expected a string key or numeric array index for a get operation, got ${n}`)}0===e&&i.properties.add(String(n))}return r}function wa(t,e,i){i.mapState=!0}function ba(t,e,i){const n=t[0];if(1!==t.length)throw new Error(`expected no arguments for ${n} operation`);return[]}function Sa(t,e){return function(i,n,r){const s=i[0],o=i.length-1;if(t===e){if(o!==t)throw new Error(`expected ${t} argument${1===t?"":"s"} for ${s}, got ${o}`)}else if(o<t||o>e)throw new Error(`expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${s}, got ${o}`)}}function Ma(t,e,i){const n=t.length-1,r=new Array(n);for(let s=0;s<n;++s){const n=Eo(t[s+1],e,i);r[s]=n}return r}function Ea(t){return function(e,i,n){const r=e.length-1,s=new Array(r);for(let i=0;i<r;++i){const r=Eo(e[i+1],t,n);s[i]=r}return s}}function Ca(t,e,i){const n=t[0],r=t.length-1;if(r%2==1)throw new Error(`expected an even number of arguments for operation ${n}, got ${r} instead`)}function Pa(...t){return function(e,i,n){const r=e[0];let s;for(let r=0;r<t.length;r++){const o=t[r](e,i,n);if(r==t.length-1){if(!o)throw new Error("expected last argument validator to return the parsed args");s=o}}return new So(i,r,...s)}}function Ia(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 Ia(t.getGeometries()[0]);default:return""}}function Ta(t,e,i){return Ra(Eo(t,e,i),i)}function Ra(t,e){if(t instanceof bo){if(t.type===fo&&"string"==typeof t.value){const e=no(t.value);return function(){return e}}return function(){return t.value}}const i=t.operator;switch(i){case ua:case ca:case aa:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=Ra(t.args[i],e);switch(i){case aa:return t=>{for(let e=0;e<n;++e){const i=r[e](t);if(null!=i)return i}throw new Error("Expected one of the values to be non-null")};case ua:case ca:return t=>{for(let e=0;e<n;++e){const n=r[e](t);if(typeof n===i)return n}throw new Error(`Expected one of the values to be a ${i}`)};default:throw new Error(`Unsupported assertion operator ${i}`)}}(t,e);case Co:case Po:case _a:return function(t){const e=t.args[0].value;switch(t.operator){case Co:return i=>{const n=t.args;let r=i.properties[e];for(let t=1,e=n.length;t<e;++t)r=r[n[t].value];return r};case Po:return t=>t.variables[e];case _a:return i=>{const n=t.args;if(!(e in i.properties))return!1;let r=i.properties[e];for(let t=1,e=n.length;t<e;++t){const e=n[t].value;if(!r||!Object.hasOwn(r,e))return!1;r=r[e]}return!0};default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}(t);case"id":return t=>t.featureId;case To:return t=>t.geometryType;case Io:{const i=t.args.map(t=>Ra(t,e));return t=>"".concat(...i.map(e=>e(t).toString()))}case Oo:return t=>t.resolution;case ko:case Ao:case sa:case ha:case"!":return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=Ra(t.args[i],e);switch(i){case ko:return t=>{for(let e=0;e<n;++e)if(r[e](t))return!0;return!1};case Ao:return t=>{for(let e=0;e<n;++e)if(!r[e](t))return!1;return!0};case sa:return t=>{const e=r[0](t),i=r[1](t),n=r[2](t);return e>=i&&e<=n};case ha:return t=>{const e=r[0](t);for(let i=1;i<n;++i)if(e===r[i](t))return!0;return!1};case"!":return t=>!r[0](t);default:throw new Error(`Unsupported logical operator ${i}`)}}(t,e);case jo:case No:case"<":case $o:case">":case zo:return function(t,e){const i=t.operator,n=Ra(t.args[0],e),r=Ra(t.args[1],e);switch(i){case jo:return t=>n(t)===r(t);case No:return t=>n(t)!==r(t);case"<":return t=>n(t)<r(t);case $o:return t=>n(t)<=r(t);case">":return t=>n(t)>r(t);case zo:return t=>n(t)>=r(t);default:throw new Error(`Unsupported comparison operator ${i}`)}}(t,e);case"*":case"/":case"+":case"-":case Vo:case"%":case"^":case Zo:case Ho:case Jo:case Qo:case ta:case ea:case ia:case na:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=Ra(t.args[i],e);switch(i){case"*":return t=>{let e=1;for(let i=0;i<n;++i)e*=r[i](t);return e};case"/":return t=>r[0](t)/r[1](t);case"+":return t=>{let e=0;for(let i=0;i<n;++i)e+=r[i](t);return e};case"-":return t=>r[0](t)-r[1](t);case Vo:return t=>{const e=r[0](t),i=r[1](t);if(e<i)return i;const n=r[2](t);return e>n?n:e};case"%":return t=>r[0](t)%r[1](t);case"^":return t=>Math.pow(r[0](t),r[1](t));case Zo:return t=>Math.abs(r[0](t));case Ho:return t=>Math.floor(r[0](t));case Jo:return t=>Math.ceil(r[0](t));case Qo:return t=>Math.round(r[0](t));case ta:return t=>Math.sin(r[0](t));case ea:return t=>Math.cos(r[0](t));case ia:return 2===n?t=>Math.atan2(r[0](t),r[1](t)):t=>Math.atan(r[0](t));case na:return t=>Math.sqrt(r[0](t));default:throw new Error(`Unsupported numeric operator ${i}`)}}(t,e);case la:return function(t,e){const i=t.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=Ra(t.args[r],e);return t=>{for(let e=0;e<i-1;e+=2)if(n[e](t))return n[e+1](t);return n[i-1](t)}}(t,e);case ra:return function(t,e){const i=t.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=Ra(t.args[r],e);return t=>{const e=n[0](t);for(let r=1;r<i-1;r+=2)if(e===n[r](t))return n[r+1](t);return n[i-1](t)}}(t,e);case oa:return function(t,e){const i=t.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=Ra(t.args[r],e);return t=>{const e=n[0](t),r=n[1](t);let s,o;for(let a=2;a<i;a+=2){const i=n[a](t);let l=n[a+1](t);const h=Array.isArray(l);if(h&&(l=Hs(l)),i>=r)return 2===a?l:h?Aa(e,r,s,o,i,l):ka(e,r,s,o,i,l);s=i,o=l}return o}}(t,e);case ya:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=Ra(t.args[i],e);if(i===ya)return e=>{const i=r[0](e);return t.args[0].type===fo?so(i):i.toString()};throw new Error(`Unsupported convert operator ${i}`)}(t,e);default:throw new Error(`Unsupported operator ${i}`)}}function ka(t,e,i,n,r,s){const o=r-i;if(0===o)return n;const a=e-i;return n+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(s-n)}function Aa(t,e,i,n,r,s){if(0===r-i)return n;const o=io(n),a=io(s);let l=a[2]-o[2];return l>180?l-=360:l<-180&&(l+=360),function(t){const e=(t[0]+16)/116,i=t[1],n=t[2]*Math.PI/180,r=Qs(e),s=Qs(e+i/500*Math.cos(n)),o=Qs(e-i/200*Math.sin(n)),a=Js(3.021973625*s-1.617392459*r-.404875592*o),l=Js(-.943766287*s+1.916279586*r+.027607165*o),h=Js(.069407491*s-.22898585*r+1.159737864*o);return[mt(a+.5|0,0,255),mt(l+.5|0,0,255),mt(h+.5|0,0,255),t[3]]}([ka(t,e,i,o[0],r,a[0]),ka(t,e,i,o[1],r,a[1]),o[2]+ka(t,e,i,0,r,l),ka(t,e,i,n[3],r,s[3])])}function Ga(t,e){return t+":"+(e?ro(e):"null")}const Oa=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=Ga(t,e);return i in this.cache_?this.cache_[i]:null}getPattern(t,e){const i=Ga(t,e);return i in this.patternCache_?this.patternCache_[i]:null}set(t,e,i,n){const r=Ga(t,e),s=r in this.cache_;this.cache_[r]=i,n&&(0===i.getImageState()&&i.load(),1===i.getImageState()?i.ready().then(()=>{this.patternCache_[r]=dr().createPattern(i.getImage(1),"repeat")}):this.patternCache_[r]=dr().createPattern(i.getImage(1),"repeat")),s||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};let Fa=null;class La extends F{constructor(t,e,i,n,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i?.crossOrigin,this.referrerPolicy_=i?.referrerPolicy,this.canvas_={},this.color_=r,this.imageState_=void 0===n?0:n,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(void 0===this.tainted_&&2===this.imageState_){Fa||(Fa=ur(1,1,void 0,{willReadFrequently:!0})),Fa.drawImage(this.image_,0,0);try{Fa.getImageData(0,0,1,1),this.tainted_=!1}catch{Fa=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(g)}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=ur(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&&tt?new Promise((e,i)=>t.decode().then(()=>e(t)).catch(n=>t.complete&&t.width?e(t):i(n))):function(t){return new Promise((e,i)=>{function n(){s(),e(t)}function r(){s(),i(new Error("Image load error"))}function s(){t.removeEventListener("load",n),t.removeEventListener("error",r)}t.addEventListener("load",n),t.addEventListener("error",r)})}(t)).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}var t,e}replaceColor_(t){if(!this.color_||this.canvas_[t]||2!==this.imageState_)return;const e=this.image_,i=ur(Math.ceil(e.width*t),Math.ceil(e.height*t)),n=i.canvas;var r;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle="string"==typeof(r=this.color_)?r:so(r),i.fillRect(0,0,n.width/t,n.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=n}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(2===this.imageState_||3===this.imageState_)t();else{const e=()=>{2!==this.imageState_&&3!==this.imageState_||(this.removeEventListener(g,e),t())};this.addEventListener(g,e)}})),this.ready_}}function ja(t,e,i,n,r,s){let o=void 0===e?void 0:Oa.get(e,r);return o||(o=new La(t,t&&"src"in t?t.src||void 0:e,i,n,r),Oa.set(e,r,o,s)),s&&o&&!Oa.getPattern(e,r)&&Oa.set(e,r,o,s),o}const Na=La;function Da(t){return t?Array.isArray(t)?so(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return Oa.getPattern(t.src,t.color);const e=t.src+":"+t.offset,i=Oa.getPattern(e,t.color);if(i)return i;const n=Oa.get(t.src,null);if(2!==n.getImageState())return null;const r=ur(t.size[0],t.size[1]);return r.drawImage(n.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),ja(r.canvas,e,void 0,2,t.color,!0),Oa.getPattern(e,t.color)}(t):t:null}const za="10px sans-serif",qa="#000",$a="round",Ba=[],Ua="round",Wa="#000",Xa="center",Va="middle",Ka=[0,0,0,0],Ya=new $;let Za,Ha=null;const Ja={},Qa=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function tl(t,e,i){return`${t} ${e} 16px "${i}"`}const el=function(){const t=100;let e,i;async function n(t){await i.ready;const e=await i.load(t);if(0===e.length)return!1;const n=hr(t),r=n.families[0].toLowerCase(),s=n.weight;return e.some(t=>{const e=t.family.replace(/^['"]|['"]$/g,"").toLowerCase(),i=lr[t.weight]||t.weight;return e===r&&t.style===n.style&&i==s})}async function r(){await i.ready;let s=!0;const o=Ya.getProperties(),a=Object.keys(o).filter(e=>o[e]<t);for(let e=a.length-1;e>=0;--e){const i=a[e];let r=o[i];r<t&&(await n(i)?(u(Ja),Ya.set(i,t)):(r+=10,Ya.set(i,r,!0),r<t&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(t){i||(i=Q?self.fonts:document.fonts);const n=hr(t);if(!n)return;const s=n.families;let o=!1;for(const t of s){if(Qa.has(t))continue;const e=tl(n.style,n.weight,t);void 0===Ya.get(e)&&(Ya.set(e,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(r,100))}}(),il=function(){let t;return function(e){let i=Ja[e];if(null==i){if(Q){const t=hr(e),n=nl(e,"Žg");i=(isNaN(Number(t.lineHeight))?1.2:Number(t.lineHeight))*(n.actualBoundingBoxAscent+n.actualBoundingBoxDescent)}else t||(t=document.createElement("div"),t.innerHTML="M",t.style.minHeight="0",t.style.maxHeight="none",t.style.height="auto",t.style.padding="0",t.style.border="none",t.style.position="absolute",t.style.display="block",t.style.left="-99999px"),t.style.font=e,document.body.appendChild(t),i=t.offsetHeight,document.body.removeChild(t);Ja[e]=i}return i}}();function nl(t,e){return Ha||(Ha=ur(1,1)),t!=Za&&(Ha.font=t,Za=Ha.font),Ha.measureText(e)}function rl(t,e){return nl(t,e).width}function sl(t,e,i){if(e in i)return i[e];const n=e.split("\n").reduce((e,i)=>Math.max(e,rl(t,i)),0);return i[e]=n,n}class ol{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=ao(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new ol({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 N()}getImage(t){return N()}getHitDetectionImage(){return N()}getPixelRatio(t){return 1}getImageState(){return N()}getImageSize(){return N()}getOrigin(){return N()}getSize(){return N()}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_=ao(t)}listenImageChange(t){N()}load(){N()}unlistenImageChange(t){N()}ready(){return Promise.resolve()}}const al=ol;class ll extends al{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 ll({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let n=Oa.get(i,null)?.getImage(1);if(!n){const e=this.renderOptions_,r=Math.ceil(e.size*t),s=ur(r,r);this.draw_(e,s,t),n=s.canvas;const o=new Na(n,void 0,null,2,null);Oa.set(i,null,o),createImageBitmap(n).then(t=>{o.setImage(t)})}return n}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(t){this.radius!==t&&(this.radius=t,this.render())}getRadius2(){return this.radius2_}setRadius2(t){this.radius2_!==t&&(this.radius2_=t,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let n=this.radius,r=void 0===this.radius2_?n:this.radius2_;if(n<r){const t=n;n=r,r=t}const s=void 0===this.radius2_?this.points_:2*this.points_,o=2*Math.PI/s,a=r*Math.sin(o),l=n-Math.sqrt(r*r-a*a),h=Math.sqrt(a*a+l*l),u=h/a;if("miter"===t&&u<=i)return u*e;const c=e/2/u,d=e/2*(l/h),f=Math.sqrt((n+c)*(n+c)+d*d)-n;if(void 0===this.radius2_||"bevel"===t)return 2*f;const p=n*Math.sin(o),g=r-Math.sqrt(n*n-p*p),m=Math.sqrt(p*p+g*g)/p;if(m<=i){const t=m*e/2-r-n;return 2*Math.max(f,t)}return 2*f}createRenderOptions(){let t,e=$a,i=Ua,n=0,r=null,s=0,o=0;this.stroke_&&(t=Da(this.stroke_.getColor()??Wa),o=this.stroke_.getWidth()??1,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,i=this.stroke_.getLineJoin()??Ua,e=this.stroke_.getLineCap()??$a,n=this.stroke_.getMiterLimit()??10);const a=this.calculateLineJoinSize_(i,o,n),l=Math.max(this.radius,this.radius2_||0);return{strokeStyle:t,strokeWidth:o,size:Math.ceil(2*l+a),lineCap:e,lineDash:r,lineDashOffset:s,lineJoin:i,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let t=this.fill_.getColor();null===t&&(t=qa),e.fillStyle=Da(t),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),n=0;"string"==typeof i&&(i=ro(i)),null===i?n=1:Array.isArray(i)&&(n=4===i.length?i[3]:1),0===n&&(e=ur(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const n=void 0===this.radius2_?i:this.radius2_;void 0!==this.radius2_&&(e*=2);const r=this.angle_-Math.PI/2,s=2*Math.PI/e;for(let o=0;o<e;o++){const e=r+o*s,a=o%2==0?i:n;t.lineTo(a*Math.cos(e),a*Math.sin(e))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=qa,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 hl=ll;class ul extends hl{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 ul({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 cl=ul;class dl{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 dl({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=ja(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?z(t):"object"==typeof t&&"src"in t?t.src+":"+t.offset:ro(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}const fl=dl;function pl(t,e,i,n){return void 0!==i&&void 0!==n?[i/t,n/e]:void 0!==i?i/t:void 0!==n?n/e:1}class gl extends al{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,n=void 0!==t.scale?t.scale:1,r=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:n,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy;const s=void 0!==t.img?t.img:null;let o,a=t.src;if(ct(!(void 0!==a&&s),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!s||(a=s.src||z(s)),ct(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),ct(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==t.src?o=0:void 0!==s&&(o="complete"in s?s.complete?s.src?2:0:1:2),this.color_=void 0!==t.color?ro(t.color):null,this.iconImage_=ja(s,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},o,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,this.initialOptions_,void 0!==t.width||void 0!==t.height){let e,i;if(t.size)[e,i]=t.size;else{const n=this.getImage(1);if(n.width&&n.height)e=n.width,i=n.height;else if(n instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(pl(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(pl(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 gl({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?ro(t):null;if(this.color_===e||this.color_&&e&&this.color_.length===e.length&&this.color_.every((t,i)=>t===e[i]))return;this.color_=e;const i=this.getSrc(),n=void 0!==i?null:this.getHitDetectionImage(),r=void 0!==i?0:this.iconImage_.getImageState();this.iconImage_=ja(n,i,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},r,this.color_)}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if("top-left"!=this.offsetOrigin_){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=ja(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(g,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(g,t)}ready(){return this.iconImage_.ready()}}const ml=gl;class yl{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 yl({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 _l=yl;class vl{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=bl,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 vl({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_=bl,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let xl=null;function wl(t,e){if(!xl){const t=new fl({color:"rgba(255,255,255,0.4)"}),e=new _l({color:"#3399CC",width:1.25});xl=[new vl({image:new cl({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return xl}function bl(t){return t.getGeometry()}const Sl=vl;class Ml{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_=ao(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 fl({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 Ml({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 fl?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_=ao(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 El=Ml;function Cl(t){return!0}function Pl(t){const e=Mo(),i=function(t,e){const i=t.length,n=new Array(i);for(let r=0;r<i;++r){const i=t[r],s="filter"in i?Ta(i.filter,ho,e):Cl;let o;if(Array.isArray(i.style)){const t=i.style.length;o=new Array(t);for(let n=0;n<t;++n)o[n]=Tl(i.style[n],e)}else o=[Tl(i.style,e)];n[r]={filter:s,styles:o}}return function(e){const r=[];let s=!1;for(let o=0;o<i;++o)if((0,n[o].filter)(e)&&(!t[o].else||!s)){s=!0;for(const t of n[o].styles){const i=t(e);i&&r.push(i)}}return r}}(t,e),n={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""};return function(t,r){if(n.properties=t.getPropertiesInternal(),n.resolution=r,e.featureId){const e=t.getId();n.featureId=void 0!==e?e:null}return e.geometryType&&(n.geometryType=Ia(t.getGeometry())),i(n)}}function Il(t){const e=Mo(),i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=Tl(t[r],e);const r={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""},s=new Array(i);return function(t,o){if(r.properties=t.getPropertiesInternal(),r.resolution=o,e.featureId){const e=t.getId();r.featureId=void 0!==e?e:null}let a=0;for(let t=0;t<i;++t){const e=n[t](r);e&&(s[a]=e,a+=1)}return s.length=a,s}}function Tl(t,e){const i=Rl(t,"",e),n=kl(t,"",e),r=function(t,e){const i="text-",n=Ol(t,i+"value",e);if(!n)return null;const r=Rl(t,i,e),s=Rl(t,i+"background-",e),o=kl(t,i,e),a=kl(t,i+"background-",e),l=Ol(t,i+"font",e),h=Gl(t,i+"max-angle",e),u=Gl(t,i+"offset-x",e),c=Gl(t,i+"offset-y",e),d=Fl(t,i+"overflow",e),f=Ol(t,i+"placement",e),p=Gl(t,i+"repeat",e),g=zl(t,i+"scale",e),m=Fl(t,i+"rotate-with-view",e),y=Gl(t,i+"rotation",e),_=Ol(t,i+"align",e),v=Ol(t,i+"justify",e),x=Ol(t,i+"baseline",e),w=Fl(t,i+"keep-upright",e),b=jl(t,i+"padding",e),S=Ul(t,i+"declutter-mode"),M=new El({declutterMode:S});return function(t){if(M.setText(n(t)),r&&M.setFill(r(t)),s&&M.setBackgroundFill(s(t)),o&&M.setStroke(o(t)),a&&M.setBackgroundStroke(a(t)),l&&M.setFont(l(t)),h&&M.setMaxAngle(h(t)),u&&M.setOffsetX(u(t)),c&&M.setOffsetY(c(t)),d&&M.setOverflow(d(t)),f){const e=f(t);if("point"!==e&&"line"!==e)throw new Error("Expected point or line for text-placement");M.setPlacement(e)}if(p&&M.setRepeat(p(t)),g&&M.setScale(g(t)),m&&M.setRotateWithView(m(t)),y&&M.setRotation(y(t)),_){const e=_(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");M.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");M.setJustify(e)}if(x){const e=x(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");M.setTextBaseline(e)}return b&&M.setPadding(b(t)),w&&M.setKeepUpright(w(t)),M}}(t,e),s=function(t,e){return"icon-src"in t?function(t,e){const i="icon-",n=i+"src",r=Xl(t[n],n),s=Nl(t,i+"anchor",e),o=zl(t,i+"scale",e),a=Gl(t,i+"opacity",e),l=Nl(t,i+"displacement",e),h=Gl(t,i+"rotation",e),u=Fl(t,i+"rotate-with-view",e),c=$l(t,i+"anchor-origin"),d=Bl(t,i+"anchor-x-units"),f=Bl(t,i+"anchor-y-units"),p=Al(t,i+"color");let g,m=null;void 0!==p&&(Array.isArray(p)&&p.length>0&&"string"==typeof p[0]?m=Ll(t,i+"color",e):g=Kl(p,i+"color"));const y=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"),_=function(t,e){const i=t[e];if(void 0!==i)return Wl(i,e)}(t,i+"offset"),v=$l(t,i+"offset-origin"),x=ql(t,i+"width"),w=ql(t,i+"height"),b=function(t,e){const i=t[e];if(void 0!==i){if("number"==typeof i)return ao(i);if(!Array.isArray(i))throw new Error(`Expected a number or size array for ${e}`);if(2!==i.length||"number"!=typeof i[0]||"number"!=typeof i[1])throw new Error(`Expected a number or size array for ${e}`);return i}}(t,i+"size"),S={src:r,anchorOrigin:c,anchorXUnits:d,anchorYUnits:f,crossOrigin:y,offset:_,offsetOrigin:v,height:w,width:x,size:b,declutterMode:Ul(t,i+"declutter-mode")};let M=null;return function(t){if(M)m&&M.setColor(m(t));else{const e=m?m(t):g;M=new ml(void 0!==e?Object.assign({},S,{color:e}):Object.assign({},S))}return a&&M.setOpacity(a(t)),l&&M.setDisplacement(l(t)),h&&M.setRotation(h(t)),u&&M.setRotateWithView(u(t)),o&&M.setScale(o(t)),s&&M.setAnchor(s(t)),M}}(t,e):"shape-points"in t?function(t,e){const i="shape-",n=i+"points",r=i+"radius",s=Vl(t[n],n);if(!(r in t))throw new Error(`Expected a number for ${r}`);const o=Gl(t,r,e),a="number"==typeof t[r]?t[r]:5,l=i+"radius2",h=Gl(t,l,e),u="number"==typeof t[l]?t[l]:void 0,c=Rl(t,i,e),d=kl(t,i,e),f=zl(t,i+"scale",e),p=Nl(t,i+"displacement",e),g=Gl(t,i+"rotation",e),m=Fl(t,i+"rotate-with-view",e),y=ql(t,i+"angle"),_=Ul(t,i+"declutter-mode"),v=new hl({points:s,radius:a,radius2:u,angle:y,declutterMode:_});return function(t){return o&&v.setRadius(o(t)),h&&v.setRadius2(h(t)),c&&v.setFill(c(t)),d&&v.setStroke(d(t)),p&&v.setDisplacement(p(t)),g&&v.setRotation(g(t)),m&&v.setRotateWithView(m(t)),f&&v.setScale(f(t)),v}}(t,e):"circle-radius"in t?function(t,e){const i="circle-",n=Rl(t,i,e),r=kl(t,i,e),s=Gl(t,i+"radius",e),o=zl(t,i+"scale",e),a=Nl(t,i+"displacement",e),l=Gl(t,i+"rotation",e),h=Fl(t,i+"rotate-with-view",e),u=Ul(t,i+"declutter-mode"),c=new cl({radius:5,declutterMode:u});return function(t){return s&&c.setRadius(s(t)),n&&c.setFill(n(t)),r&&c.setStroke(r(t)),a&&c.setDisplacement(a(t)),l&&c.setRotation(l(t)),h&&c.setRotateWithView(h(t)),o&&c.setScale(o(t)),c}}(t,e):null}(t,e),o=Gl(t,"z-index",e);if(!(i||n||r||s||c(t)))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(t));const a=new Sl;return function(t){let e=!0;if(i){const n=i(t);n&&(e=!1),a.setFill(n)}if(n){const i=n(t);i&&(e=!1),a.setStroke(i)}if(r){const i=r(t);i&&(e=!1),a.setText(i)}if(s){const i=s(t);i&&(e=!1),a.setImage(i)}return o&&a.setZIndex(o(t)),e?null:a}}function Rl(t,e,i){let n;if(e+"fill-pattern-src"in t)n=function(t,e,i){const n=Ol(t,e+"pattern-src",i),r=Dl(t,e+"pattern-offset",i),s=Dl(t,e+"pattern-size",i),o=Ll(t,e+"color",i);return function(t){return{src:n(t),offset:r&&r(t),size:s&&s(t),color:o&&o(t)}}}(t,e+"fill-",i);else{if("none"===t[e+"fill-color"])return t=>null;n=Ll(t,e+"fill-color",i)}if(!n)return null;const r=new fl;return function(t){const e=n(t);return e===zs?null:(r.setColor(e),r)}}function kl(t,e,i){const n=Gl(t,e+"stroke-width",i),r=Ll(t,e+"stroke-color",i);if(!n&&!r)return null;const s=Ol(t,e+"stroke-line-cap",i),o=Ol(t,e+"stroke-line-join",i),a=jl(t,e+"stroke-line-dash",i),l=Gl(t,e+"stroke-line-dash-offset",i),h=Gl(t,e+"stroke-miter-limit",i),u=Gl(t,e+"stroke-offset",i),c=new _l;return function(t){if(r){const e=r(t);if(e===zs)return null;c.setColor(e)}if(n&&c.setWidth(n(t)),s){const e=s(t);if("butt"!==e&&"round"!==e&&"square"!==e)throw new Error("Expected butt, round, or square line cap");c.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");c.setLineJoin(e)}return a&&c.setLineDash(a(t)),l&&c.setLineDashOffset(l(t)),h&&c.setMiterLimit(h(t)),u&&c.setOffset(u(t)),c}}function Al(t,e){if(!(e in t))return;const i=t[e];return void 0===i?void 0:i}function Gl(t,e,i){const n=Al(t,e);if(void 0===n)return;const r=Ta(n,uo,i);return function(t){return Vl(r(t),e)}}function Ol(t,e,i){const n=Al(t,e);if(void 0===n)return null;const r=Ta(n,co,i);return function(t){return Xl(r(t),e)}}function Fl(t,e,i){const n=Al(t,e);if(void 0===n)return null;const r=Ta(n,ho,i);return function(t){const i=r(t);if("boolean"!=typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function Ll(t,e,i){const n=Al(t,e);if(void 0===n)return null;const r=Ta(n,fo,i);return function(t){return Kl(r(t),e)}}function jl(t,e,i){const n=Al(t,e);if(void 0===n)return null;if(Array.isArray(n)&&(0===n.length||"string"!=typeof n[0])){const t=n.map((t,n)=>{if("number"==typeof t)return()=>t;const r=Ta(t,uo,i);return function(t){return Vl(r(t),`${e}[${n}]`)}});return function(e){const i=new Array(t.length);for(let n=0;n<t.length;++n)i[n]=t[n](e);return i}}const r=Ta(n,po,i);return function(t){return Wl(r(t),e)}}function Nl(t,e,i){const n=Al(t,e);if(void 0===n)return null;const r=Ta(n,po,i);return function(t){const i=Wl(r(t),e);if(2!==i.length)throw new Error(`Expected two numbers for ${e}`);return i}}function Dl(t,e,i){const n=Al(t,e);if(void 0===n)return null;const r=Ta(n,po,i);return function(t){return Yl(r(t),e)}}function zl(t,e,i){const n=Al(t,e);if(void 0===n)return null;const r=Ta(n,po|uo,i);return function(t){return i=r(t),n=e,"number"==typeof i?i:Yl(i,n);var i,n}}function ql(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 $l(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 Bl(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 Ul(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 Wl(t,e){if(!Array.isArray(t))throw new Error(`Expected an array for ${e}`);const i=t.length;for(let n=0;n<i;++n)if("number"!=typeof t[n])throw new Error(`Expected an array of numbers for ${e}`);return t}function Xl(t,e){if("string"!=typeof t)throw new Error(`Expected a string for ${e}`);return t}function Vl(t,e){if("number"!=typeof t)throw new Error(`Expected a number for ${e}`);return t}function Kl(t,e){if("string"==typeof t)return t;const i=Wl(t,e),n=i.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function Yl(t,e){const i=Wl(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}const Zl="renderOrder",Hl=class extends ws{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(Zl)}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 Es(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Zl,t)}setStyle(t){this.style_=void 0===t?wl:t;const e=function(t){if(void 0===t)return wl;if(!t)return null;if("function"==typeof t)return t;if(t instanceof Sl)return t;if(!Array.isArray(t))return Il([t]);if(0===t.length)return[];const e=t.length,i=t[0];if(i instanceof Sl){const i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!(e instanceof Sl))throw new Error("Expected a list of style instances");i[n]=e}return i}if("style"in i){const i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!("style"in e))throw new Error("Expected a list of rules with a style property");i[n]=e}return Pl(i)}return Il(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:(ct("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()}},Jl=class extends O{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}};function Ql(t,e){Oa.expire()}const th=class extends b{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){N()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=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]),Ki(n,i)}forEachFeatureAtCoordinate(t,e,i,n,r,s,o,a){let l;const h=e.viewState;function u(t,e,i,n){return r.call(s,e,t?i:null,n)}const c=h.projection,d=de(t.slice(),c),f=[[0,0]];if(c.canWrapX()&&n){const t=se(c.getExtent());f.push([-t,0],[t,0])}const p=e.layerStatesArray,g=p.length,m=[],y=[];for(let n=0;n<f.length;n++)for(let r=g-1;r>=0;--r){const s=p[r],c=s.layer;if(c.hasRenderer()&&xs(s,h)&&o.call(a,c)){const r=c.getRenderer(),o=c.getSource();if(r&&o){const a=o.getWrapX()?d:t,h=u.bind(null,s.managed);y[0]=a[0]+f[n][0],y[1]=a[1]+f[n][1],l=r.forEachFeatureAtCoordinate(y,e,i,h,m)}if(l)return l}}if(0===m.length)return;const _=1/m.length;return m.forEach((t,e)=>t.distanceSq+=e*_),m.sort((t,e)=>t.distanceSq-e.distanceSq),m.some(t=>l=t.callback(t.feature,t.layer,t.geometry)),l}hasFeatureAtCoordinate(t,e,i,n,r,s){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,n,T,this,r,s)}getMap(){return this.map_}renderFrame(t){N()}scheduleExpireIconCache(t){Oa.canExpireCache()&&t.postRenderFunctions.push(Ql)}},eh=class extends th{constructor(t){super(t),this.fontChangeListenerKey_=d(Ya,h,t.redrawText,t),this.element_=Q?gr():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=nr+" 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 n=new Jl(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){p(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(_s,t);const e=t.layerStatesArray.sort((t,e)=>t.zIndex-e.zIndex);e.some(t=>t.layer instanceof Hl&&t.layer.getDeclutter())&&(t.declutter={});const i=t.viewState;this.children_.length=0;const n=[];let r=null;for(let s=0,o=e.length;s<o;++s){const o=e[s];t.layerIndex=s;const a=o.layer,l=a.getSourceState();if(!xs(o,i)||"ready"!=l&&"undefined"!=l){a.unrender();continue}const h=a.render(t,r);h&&(h!==r&&(this.children_.push(h),r=h),n.push(o))}this.declutter(t,n),function(t,e){const i=t.childNodes;for(let n=0;;++n){const r=i[n],s=e[n];if(!r&&!s)break;r!==s&&(r?s?t.insertBefore(s,r):(t.removeChild(r),--n):t.appendChild(s))}}(this.element_,this.children_);const s=this.getMap().getTargetElement();if(mr(s)){const t=s.getContext("2d");for(const e of this.children_){const i=e.firstElementChild||e,n=e.style.backgroundColor;if(n&&(!mr(i)||i.width>0)&&(t.fillStyle=n,t.fillRect(0,0,s.width,s.height)),mr(i)&&i.width>0){t.save();const n=e.style.opacity||i.style.opacity;t.globalAlpha=""===n?1:Number(n);const r=i.style.transform;if(r)t.transform(...Zi(r));else{const e=parseFloat(i.style.width)/i.width,n=parseFloat(i.style.height)/i.height;t.transform(e,0,0,n,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 n=e[i],r=n.layer;r.getDeclutter()&&r.renderDeclutter(t,n)}e.forEach(e=>e.layer.renderDeferred(t))}}};function ih(t){t instanceof ws?t.setMapInternal(null):t instanceof gs&&t.getLayers().forEach(ih)}function nh(t,e){if(t instanceof ws)t.setMapInternal(e);else if(t instanceof gs){const i=t.getLayers().getArray();for(let t=0,n=i.length;t<n;++t)nh(i[t],e)}}const rh=class extends ${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={},n=t.layers&&"function"==typeof t.layers.getLayers?t.layers:new gs({layers:t.layers});let r,s,o;return i[at]=n,i[ht]=t.target,i[ut]=t.view instanceof er?t.view:new er,void 0!==t.controls&&(Array.isArray(t.controls)?r=new W(t.controls.slice()):(ct("function"==typeof t.controls.getArray,"Expected `controls` to be an array or an `ol/Collection.js`"),r=t.controls)),void 0!==t.interactions&&(Array.isArray(t.interactions)?s=new W(t.interactions.slice()):(ct("function"==typeof t.interactions.getArray,"Expected `interactions` to be an array or an `ol/Collection.js`"),s=t.interactions)),void 0!==t.overlays?Array.isArray(t.overlays)?o=new W(t.overlays.slice()):(ct("function"==typeof t.overlays.getArray,"Expected `overlays` to be an array or an `ol/Collection.js`"),o=t.overlays):o=new W,{controls:r,interactions:s,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:J,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,Q||(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,Q||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=e.controls||(Q?new W:function(t){t=t||{};const e=new W;return(void 0===t.zoom||t.zoom)&&e.push(new xr(t.zoomOptions)),(void 0===t.rotate||t.rotate)&&e.push(new vr(t.rotateOptions)),(void 0===t.attribution||t.attribution)&&e.push(new _r(t.attributionOptions)),e}()),this.interactions=e.interactions||(Q?new W:Qr({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new pt(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(at,this.handleLayerGroupChanged_),this.addChangeListener(ut,this.handleViewChanged_),this.addChangeListener(lt,this.handleSizeChanged_),this.addChangeListener(ht,this.handleTargetChanged_),this.setProperties(e.values);const i=this;!t.view||t.view instanceof er||t.view.then(function(t){i.setView(new er(t))}),this.controls.addEventListener(a,t=>{t.element.setMap(this)}),this.controls.addEventListener(l,t=>{t.element.setMap(null)}),this.interactions.addEventListener(a,t=>{t.element.setMap(this)}),this.interactions.addEventListener(l,t=>{t.element.setMap(null)}),this.overlays_.addEventListener(a,t=>{this.addOverlayInternal_(t.element)}),this.overlays_.addEventListener(l,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){nh(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 n=this.getCoordinateFromPixelInternal(t),r=void 0!==(i=void 0!==i?i:{}).hitTolerance?i.hitTolerance:0,s=void 0!==i.layerFilter?i.layerFilter:T,o=!1!==i.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,r,o,e,null,s,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 gs?e(i.getLayers()):t.push(i)})}(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t),n=void 0!==(e=void 0!==e?e:{}).layerFilter?e.layerFilter:T,r=void 0!==e.hitTolerance?e.hitTolerance:0,s=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,s,n,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(),n=e.width/i[0],r=e.height/i[1],s="changedTouches"in t?t.changedTouches[0]:t;return[(s.clientX-e.left)/n,(s.clientY-e.top)/r]}getTarget(){return this.get(ht)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return Ai(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?Wi(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(at)}setLayers(t){const e=this.getLayerGroup();if(t instanceof W)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 n=i.layer.getRenderer();if(n&&!n.ready)return!0;const r=i.layer.getSource();if(r&&r.loading)return!0}return!1}getPixelFromCoordinate(t){const e=Gi(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?Wi(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(lt)}getView(){return this.get(ut)}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,n){return function(t,e,i,n,r){if(!t||!(i in t.wantedTiles))return dt;if(!t.wantedTiles[i][e.getKey()])return dt;const s=t.viewState.center,o=n[0]-s[0],a=n[1]-s[1];return 65536*Math.log(r)+Math.sqrt(o*o+a*a)/r}(this.frameState_,t,e,i,n)}handleBrowserEvent(t,e){e=e||t.type;const i=new V(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===it||i===w||i===_){const t=this.getOwnerDocument(),i=this.viewport_.getRootNode?this.viewport_.getRootNode():t,n=e.target,r=i instanceof ShadowRoot?i.host===n?i.host.ownerDocument:i:i===t?t.documentElement:i;if(this.overlayContainerStopEvent_.contains(n)||!r.contains(n))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 n=e[i];if(n.getMap()===this&&n.getActive()&&this.getTargetElement()&&(!n.handleEvent(t)||t.propagationStopped))break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let i=this.maxTilesLoading_,n=i;const r=t?t.viewHints:void 0,s=!!r&&(r[0]||r[1]);if(s){const e=Date.now()-t.time>8;i=e?0:8,n=e?0:2}e.getTilesLoading()<i&&(s&&e.reprioritize(),e.loadMoreTiles(i,n))}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(vs)&&this.renderer_.dispatchRenderEvent(vs,t),!1===this.loaded_&&(this.loaded_=!0,this.dispatchEvent(new X(ot,this,t)))):!0===this.loaded_&&(this.loaded_=!1,this.dispatchEvent(new X(st,this,t))));const i=this.postRenderFunctions_;if(t)for(let e=0,n=i.length;e<n;++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)p(this.targetChangeHandlerKeys_[t]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(m,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(w,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!mr(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(mr(e)||e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new eh(this)),!mr(e)){this.mapBrowserEventHandler_=new nt(this,this.moveTolerance_);for(const t in K)this.mapBrowserEventHandler_.addEventListener(K[t],this.handleMapBrowserEvent.bind(this));let t;if(this.viewport_.addEventListener(m,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(w,this.boundHandleBrowserEvent_,!!et&&{passive:!1}),this.keyboardEventTarget_)t=this.keyboardEventTarget_;else{const i=e.getRootNode();t=i instanceof ShadowRoot?i.host:e}if(this.targetChangeHandlerKeys_=[d(t,_,this.handleBrowserEvent,this),d(t,v,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_&&(p(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(p(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=d(t,h,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=d(t,g,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(p),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new ds("addlayer",t)),this.layerGroupPropertyListenerKeys_=[d(t,h,this.render,this),d(t,g,this.render,this),d(t,"addlayer",this.handleLayerAdd_,this),d(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){ih(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),n=this.frameState_;let r=null;if(void 0!==e&&oo(e)&&i&&i.isDef()){const n=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),s=i.getState();if(r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Qt(s.center,s.resolution,s.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:s,viewHints:n,wantedTiles:{},mapId:z(this),renderTargets:{}},s.nextCenter&&s.nextResolution){const t=isNaN(s.nextRotation)?s.rotation:s.nextRotation;r.nextExtent=Qt(s.nextCenter,s.nextResolution,t,e)}}this.frameState_=r,this.renderer_.renderFrame(r),r&&(r.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,r.postRenderFunctions),n&&(!this.previousExtent_||!ae(this.previousExtent_)&&!$t(r.extent,this.previousExtent_))&&(this.dispatchEvent(new X("movestart",this,n)),this.previousExtent_=Dt(this.previousExtent_)),this.previousExtent_&&!r.viewHints[0]&&!r.viewHints[1]&&!$t(r.extent,this.previousExtent_)&&(this.dispatchEvent(new X("moveend",this,r)),At(r.extent,this.previousExtent_))),this.dispatchEvent(new X(rt,this,r)),this.renderComplete_=(this.hasListener(st)||this.hasListener(ot)||this.hasListener(vs))&&!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 ds("removelayer",e)),this.set(at,t)}setSize(t){this.set(lt,t)}setTarget(t){this.set(ht,t)}setView(t){if(!t||t instanceof er)return void this.set(ut,t);this.set(ut,new er);const e=this;t.then(function(t){e.setView(new er(t))})}updateSize(){const t=this.getTargetElement();let e;if(t){let i,n;if(mr(t)){const e=t.getContext("2d").getTransform();i=t.width/e.a,n=t.height/e.d}else{const e=getComputedStyle(t);i=t.offsetWidth-parseFloat(e.borderLeftWidth)-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight)-parseFloat(e.borderRightWidth),n=t.offsetHeight-parseFloat(e.borderTopWidth)-parseFloat(e.paddingTop)-parseFloat(e.paddingBottom)-parseFloat(e.borderBottomWidth)}isNaN(i)||isNaN(n)||(e=[Math.max(0,i),Math.max(0,n)],!oo(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&we("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&I(e,i)||(this.updateViewportSize_(e),this.setSize(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}};var sh=6378137,oh=.0066943799901413165,ah=484813681109536e-20,lh=Math.PI/2,hh=1e-10,uh=.017453292519943295,ch=57.29577951308232,dh=Math.PI/4,fh=2*Math.PI,ph=3.14159265359;const gh={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},mh={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 yh=/[\s_\-\/\(\)]/g;function _h(t,e){if(t[e])return t[e];for(var i,n=Object.keys(t),r=e.toLowerCase().replace(yh,""),s=-1;++s<n.length;)if((i=n[s]).toLowerCase().replace(yh,"")===r)return t[i]}function vh(t){var e,i,n,r={},s=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){r.rf=parseFloat(t)},lat_0:function(t){r.lat0=t*uh},lat_1:function(t){r.lat1=t*uh},lat_2:function(t){r.lat2=t*uh},lat_ts:function(t){r.lat_ts=t*uh},lon_0:function(t){r.long0=t*uh},lon_1:function(t){r.long1=t*uh},lon_2:function(t){r.long2=t*uh},alpha:function(t){r.alpha=parseFloat(t)*uh},gamma:function(t){r.rectified_grid_angle=parseFloat(t)*uh},lonc:function(t){r.longc=t*uh},x_0:function(t){r.x0=parseFloat(t)},y_0:function(t){r.y0=parseFloat(t)},k_0:function(t){r.k0=parseFloat(t)},k:function(t){r.k0=parseFloat(t)},a:function(t){r.a=parseFloat(t)},b:function(t){r.b=parseFloat(t)},r:function(t){r.a=r.b=parseFloat(t)},r_a:function(){r.R_A=!0},zone:function(t){r.zone=parseInt(t,10)},south:function(){r.utmSouth=!0},towgs84:function(t){r.datum_params=t.split(",").map(function(t){return parseFloat(t)})},to_meter:function(t){r.to_meter=parseFloat(t)},units:function(t){r.units=t;var e=_h(mh,t);e&&(r.to_meter=e.to_meter)},from_greenwich:function(t){r.from_greenwich=t*uh},pm:function(t){var e=_h(gh,t);r.from_greenwich=(e||parseFloat(t))*uh},nadgrids:function(t){"@null"===t?r.datumCode="none":r.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))&&(r.axis=t)},approx:function(){r.approx=!0},over:function(){r.over=!0}};for(e in s)i=s[e],e in o?"function"==typeof(n=o[e])?n(i):r[n]=i:r[e]=i;return"string"==typeof r.datumCode&&"WGS84"!==r.datumCode&&(r.datumCode=r.datumCode.toLowerCase()),r.projStr=t,r}const xh=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],n=parseFloat(t[2])||null,r=t.find(t=>Array.isArray(t)&&"ID"===t[0]);return{type:e,name:i,conversion_factor:n,id:r?{authority:r[1],code:parseInt(r[2],10)}:null}}static convertAxis(t){const e=t[1]||"Unknown";let i;const n=e.match(/^\((.)\)$/);if(n){const e=n[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 r=t.find(t=>Array.isArray(t)&&"ORDER"===t[0]),s=r?parseInt(r[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:s}}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 n=t.find(t=>Array.isArray(t)&&"LENGTHUNIT"===t[0]);if(n){const t=this.convertUnit(n);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 r=t.find(t=>Array.isArray(t)&&("DATUM"===t[0]||"ENSEMBLE"===t[0]));if(r){const i=this.convert(r);"ENSEMBLE"===r[0]?e.datum_ensemble=i:e.datum=i;const n=t.find(t=>Array.isArray(t)&&"PRIMEM"===t[0]);n&&"Greenwich"!==n[1]&&(i.prime_meridian={name:n[1],longitude:parseFloat(n[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 s=t.find(t=>Array.isArray(t)&&"ENSEMBLEACCURACY"===t[0]);s&&(e.accuracy=parseFloat(s[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 l=t.find(t=>Array.isArray(t)&&"TARGETCRS"===t[0]);if(l){const t=l.find(t=>Array.isArray(t));e.target_crs=t?this.convert(t):null}const h=t.find(t=>Array.isArray(t)&&"ABRIDGEDTRANSFORMATION"===t[0]);e.transformation=h?this.convert(h):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 u=this.convertUnit(t,"LinearUnit");e.coordinate_system&&e.coordinate_system.axis&&e.coordinate_system.axis.forEach(t=>{t.unit||(t.unit=u)}),u.conversion_factor&&1!==u.conversion_factor&&e.semi_major_axis&&(e.semi_major_axis={value:e.semi_major_axis,unit:u});break;default:e.keyword=t[0]}return e}},wh=class extends xh{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}},bh=class extends xh{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 n=t.find(t=>Array.isArray(t)&&"USAGE"===t[0]);if(n){const t=n.find(t=>Array.isArray(t)&&"SCOPE"===t[0]),i=n.find(t=>Array.isArray(t)&&"AREA"===t[0]),r=n.find(t=>Array.isArray(t)&&"BBOX"===t[0]);e.usage={},t&&(e.usage.scope=t[1]),i&&(e.usage.area=i[1]),r&&(e.usage.bbox=r.slice(1))}return e}};var Sh=/\s/,Mh=/[A-Za-z]/,Eh=/[A-Za-z84_]/,Ch=/[,\]]/,Ph=/[\d\.E\-\+]/;function Ih(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 Th(t,e,i){Array.isArray(e)&&(i.unshift(e),e=null);var n=e?{}:t,r=i.reduce(function(t,e){return Rh(e,t),t},n);e&&(t[e]=r)}function Rh(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 Rh(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 n;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&&Rh(t[2],e[i]));case"SPHEROID":case"ELLIPSOID":return e[i]={name:t[0],a:t[1],rf:t[2]},void(4===t.length&&Rh(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 Th(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]],Th(e,i,t),void(e[i].type=i);default:for(n=-1;++n<t.length;)if(!Array.isArray(t[n]))return Rh(t,e[i]);return Th(e,i,t)}}else e[i]=t;else e[i]=!0}else e[t]=!0}function kh(t){return.017453292519943295*t}function Ah(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=kh(t.lat0>0?90:-90),delete t.lat1):(t.lat0=kh(t.lat1>0?90:-90),t.lat_ts=t.lat1,delete t.lat1)}function Gh(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 Oh(t){return"object"==typeof t?t.value*t.unit.conversion_factor:t}function Fh(t,e){t.ellipsoid.radius?(e.a=t.ellipsoid.radius,e.rf=0):(e.a=Oh(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-Oh(t.ellipsoid.semi_minor_axis))))}function Lh(t,e={}){return t&&"object"==typeof t?"BoundCRS"===t.type?(Lh(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 n=t[i];if(null!==n)switch(i){case"name":if(e.srsCode)break;e.name=n,e.srsCode=n;break;case"type":"GeographicCRS"===n?e.projName="longlat":"GeodeticCRS"===n?t.coordinate_system&&"Cartesian"===t.coordinate_system.subtype?e.projName="geocent":e.projName="longlat":"ProjectedCRS"===n&&t.conversion&&t.conversion.method&&(e.projName=t.conversion.method.name);break;case"datum":case"datum_ensemble":n.ellipsoid&&(e.ellps=n.ellipsoid.name,Fh(n,e)),n.prime_meridian&&(e.from_greenwich=n.prime_meridian.longitude*Math.PI/180);break;case"ellipsoid":e.ellps=n.name,Fh(n,e);break;case"prime_meridian":e.long0=(n.longitude||0)*Math.PI/180;break;case"coordinate_system":if(n.axis){const t={east:"e",north:"n",west:"w",south:"s",up:"u",down:"d",geocentricx:"e",geocentricy:"n",geocentricz:"u"},i=n.axis.map(e=>t[e.direction.toLowerCase()]);if(i.every(Boolean)&&(e.axis=i.join(""),2===e.axis.length&&(e.axis+="u")),n.unit){const{units:t,to_meter:i}=Gh(n.unit);e.units=t,e.to_meter=i}else if(n.axis[0]&&n.axis[0].unit){const{units:t,to_meter:i}=Gh(n.axis[0].unit);e.units=t,e.to_meter=i}}break;case"id":n.authority&&n.code&&(e.title=n.authority+":"+n.code);break;case"conversion":n.method&&n.method.name&&(e.projName=n.method.name),n.parameters&&n.parameters.forEach(t=>{const i=t.name.toLowerCase().replace(/\s+/g,"_"),n=t.value;t.unit&&t.unit.conversion_factor?e[i]=n*t.unit.conversion_factor:"degree"===t.unit?e[i]=n*Math.PI/180:e[i]=n});break;case"unit":n.name&&(e.units=n.name.toLowerCase(),"metre"===e.units&&(e.units="meter")),n.conversion_factor&&(e.to_meter=n.conversion_factor);break;case"base_crs":Lh(n,e),e.datumCode=n.id?n.id.authority+"_"+n.id.code:n.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),Ah(e),e):t}Ih.prototype.readCharicter=function(){var t=this.text[this.place++];if(4!==this.state)for(;Sh.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}},Ih.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=4);if(Ch.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)},Ih.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},Ih.prototype.number=function(t){if(!Ph.test(t)){if(Ch.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},Ih.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=5},Ih.prototype.keyword=function(t){if(Eh.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(!Ch.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}},Ih.prototype.neutral=function(t){if(Mh.test(t))return this.word=t,void(this.state=2);if('"'===t)return this.word="",void(this.state=4);if(Ph.test(t))return this.word=t,void(this.state=3);if(!Ch.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)},Ih.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 Nh(t){for(var e=Object.keys(t),i=0,n=e.length;i<n;++i){var r=e[i];-1!==jh.indexOf(r)&&Dh(t[r]),"object"==typeof t[r]&&Nh(t[r])}}function Dh(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="",n=0,r=t.AXIS.length;n<r;++n){var s=[t.AXIS[n][0].toLowerCase(),t.AXIS[n][1].toLowerCase()];-1!==s[0].indexOf("north")||("y"===s[0]||"lat"===s[0])&&"north"===s[1]?i+="n":-1!==s[0].indexOf("south")||("y"===s[0]||"lat"===s[0])&&"south"===s[1]?i+="s":-1!==s[0].indexOf("east")||("x"===s[0]||"lon"===s[0])&&"east"===s[1]?i+="e":-1===s[0].indexOf("west")&&("x"!==s[0]&&"lon"!==s[0]||"west"!==s[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=kh(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=kh(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",kh],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",kh],["x0","false_easting",a],["y0","false_northing",a],["long0","central_meridian",kh],["lat0","latitude_of_origin",kh],["lat0","standard_parallel_1",kh],["lat1","standard_parallel_1",kh],["lat2","standard_parallel_2",kh],["azimuth","Azimuth"],["alpha","azimuth",kh],["srsCode","name"]].forEach(function(e){return function(t,e){var i=e[0],n=e[1];!(i in t)&&n in t&&(t[i]=t[n],3===e.length&&(t[i]=e[2](t[i])))}(t,e)}),Ah(t)}function zh(t){if("object"==typeof t)return Lh(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 Ih(t).output();if("WKT2"===e)return Lh(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?bh:wh).convert(t)}(i));var n=i[0],r={};return Rh(i,r),Nh(r),r[n]}function qh(t){var e=this;if(2===arguments.length){var i=arguments[1];"string"==typeof i?"+"===i.charAt(0)?qh[t]=vh(arguments[1]):qh[t]=zh(arguments[1]):i&&"object"==typeof i&&!("projName"in i)?qh[t]=zh(arguments[1]):(qh[t]=i,i||delete qh[t])}else if(1===arguments.length){if(Array.isArray(t))return t.map(function(t){return Array.isArray(t)?qh.apply(e,t):qh(t)});if("string"==typeof t){if(t in qh)return qh[t]}else"EPSG"in t?qh["EPSG:"+t.EPSG]=t:"ESRI"in t?qh["ESRI:"+t.ESRI]=t:"IAU2000"in t?qh["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"]}(qh);const $h=qh;var Bh=["3857","900913","3785","102113"];function Uh(t,e){var i,n;if(t=t||{},!e)return t;for(n in e)void 0!==(i=e[n])&&(t[n]=i);return t}function Wh(t,e,i){var n=t*e;return i/Math.sqrt(1-n*n)}function Xh(t){return t<0?-1:1}function Vh(t,e){return e||Math.abs(t)<=ph?t:t-Xh(t)*fh}function Kh(t,e,i){var n=t*i,r=.5*t;return n=Math.pow((1-n)/(1+n),r),Math.tan(.5*(lh-e))/n}function Yh(t,e){for(var i,n,r=.5*t,s=lh-2*Math.atan(e),o=0;o<=15;o++)if(i=t*Math.sin(s),s+=n=lh-2*Math.atan(e*Math.pow((1-i)/(1+i),r))-s,Math.abs(n)<=1e-10)return s;return-9999}function Zh(t){return t}var Hh=["longlat","identity"],Jh=[{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=Wh(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,n=t.x,r=t.y;if(r*ch>90&&r*ch<-90&&n*ch>180&&n*ch<-180)return null;if(Math.abs(Math.abs(r)-lh)<=hh)return null;if(this.sphere)e=this.x0+this.a*this.k0*Vh(n-this.long0,this.over),i=this.y0+this.a*this.k0*Math.log(Math.tan(dh+.5*r));else{var s=Math.sin(r),o=Kh(this.e,r,s);e=this.x0+this.a*this.k0*Vh(n-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,n=t.x-this.x0,r=t.y-this.y0;if(this.sphere)i=lh-2*Math.atan(Math.exp(-r/(this.a*this.k0)));else{var s=Math.exp(-r/(this.a*this.k0));if(-9999===(i=Yh(this.e,s)))return null}return e=Vh(this.long0+n/(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:Zh,inverse:Zh,names:Hh}],Qh={},tu=[];function eu(t,e){var i=tu.length;return t.names?(tu[i]=t,t.names.forEach(function(t){Qh[t.toLowerCase()]=i}),this):(console.log(e),!0)}function iu(t){return t.replace(/[-\(\)\s]+/g," ").trim().replace(/ /g,"_")}const nu={start:function(){Jh.forEach(eu)},add:eu,get:function(t){if(!t)return!1;var e=t.toLowerCase();return void 0!==Qh[e]&&tu[Qh[e]]||(e=iu(e))in Qh&&tu[Qh[e]]?tu[Qh[e]]:void 0}},ru={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)"}},su=ru.WGS84;var ou={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 au in ou){var lu=ou[au];lu.datumName&&(ou[lu.datumName]=lu)}const hu=ou;var uu={};async function cu(t,e){for(var i=[],n=await e.getImageCount(),r=n-1;r>=0;r--){var s=await e.getImage(r),o=await s.readRasters(),a=[s.getWidth(),s.getHeight()],l=s.getBoundingBox().map(fu),h=[s.fileDirectory.ModelPixelScale[0],s.fileDirectory.ModelPixelScale[1]].map(fu),u=l[0]+(a[0]-1)*h[0],c=l[3]-(a[1]-1)*h[1],d=o[0],f=o[1],p=[];for(let t=a[1]-1;t>=0;t--)for(let e=a[0]-1;e>=0;e--){var g=t*a[0]+e;p.push([-pu(f[g]),pu(d[g])])}i.push({del:h,lim:a,ll:[-u,c],cvs:p})}var m={header:{nSubgrids:n},subgrids:i};return uu[t]=m,m}function du(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:uu[t]||null,isNull:!1}}function fu(t){return t*Math.PI/180}function pu(t){return t/3600*Math.PI/180}function gu(t,e,i){return String.fromCharCode.apply(null,new Uint8Array(t.buffer.slice(e,i)))}function mu(t){return t.map(function(t){return[pu(t.longitudeShift),pu(t.latitudeShift)]})}function yu(t,e,i){return{name:gu(t,e+8,e+16).trim(),parent:gu(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 _u(t,e,i,n,r){var s=e+176,o=16;!1===r&&(o=8);for(var a=[],l=0;l<i.gridNodeCount;l++){var h={latitudeShift:t.getFloat32(s+l*o,n),longitudeShift:t.getFloat32(s+l*o+4,n)};!1!==r&&(h.latitudeAccuracy=t.getFloat32(s+l*o+8,n),h.longitudeAccuracy=t.getFloat32(s+l*o+12,n)),a.push(h)}return a}function vu(t,e){if(!(this instanceof vu))return new vu(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 $h}(t))e=$h[t];else if(function(t){return 0!==t.indexOf("+")&&-1!==t.indexOf("[")||"object"==typeof t&&!("srsCode"in t)}(t)){e=zh(t);var i=function(t){var e=_h(t,"extension");if(e)return _h(e,"proj4")}(e);i&&(e=vh(i))}else(function(t){return"+"===t[0]})(t)&&(e=vh(t));else e="projName"in t?t:zh(t);return e&&function(t){if(t.title)return 0===t.title.toLowerCase().indexOf("epsg:")&&Bh.indexOf(t.title.substr(5))>-1;var e=_h(t,"authority");if(e){var i=_h(e,"epsg");return i&&Bh.indexOf(i)>-1}}(e)?$h["EPSG:3857"]:e}(t);if("object"==typeof i){var n=vu.projections.get(i.projName);if(n){if(i.datumCode&&"none"!==i.datumCode){var r=_h(hu,i.datumCode);r&&(i.datum_params=i.datum_params||(r.towgs84?r.towgs84.split(","):null),i.ellps=r.ellipse,i.datumName=r.datumName?r.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 s=function(t,e,i,n,r){if(!t){var s=_h(ru,n);s||(s=su),t=s.a,e=s.b,i=s.rf}return i&&!e&&(e=(1-1/i)*t),(0===i||Math.abs(t-e)<hh)&&(r=!0,e=t),{a:t,b:e,rf:i,sphere:r}}(i.a,i.b,i.rf,i.ellps,i.sphere),o=function(t,e,i,n){var r=t*t,s=e*e,o=(r-s)/r,a=0;return n?(r=(t*=1-o*(.16666666666666666+o*(.04722222222222222+.022156084656084655*o)))*t,o=0):a=Math.sqrt(o),{es:o,e:a,ep2:(r-s)/s}}(s.a,s.b,s.rf,i.R_A),a=function(t){return void 0===t?null:t.split(",").map(du)}(i.nadgrids),l=i.datum||function(t,e,i,n,r,s,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]*=ah,a.datum_params[4]*=ah,a.datum_params[5]*=ah,a.datum_params[6]=a.datum_params[6]/1e6+1))),o&&(a.datum_type=3,a.grids=o),a.a=i,a.b=n,a.es=r,a.ep2=s,a}(i.datumCode,i.datum_params,s.a,s.b,o.es,o.ep2,a);Uh(this,i),Uh(this,n),this.a=s.a,this.b=s.b,this.rf=s.rf,this.sphere=s.sphere,this.es=o.es,this.e=o.e,this.ep2=o.ep2,this.datum=l,"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)}vu.projections=nu,vu.projections.start();const xu=vu;function wu(t,e,i){var n,r,s,o,a=t.x,l=t.y,h=t.z?t.z:0;if(l<-lh&&l>-1.001*lh)l=-lh;else if(l>lh&&l<1.001*lh)l=lh;else{if(l<-lh)return{x:-1/0,y:-1/0,z:t.z};if(l>lh)return{x:1/0,y:1/0,z:t.z}}return a>Math.PI&&(a-=2*Math.PI),r=Math.sin(l),o=Math.cos(l),s=r*r,{x:((n=i/Math.sqrt(1-e*s))+h)*o*Math.cos(a),y:(n+h)*o*Math.sin(a),z:(n*(1-e)+h)*r}}function bu(t,e,i,n){var r,s,o,a,l,h,u,c,d,f,p,g,m,y,_,v=t.x,x=t.y,w=t.z?t.z:0;if(r=Math.sqrt(v*v+x*x),s=Math.sqrt(v*v+x*x+w*w),r/i<1e-12){if(y=0,s/i<1e-12)return _=-n,{x:t.x,y:t.y,z:t.z}}else y=Math.atan2(x,v);o=w/s,c=(a=r/s)*(1-e)*(l=1/Math.sqrt(1-e*(2-e)*a*a)),d=o*l,m=0;do{m++,h=e*(u=i/Math.sqrt(1-e*d*d))/(u+(_=r*c+w*d-u*(1-e*d*d))),g=(p=o*(l=1/Math.sqrt(1-h*(2-h)*a*a)))*c-(f=a*(1-h)*l)*d,c=f,d=p}while(g*g>1e-24&&m<30);return{x:y,y:Math.atan(p/Math.abs(f)),z:_}}function Su(t){return 1===t||2===t}function Mu(t,e,i){if(null===t.grids||0===t.grids.length)return console.log("Grid shift grids not found"),-1;var n={x:-i.x,y:i.y},r={x:Number.NaN,y:Number.NaN},s=[];t:for(var o=0;o<t.grids.length;o++){var a=t.grids[o];if(s.push(a.name),a.isNull){r=n;break}if(null!==a.grid)for(var l=a.grid.subgrids,h=0,u=l.length;h<u;h++){var c=l[h],d=(Math.abs(c.del[1])+Math.abs(c.del[0]))/1e4,f=c.ll[0]-d,p=c.ll[1]-d,g=c.ll[0]+(c.lim[0]-1)*c.del[0]+d,m=c.ll[1]+(c.lim[1]-1)*c.del[1]+d;if(!(p>n.y||f>n.x||m<n.y||g<n.x||(r=Eu(n,e,c),isNaN(r.x))))break t}else if(a.mandatory)return console.log("Unable to find mandatory grid '"+a.name+"'"),-1}return isNaN(r.x)?(console.log("Failed to find a grid shift table for location '"+-n.x*ch+" "+n.y*ch+" tried: '"+s+"'"),-1):(i.x=-r.x,i.y=r.y,0)}function Eu(t,e,i){var n={x:Number.NaN,y:Number.NaN};if(isNaN(t.x))return n;var r={x:t.x,y:t.y};r.x-=i.ll[0],r.y-=i.ll[1],r.x=Vh(r.x-Math.PI)+Math.PI;var s=Cu(r,i);if(e){if(isNaN(s.x))return n;s.x=r.x-s.x,s.y=r.y-s.y;var o,a,l=9;do{if(a=Cu(s,i),isNaN(a.x)){console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");break}o={x:r.x-(a.x+s.x),y:r.y-(a.y+s.y)},s.x+=o.x,s.y+=o.y}while(l--&&Math.abs(o.x)>1e-12&&Math.abs(o.y)>1e-12);if(l<0)return console.log("Inverse grid shift iterator failed to converge."),n;n.x=Vh(s.x+i.ll[0]),n.y=s.y+i.ll[1]}else isNaN(s.x)||(n.x=t.x+s.x,n.y=t.y+s.y);return n}function Cu(t,e){var i,n={x:t.x/e.del[0],y:t.y/e.del[1]},r=Math.floor(n.x),s=Math.floor(n.y),o=n.x-1*r,a=n.y-1*s,l={x:Number.NaN,y:Number.NaN};if(r<0||r>=e.lim[0])return l;if(s<0||s>=e.lim[1])return l;i=s*e.lim[0]+r;var h=e.cvs[i][0],u=e.cvs[i][1];i++;var c=e.cvs[i][0],d=e.cvs[i][1];i+=e.lim[0];var f=e.cvs[i][0],p=e.cvs[i][1];i--;var g=e.cvs[i][0],m=e.cvs[i][1],y=o*a,_=o*(1-a),v=(1-o)*(1-a),x=(1-o)*a;return l.x=v*h+_*c+x*g+y*f,l.y=v*u+_*d+x*m+y*p,l}function Pu(t,e,i){var n,r,s,o=i.x,a=i.y,l=i.z||0,h={};for(s=0;s<3;s++)if(!e||2!==s||void 0!==i.z)switch(0===s?(n=o,r=-1!=="ew".indexOf(t.axis[s])?"x":"y"):1===s?(n=a,r=-1!=="ns".indexOf(t.axis[s])?"y":"x"):(n=l,r="z"),t.axis[s]){case"e":case"n":h[r]=n;break;case"w":case"s":h[r]=-n;break;case"u":void 0!==i[r]&&(h.z=n);break;case"d":void 0!==i[r]&&(h.z=-n);break;default:return null}return h}function Iu(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 Tu(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 Ru(t,e,i,n){var r,s=void 0!==(i=Array.isArray(i)?Iu(i):{x:i.x,y:i.y,z:i.z,m:i.m}).z;if(function(t){Tu(t.x),Tu(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=Ru(t,r=new xu("WGS84"),i,n),t=r),n&&"enu"!==t.axis&&(i=Pu(t,!1,i)),"longlat"===t.projName)i={x:i.x*uh,y:i.y*uh,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 n=t.a,r=t.es;if(3===t.datum_type){if(0!==Mu(t,!1,i))return;n=sh,r=oh}var s=e.a,o=e.b,a=e.es;return 3===e.datum_type&&(s=sh,o=6356752.314,a=oh),r!==a||n!==s||Su(t.datum_type)||Su(e.datum_type)?(i=wu(i,r,n),Su(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 n=i[0],r=i[1],s=i[2],o=i[3],a=i[4],l=i[5],h=i[6];return{x:h*(t.x-l*t.y+a*t.z)+n,y:h*(l*t.x+t.y-o*t.z)+r,z:h*(-a*t.x+o*t.y+t.z)+s}}}(i,t.datum_type,t.datum_params)),Su(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 n=i[0],r=i[1],s=i[2],o=i[3],a=i[4],l=i[5],h=i[6],u=(t.x-n)/h,c=(t.y-r)/h,d=(t.z-s)/h;return{x:u+l*c-a*d,y:-l*u+c+o*d,z:a*u-o*c+d}}}(i,e.datum_type,e.datum_params)),i=bu(i,a,s,o),3!==e.datum_type||0===Mu(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})),n&&"enu"!==e.axis?Pu(e,!0,i):(i&&!s&&"geocent"!==e.projName&&delete i.z,i)}var ku=xu("WGS84");function Au(t,e,i,n){var r,s,o;return Array.isArray(i)?(r=Ru(t,e,i,n)||{x:NaN,y:NaN},i.length>2?void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name?"number"==typeof r.z?[r.x,r.y,r.z].concat(i.slice(3)):[r.x,r.y,i[2]].concat(i.slice(3)):[r.x,r.y].concat(i.slice(2)):[r.x,r.y]):(s=Ru(t,e,i,n),2===(o=Object.keys(i)).length||o.forEach(function(n){if(void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name){if("x"===n||"y"===n||"z"===n)return}else if("x"===n||"y"===n)return;s[n]=i[n]}),s)}function Gu(t){return t instanceof xu?t:"object"==typeof t&&"oProj"in t?t.oProj:xu(t)}var Ou="AJSAJS",Fu="AFAFAF",Lu=65,ju=73,Nu=79;const Du={forward:zu,inverse:function(t){var e=Uu(Xu(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat,e.lon,e.lat]:[e.left,e.bottom,e.right,e.top]},toPoint:qu};function zu(t,e){return e=e||5,function(t,e){var i,n,r,s,o,a,l,h,u,c,d,f="00000"+t.easting,p="00000"+t.northing;return t.zoneNumber+t.zoneLetter+(u=t.easting,c=t.northing,d=Wu(t.zoneNumber),i=Math.floor(u/1e5),n=Math.floor(c/1e5)%20,s=Ou.charCodeAt(r=d-1),o=Fu.charCodeAt(r),h=!1,(a=s+i-1)>90&&(a=a-90+Lu-1,h=!0),(a===ju||s<ju&&a>ju||(a>ju||s<ju)&&h)&&a++,(a===Nu||s<Nu&&a>Nu||(a>Nu||s<Nu)&&h)&&++a===ju&&a++,a>90&&(a=a-90+Lu-1),(l=o+n)>86?(l=l-86+Lu-1,h=!0):h=!1,(l===ju||o<ju&&l>ju||(l>ju||o<ju)&&h)&&l++,(l===Nu||o<Nu&&l>Nu||(l>Nu||o<Nu)&&h)&&++l===ju&&l++,l>86&&(l=l-86+Lu-1),String.fromCharCode(a)+String.fromCharCode(l))+f.substr(f.length-5,e)+p.substr(p.length-5,e)}(function(t){var e,i,n,r,s,o,a,l=t.lat,h=t.lon,u=6378137,c=.00669438,d=.9996,f=$u(l),p=$u(h);a=Math.floor((h+180)/6)+1,180===h&&(a=60),l>=56&&l<64&&h>=3&&h<12&&(a=32),l>=72&&l<84&&(h>=0&&h<9?a=31:h>=9&&h<21?a=33:h>=21&&h<33?a=35:h>=33&&h<42&&(a=37)),o=$u(6*(a-1)-180+3),e=.006739496752268451,i=u/Math.sqrt(1-c*Math.sin(f)*Math.sin(f)),n=Math.tan(f)*Math.tan(f),r=e*Math.cos(f)*Math.cos(f);var g,m,y=d*i*((s=Math.cos(f)*(p-o))+(1-n+r)*s*s*s/6+(5-18*n+n*n+72*r-58*e)*s*s*s*s*s/120)+5e5,_=d*(u*(.9983242984503243*f-.002514607064228144*Math.sin(2*f)+2639046602129982e-21*Math.sin(4*f)-3.418046101696858e-9*Math.sin(6*f))+i*Math.tan(f)*(s*s/2+(5-n+9*r+4*r*r)*s*s*s*s/24+(61-58*n+n*n+600*r-2.2240339282485886)*s*s*s*s*s*s/720));return l<0&&(_+=1e7),{northing:Math.round(_),easting:Math.round(y),zoneNumber:a,zoneLetter:(g=l,m="Z",84>=g&&g>=72?m="X":72>g&&g>=64?m="W":64>g&&g>=56?m="V":56>g&&g>=48?m="U":48>g&&g>=40?m="T":40>g&&g>=32?m="S":32>g&&g>=24?m="R":24>g&&g>=16?m="Q":16>g&&g>=8?m="P":8>g&&g>=0?m="N":0>g&&g>=-8?m="M":-8>g&&g>=-16?m="L":-16>g&&g>=-24?m="K":-24>g&&g>=-32?m="J":-32>g&&g>=-40?m="H":-40>g&&g>=-48?m="G":-48>g&&g>=-56?m="F":-56>g&&g>=-64?m="E":-64>g&&g>=-72?m="D":-72>g&&g>=-80&&(m="C"),m)}}({lat:t[1],lon:t[0]}),e)}function qu(t){var e=Uu(Xu(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function $u(t){return t*(Math.PI/180)}function Bu(t){return t/Math.PI*180}function Uu(t){var e=t.northing,i=t.easting,n=t.zoneLetter,r=t.zoneNumber;if(r<0||r>60)return null;var s,o,a,l,h,u,c,d,f,p=.9996,g=6378137,m=.00669438,y=(1-Math.sqrt(.99330562))/(1+Math.sqrt(.99330562)),_=i-5e5,v=e;n<"N"&&(v-=1e7),c=6*(r-1)-180+3,s=.006739496752268451,f=(d=v/p/6367449.145945056)+(3*y/2-27*y*y*y/32)*Math.sin(2*d)+(21*y*y/16-55*y*y*y*y/32)*Math.sin(4*d)+151*y*y*y/96*Math.sin(6*d),o=g/Math.sqrt(1-m*Math.sin(f)*Math.sin(f)),a=Math.tan(f)*Math.tan(f),l=s*Math.cos(f)*Math.cos(f),h=.99330562*g/Math.pow(1-m*Math.sin(f)*Math.sin(f),1.5),u=_/(o*p);var x=f-o*Math.tan(f)/h*(u*u/2-(5+3*a+10*l-4*l*l-9*s)*u*u*u*u/24+(61+90*a+298*l+45*a*a-1.6983531815716497-3*l*l)*u*u*u*u*u*u/720);x=Bu(x);var w,b=(u-(1+2*a+l)*u*u*u/6+(5-2*l+28*a-3*l*l+8*s+24*a*a)*u*u*u*u*u/120)/Math.cos(f);if(b=c+Bu(b),t.accuracy){var S=Uu({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});w={top:S.lat,right:S.lon,bottom:x,left:b}}else w={lat:x,lon:b};return w}function Wu(t){var e=t%6;return 0===e&&(e=6),e}function Xu(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";for(var e,i=t.length,n=null,r="",s=0;!/[A-Z]/.test(e=t.charAt(s));){if(s>=2)throw"MGRSPoint bad conversion from: "+t;r+=e,s++}var o=parseInt(r,10);if(0===s||s+3>i)throw"MGRSPoint bad conversion from: "+t;var a=t.charAt(s++);if(a<="A"||"B"===a||"Y"===a||a>="Z"||"I"===a||"O"===a)throw"MGRSPoint zone letter "+a+" not handled: "+t;n=t.substring(s,s+=2);for(var l=Wu(o),h=function(t,e){for(var i=Ou.charCodeAt(e-1),n=1e5,r=!1;i!==t.charCodeAt(0);){if(++i===ju&&i++,i===Nu&&i++,i>90){if(r)throw"Bad character: "+t;i=Lu,r=!0}n+=1e5}return n}(n.charAt(0),l),u=function(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;for(var i=Fu.charCodeAt(e-1),n=0,r=!1;i!==t.charCodeAt(0);){if(++i===ju&&i++,i===Nu&&i++,i>86){if(r)throw"Bad character: "+t;i=Lu,r=!0}n+=1e5}return n}(n.charAt(1),l);u<Vu(a);)u+=2e6;var c=i-s;if(c%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,f,p,g=c/2,m=0,y=0;return g>0&&(d=1e5/Math.pow(10,g),f=t.substring(s,s+g),m=parseFloat(f)*d,p=t.substring(s+g),y=parseFloat(p)*d),{easting:m+h,northing:y+u,zoneLetter:a,zoneNumber:o,accuracy:d}}function Vu(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 Ku(t,e,i){if(!(this instanceof Ku))return new Ku(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 n=t.split(",");this.x=parseFloat(n[0]),this.y=parseFloat(n[1]),this.z=parseFloat(n[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")}Ku.fromMGRS=function(t){return new Ku(qu(t))},Ku.prototype.toMGRS=function(t){return zu([this.x,this.y],t)};const Yu=Ku;var Zu=.046875,Hu=.01953125,Ju=.01068115234375;function Qu(t){var e=[];e[0]=1-t*(.25+t*(Zu+t*(Hu+t*Ju))),e[1]=t*(.75-t*(Zu+t*(Hu+t*Ju)));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 tc(t,e,i,n){return i*=e,e*=e,n[0]*t-i*(n[1]+e*(n[2]+e*(n[3]+e*n[4])))}function ec(t,e,i){for(var n=1/(1-e),r=t,s=20;s;--s){var o=Math.sin(r),a=1-e*o*o;if(r-=a=(tc(r,o,Math.cos(r),i)-t)*(a*Math.sqrt(a))*n,Math.abs(a)<hh)return r}return r}const ic={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=Qu(this.es),this.ml0=tc(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))},forward:function(t){var e,i,n,r=t.x,s=t.y,o=Vh(r-this.long0,this.over),a=Math.sin(s),l=Math.cos(s);if(this.es){var h=l*o,u=Math.pow(h,2),c=this.ep2*Math.pow(l,2),d=Math.pow(c,2),f=Math.abs(l)>hh?Math.tan(s):0,p=Math.pow(f,2),g=Math.pow(p,2);e=1-this.es*Math.pow(a,2),h/=Math.sqrt(e);var m=tc(s,a,l,this.en);i=this.a*(this.k0*h*(1+u/6*(1-p+c+u/20*(5-18*p+g+14*c-58*p*c+u/42*(61+179*g-g*p-479*p)))))+this.x0,n=this.a*(this.k0*(m-this.ml0+a*o*h/2*(1+u/12*(5-p+9*c+4*d+u/30*(61+g-58*p+270*c-330*p*c+u/56*(1385+543*g-g*p-3111*p))))))+this.y0}else{var y=l*Math.sin(o);if(Math.abs(Math.abs(y)-1)<hh)return 93;if(i=.5*this.a*this.k0*Math.log((1+y)/(1-y))+this.x0,n=l*Math.cos(o)/Math.sqrt(1-Math.pow(y,2)),(y=Math.abs(n))>=1){if(y-1>hh)return 93;n=0}else n=Math.acos(n);s<0&&(n=-n),n=this.a*this.k0*(n-this.lat0)+this.y0}return t.x=i,t.y=n,t},inverse:function(t){var e,i,n,r,s=(t.x-this.x0)*(1/this.a),o=(t.y-this.y0)*(1/this.a);if(this.es)if(i=ec(e=this.ml0+o/this.k0,this.es,this.en),Math.abs(i)<lh){var a=Math.sin(i),l=Math.cos(i),h=Math.abs(l)>hh?Math.tan(i):0,u=this.ep2*Math.pow(l,2),c=Math.pow(u,2),d=Math.pow(h,2),f=Math.pow(d,2);e=1-this.es*Math.pow(a,2);var p=s*Math.sqrt(e)/this.k0,g=Math.pow(p,2);n=i-(e*=h)*g/(1-this.es)*.5*(1-g/12*(5+3*d-9*u*d+u-4*c-g/30*(61+90*d-252*u*d+45*f+46*u-g/56*(1385+3633*d+4095*f+1574*f*d)))),r=Vh(this.long0+p*(1-g/6*(1+2*d+u-g/20*(5+28*d+24*f+8*u*d+6*u-g/42*(61+662*d+1320*f+720*f*d))))/l,this.over)}else n=lh*Xh(o),r=0;else{var m=Math.exp(s/this.k0),y=.5*(m-1/m),_=this.lat0+o/this.k0,v=Math.cos(_);e=Math.sqrt((1-Math.pow(v,2))/(1+Math.pow(y,2))),n=Math.asin(e),o<0&&(n=-n),r=0===y&&0===v?0:Vh(Math.atan2(y,v)+this.long0,this.over)}return t.x=r,t.y=n,t},names:["Fast_Transverse_Mercator","Fast Transverse Mercator"]};function nc(t){var e=Math.exp(t);return(e-1/e)/2}function rc(t,e){t=Math.abs(t),e=Math.abs(e);var i=Math.max(t,e),n=Math.min(t,e)/(i||1);return i*Math.sqrt(1+Math.pow(n,2))}function sc(t,e){for(var i,n=2*Math.cos(2*e),r=t.length-1,s=t[r],o=0;--r>=0;)i=n*s-o+t[r],o=s,s=i;return e+i*Math.sin(2*e)}function oc(t,e,i){for(var n,r,s=Math.sin(e),o=Math.cos(e),a=nc(i),l=function(t){var e=Math.exp(t);return(e+1/e)/2}(i),h=2*o*l,u=-2*s*a,c=t.length-1,d=t[c],f=0,p=0,g=0;--c>=0;)n=p,r=f,d=h*(p=d)-n-u*(f=g)+t[c],g=u*p-r+h*f;return[(h=s*l)*d-(u=o*a)*g,h*g+u*d]}const ac={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&&(ic.init.apply(this),this.forward=ic.forward,this.inverse=ic.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 n=sc(this.cbg,this.lat0);this.Zb=-this.Qn*(n+function(t,e){for(var i,n=2*Math.cos(e),r=t.length-1,s=t[r],o=0;--r>=0;)i=n*s-o+t[r],o=s,s=i;return Math.sin(e)*i}(this.gtu,2*n))},forward:function(t){var e=Vh(t.x-this.long0,this.over),i=t.y;i=sc(this.cbg,i);var n=Math.sin(i),r=Math.cos(i),s=Math.sin(e),o=Math.cos(e);i=Math.atan2(n,o*r),e=Math.atan2(s*r,rc(n,r*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/(rc(1,e)+1))),t<0?-e:e}(Math.tan(e));var a,l,h=oc(this.gtu,2*i,2*e);return i+=h[0],e+=h[1],Math.abs(e)<=2.623395162778?(a=this.a*(this.Qn*e)+this.x0,l=this.a*(this.Qn*i+this.Zb)+this.y0):(a=1/0,l=1/0),t.x=a,t.y=l,t},inverse:function(t){var e,i,n=(t.x-this.x0)*(1/this.a),r=(t.y-this.y0)*(1/this.a);if(r=(r-this.Zb)/this.Qn,n/=this.Qn,Math.abs(n)<=2.623395162778){var s=oc(this.utg,2*r,2*n);r+=s[0],n+=s[1],n=Math.atan(nc(n));var o=Math.sin(r),a=Math.cos(r),l=Math.sin(n),h=Math.cos(n);r=Math.atan2(o*h,rc(l,h*a)),e=Vh((n=Math.atan2(l,h*a))+this.long0,this.over),i=sc(this.cgb,r)}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"]},lc={init:function(){var t=function(t,e){if(void 0===t){if((t=Math.floor(30*(Vh(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)*uh,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,ac.init.apply(this),this.forward=ac.forward,this.inverse=ac.inverse},names:["Universal Transverse Mercator System","utm"],dependsOn:"etmerc"};function hc(t,e){return Math.pow((1-t)/(1+t),e)}const uc={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+dh)/(Math.pow(Math.tan(.5*this.lat0+dh),this.C)*hc(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+dh),this.C)*hc(this.e*Math.sin(i),this.ratexp))-lh,t.x=this.C*e,t},inverse:function(t){for(var e=t.x/this.C,i=t.y,n=Math.pow(Math.tan(.5*i+dh)/this.K,1/this.C),r=20;r>0&&(i=2*Math.atan(n*hc(this.e*Math.sin(t.y),-.5*this.e))-lh,!(Math.abs(i-t.y)<1e-14));--r)t.y=i;return r?(t.x=e,t.y=i,t):null},names:["gauss"]},cc={init:function(){uc.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,n,r;return t.x=Vh(t.x-this.long0,this.over),uc.forward.apply(this,[t]),e=Math.sin(t.y),i=Math.cos(t.y),n=Math.cos(t.x),r=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*i*n),t.x=r*i*Math.sin(t.x),t.y=r*(this.cosc0*e-this.sinc0*i*n),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t},inverse:function(t){var e,i,n,r,s;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,s=rc(t.x,t.y)){var o=2*Math.atan2(s,this.R2);e=Math.sin(o),i=Math.cos(o),r=Math.asin(i*this.sinc0+t.y*e*this.cosc0/s),n=Math.atan2(t.x*e,s*this.cosc0*i-t.y*this.sinc0*e)}else r=this.phic0,n=0;return t.x=n,t.y=r,uc.inverse.apply(this,[t]),t.x=Vh(t.x+this.long0,this.over),t},names:["Stereographic_North_Pole","Oblique_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"]};function dc(t,e,i){return e*=i,Math.tan(.5*(lh+t))*Math.pow((1-e)/(1+e),.5*i)}const fc={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)<=hh&&(this.k0=.5*(1+Xh(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=hh&&(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)<=hh&&Math.abs(Math.cos(this.lat_ts))>hh&&(this.k0=.5*this.cons*Wh(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Kh(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=Wh(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(dc(this.lat0,this.sinlat0,this.e))-lh,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))},forward:function(t){var e,i,n,r,s,o,a=t.x,l=t.y,h=Math.sin(l),u=Math.cos(l),c=Vh(a-this.long0,this.over);return Math.abs(Math.abs(a-this.long0)-Math.PI)<=hh&&Math.abs(l+this.lat0)<=hh?(t.x=NaN,t.y=NaN,t):this.sphere?(e=2*this.k0/(1+this.sinlat0*h+this.coslat0*u*Math.cos(c)),t.x=this.a*e*u*Math.sin(c)+this.x0,t.y=this.a*e*(this.coslat0*h-this.sinlat0*u*Math.cos(c))+this.y0,t):(i=2*Math.atan(dc(l,h,this.e))-lh,r=Math.cos(i),n=Math.sin(i),Math.abs(this.coslat0)<=hh?(s=Kh(this.e,l*this.con,this.con*h),o=2*this.a*this.k0*s/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)<hh?(e=2*this.a*this.k0/(1+r*Math.cos(c)),t.y=e*n):(e=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*n+this.cosX0*r*Math.cos(c))),t.y=e*(this.cosX0*n-this.sinX0*r*Math.cos(c))+this.y0),t.x=e*r*Math.sin(c)+this.x0,t))},inverse:function(t){var e,i,n,r,s;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<=hh?(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)<hh?this.lat0>0?Vh(this.long0+Math.atan2(t.x,-1*t.y),this.over):Vh(this.long0+Math.atan2(t.x,t.y),this.over):Vh(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)<=hh){if(o<=hh)return i=this.lat0,e=this.long0,t.x=e,t.y=i,t;t.x*=this.con,t.y*=this.con,n=o*this.cons/(2*this.a*this.k0),i=this.con*Yh(this.e,n),e=this.con*Vh(this.con*this.long0+Math.atan2(t.x,-1*t.y),this.over)}else r=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,o<=hh?s=this.X0:(s=Math.asin(Math.cos(r)*this.sinX0+t.y*Math.sin(r)*this.cosX0/o),e=Vh(this.long0+Math.atan2(t.x*Math.sin(r),o*this.cosX0*Math.cos(r)-t.y*this.sinX0*Math.sin(r)),this.over)),i=-1*Yh(this.e,Math.tan(.5*(lh+s)));return t.x=e,t.y=i,t},names:["stere","Stereographic_South_Pole","Polar_Stereographic_variant_A","Polar_Stereographic_variant_B","Polar_Stereographic"],ssfn_:dc},pc={init:function(){var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),i=this.a,n=1/this.rf,r=2*n-Math.pow(n,2),s=this.e=Math.sqrt(r);this.R=this.k0*i*Math.sqrt(1-r)/(1-r*Math.pow(e,2)),this.alpha=Math.sqrt(1+r/(1-r)*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)),l=Math.log((1+s*e)/(1-s*e));this.K=o-this.alpha*a+this.alpha*s/2*l},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))),n=-this.alpha*(e+i)+this.K,r=2*(Math.atan(Math.exp(n))-Math.PI/4),s=this.alpha*(t.x-this.lambda0),o=Math.atan(Math.sin(s)/(Math.sin(this.b0)*Math.tan(r)+Math.cos(this.b0)*Math.cos(s))),a=Math.asin(Math.cos(this.b0)*Math.sin(r)-Math.sin(this.b0)*Math.cos(r)*Math.cos(s));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,n=e/this.R,r=2*(Math.atan(Math.exp(i/this.R))-Math.PI/4),s=Math.asin(Math.cos(this.b0)*Math.sin(r)+Math.sin(this.b0)*Math.cos(r)*Math.cos(n)),o=Math.atan(Math.sin(n)/(Math.cos(this.b0)*Math.cos(n)-Math.sin(this.b0)*Math.tan(r))),a=this.lambda0+o/this.alpha,l=0,h=s,u=-1e3,c=0;Math.abs(h-u)>1e-7;){if(++c>20)return;l=1/this.alpha*(Math.log(Math.tan(Math.PI/4+s/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(h))/2)),u=h,h=2*Math.atan(Math.exp(l))-Math.PI/2}return t.x=a,t.y=h,t},names:["somerc"]};var gc=1e-7;const mc={init:function(){var t,e,i,n,r,s,o,a,l,h,u,c,d,f,p=0,g=0,m=0,y=0,_=0,v=0,x=0;this.no_off=(d=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],f="object"==typeof(c=this).projName?Object.keys(c.projName)[0]:c.projName,"no_uoff"in c||"no_off"in c||-1!==d.indexOf(f)||-1!==d.indexOf(iu(f))),this.no_rot="no_rot"in this;var w=!1;"alpha"in this&&(w=!0);var b=!1;if("rectified_grid_angle"in this&&(b=!0),w&&(x=this.alpha),b&&(p=this.rectified_grid_angle),w||b)g=this.longc;else if(m=this.long1,_=this.lat1,y=this.long2,v=this.lat2,Math.abs(_-v)<=gc||(t=Math.abs(_))<=gc||Math.abs(t-lh)<=gc||Math.abs(Math.abs(this.lat0)-lh)<=gc||Math.abs(Math.abs(v)-lh)<=gc)throw new Error;var S=1-this.es;e=Math.sqrt(S),Math.abs(this.lat0)>hh?(a=Math.sin(this.lat0),i=Math.cos(this.lat0),t=1-this.es*a*a,this.B=i*i,this.B=Math.sqrt(1+this.es*this.B*this.B/S),this.A=this.B*this.k0*e/t,(r=(n=this.B*e/(i*Math.sqrt(t)))*n-1)<=0?r=0:(r=Math.sqrt(r),this.lat0<0&&(r=-r)),this.E=r+=n,this.E*=Math.pow(Kh(this.e,this.lat0,a),this.B)):(this.B=1/e,this.A=this.k0,this.E=n=r=1),w||b?(w?(u=Math.asin(Math.sin(x)/n),b||(p=x)):(u=p,x=Math.asin(n*Math.sin(u))),this.lam0=g-Math.asin(.5*(r-1/r)*Math.tan(u))/this.B):(s=Math.pow(Kh(this.e,_,Math.sin(_)),this.B),o=Math.pow(Kh(this.e,v,Math.sin(v)),this.B),r=this.E/s,l=(o-s)/(o+s),h=((h=this.E*this.E)-o*s)/(h+o*s),(t=m-y)<-Math.PI?y-=fh:t>Math.PI&&(y+=fh),this.lam0=Vh(.5*(m+y)-Math.atan(h*Math.tan(.5*this.B*(m-y))/l)/this.B,this.over),u=Math.atan(2*Math.sin(this.B*Vh(m-this.lam0,this.over))/(r-1/r)),p=x=Math.asin(n*Math.sin(u))),this.singam=Math.sin(u),this.cosgam=Math.cos(u),this.sinrot=Math.sin(p),this.cosrot=Math.cos(p),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(n*n-1)/Math.cos(x))),this.lat0<0&&(this.u_0=-this.u_0)),r=.5*u,this.v_pole_n=this.ArB*Math.log(Math.tan(dh-r)),this.v_pole_s=this.ArB*Math.log(Math.tan(dh+r))},forward:function(t){var e,i,n,r,s,o,a,l,h={};if(t.x=t.x-this.lam0,Math.abs(Math.abs(t.y)-lh)>hh){if(e=.5*((s=this.E/Math.pow(Kh(this.e,t.y,Math.sin(t.y)),this.B))-(o=1/s)),i=.5*(s+o),r=Math.sin(this.B*t.x),n=(e*this.singam-r*this.cosgam)/i,Math.abs(Math.abs(n)-1)<hh)throw new Error;l=.5*this.ArB*Math.log((1-n)/(1+n)),o=Math.cos(this.B*t.x),a=Math.abs(o)<gc?this.A*t.x:this.ArB*Math.atan2(e*this.cosgam+r*this.singam,o)}else l=t.y>0?this.v_pole_n:this.v_pole_s,a=this.ArB*t.y;return this.no_rot?(h.x=a,h.y=l):(a-=this.u_0,h.x=l*this.cosrot+a*this.sinrot,h.y=a*this.cosrot-l*this.sinrot),h.x=this.a*h.x+this.x0,h.y=this.a*h.y+this.y0,h},inverse:function(t){var e,i,n,r,s,o,a,l={};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),r=.5*((n=Math.exp(-this.BrA*i))-1/n),s=.5*(n+1/n),a=((o=Math.sin(this.BrA*e))*this.cosgam+r*this.singam)/s,Math.abs(Math.abs(a)-1)<hh)l.x=0,l.y=a<0?-lh:lh;else{if(l.y=this.E/Math.sqrt((1+a)/(1-a)),l.y=Yh(this.e,Math.pow(l.y,1/this.B)),l.y===1/0)throw new Error;l.x=-this.rB*Math.atan2(r*this.cosgam-o*this.singam,Math.cos(this.BrA*e))}return l.x+=this.lam0,l},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"]},yc={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)<hh)){var t=this.b/this.a;this.e=Math.sqrt(1-t*t);var e=Math.sin(this.lat1),i=Math.cos(this.lat1),n=Wh(this.e,e,i),r=Kh(this.e,this.lat1,e),s=Math.sin(this.lat2),o=Math.cos(this.lat2),a=Wh(this.e,s,o),l=Kh(this.e,this.lat2,s),h=Math.abs(Math.abs(this.lat0)-lh)<hh?0:Kh(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>hh?this.ns=Math.log(n/a)/Math.log(r/l):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=n/(this.ns*Math.pow(r,this.ns)),this.rh=this.a*this.f0*Math.pow(h,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)<=hh&&(i=Xh(i)*(lh-2e-10));var n,r,s=Math.abs(Math.abs(i)-lh);if(s>hh)n=Kh(this.e,i,Math.sin(i)),r=this.a*this.f0*Math.pow(n,this.ns);else{if((s=i*this.ns)<=0)return null;r=0}var o=this.ns*Vh(e-this.long0,this.over);return t.x=this.k0*(r*Math.sin(o))+this.x0,t.y=this.k0*(this.rh-r*Math.cos(o))+this.y0,t},inverse:function(t){var e,i,n,r,s,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 l=0;if(0!==e&&(l=Math.atan2(i*o,i*a)),0!==e||this.ns>0){if(i=1/this.ns,n=Math.pow(e/(this.a*this.f0),i),-9999===(r=Yh(this.e,n)))return null}else r=-lh;return s=Vh(l/this.ns+this.long0,this.over),t.x=s,t.y=r,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)"]},_c={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,n,r,s,o,a,l=t.x,h=t.y,u=Vh(l-this.long0,this.over);return e=Math.pow((1+this.e*Math.sin(h))/(1-this.e*Math.sin(h)),this.alfa*this.e/2),i=2*(Math.atan(this.k*Math.pow(Math.tan(h/2+this.s45),this.alfa)/e)-this.s45),n=-u*this.alfa,r=Math.asin(Math.cos(this.ad)*Math.sin(i)+Math.sin(this.ad)*Math.cos(i)*Math.cos(n)),s=Math.asin(Math.cos(i)*Math.sin(n)/Math.cos(r)),o=this.n*s,a=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(r/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,n,r,s,o,a,l=t.x;t.x=t.y,t.y=l,this.czech||(t.y*=-1,t.x*=-1),s=Math.sqrt(t.x*t.x+t.y*t.y),r=Math.atan2(t.y,t.x)/Math.sin(this.s0),n=2*(Math.atan(Math.pow(this.ro0/s,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(n)-Math.sin(this.ad)*Math.cos(n)*Math.cos(r)),i=Math.asin(Math.cos(n)*Math.sin(r)/Math.cos(e)),t.x=this.long0-i/this.alfa,o=e,a=0;var h=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,h+=1}while(0===a&&h<15);return h>=15?null:t},names:["Krovak","Krovak Modified","Krovak (North Orientated)","Krovak Modified (North Orientated)","krovak"]};function vc(t,e,i,n,r){return t*r-e*Math.sin(2*r)+i*Math.sin(4*r)-n*Math.sin(6*r)}function xc(t){return 1-.25*t*(1+t/16*(3+1.25*t))}function wc(t){return.375*t*(1+.25*t*(1+.46875*t))}function bc(t){return.05859375*t*t*(1+.75*t)}function Sc(t){return t*t*t*(35/3072)}function Mc(t,e,i){var n=e*i;return t/Math.sqrt(1-n*n)}function Ec(t){return Math.abs(t)<lh?t:t-Xh(t)*Math.PI}function Cc(t,e,i,n,r){var s,o;s=t/e;for(var a=0;a<15;a++)if(s+=o=(t-(e*s-i*Math.sin(2*s)+n*Math.sin(4*s)-r*Math.sin(6*s)))/(e-2*i*Math.cos(2*s)+4*n*Math.cos(4*s)-6*r*Math.cos(6*s)),Math.abs(o)<=1e-10)return s;return NaN}const Pc={init:function(){this.sphere||(this.e0=xc(this.es),this.e1=wc(this.es),this.e2=bc(this.es),this.e3=Sc(this.es),this.ml0=this.a*vc(this.e0,this.e1,this.e2,this.e3,this.lat0))},forward:function(t){var e,i,n=t.x,r=t.y;if(n=Vh(n-this.long0,this.over),this.sphere)e=this.a*Math.asin(Math.cos(r)*Math.sin(n)),i=this.a*(Math.atan2(Math.tan(r),Math.cos(n))-this.lat0);else{var s=Math.sin(r),o=Math.cos(r),a=Mc(this.a,this.e,s),l=Math.tan(r)*Math.tan(r),h=n*Math.cos(r),u=h*h,c=this.es*o*o/(1-this.es);e=a*h*(1-u*l*(1/6-(8-l+8*c)*u/120)),i=this.a*vc(this.e0,this.e1,this.e2,this.e3,r)-this.ml0+a*s/o*u*(.5+(5-l+6*c)*u/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,n=t.x/this.a,r=t.y/this.a;if(this.sphere){var s=r+this.lat0;e=Math.asin(Math.sin(s)*Math.cos(n)),i=Math.atan2(Math.tan(n),Math.cos(s))}else{var o=Cc(this.ml0/this.a+r,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(o)-lh)<=hh)return t.x=this.long0,t.y=lh,r<0&&(t.y*=-1),t;var a=Mc(this.a,this.e,Math.sin(o)),l=a*a*a/this.a/this.a*(1-this.es),h=Math.pow(Math.tan(o),2),u=n*this.a/a,c=u*u;e=o-a*Math.tan(o)/l*u*u*(.5-(1+3*h)*u*u/24),i=u*(1-c*(h/3+(1+3*h)*h*c/15))/Math.cos(o)}return t.x=Vh(i+this.long0,this.over),t.y=Ec(e),t},names:["Cassini","Cassini_Soldner","cass"]};function Ic(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 Tc={init:function(){var t,e=Math.abs(this.lat0);if(Math.abs(e-lh)<hh?this.mode=this.lat0<0?1:2:Math.abs(e)<hh?this.mode=3:this.mode=4,this.es>0)switch(this.qp=Ic(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=Ic(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,n,r,s,o,a,l,h,u,c=t.x,d=t.y;if(c=Vh(c-this.long0,this.over),this.sphere){if(s=Math.sin(d),u=Math.cos(d),n=Math.cos(c),this.mode===this.OBLIQ||this.mode===this.EQUIT){if((i=this.mode===this.EQUIT?1+u*n:1+this.sinph0*s+this.cosph0*u*n)<=hh)return null;e=(i=Math.sqrt(2/i))*u*Math.sin(c),i*=this.mode===this.EQUIT?s:this.cosph0*s-this.sinph0*u*n}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(n=-n),Math.abs(d+this.lat0)<hh)return null;i=dh-.5*d,e=(i=2*(this.mode===this.S_POLE?Math.cos(i):Math.sin(i)))*Math.sin(c),i*=n}}else{switch(a=0,l=0,h=0,n=Math.cos(c),r=Math.sin(c),s=Math.sin(d),o=Ic(this.e,s),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(a=o/this.qp,l=Math.sqrt(1-a*a)),this.mode){case this.OBLIQ:h=1+this.sinb1*a+this.cosb1*l*n;break;case this.EQUIT:h=1+l*n;break;case this.N_POLE:h=lh+d,o=this.qp-o;break;case this.S_POLE:h=d-lh,o=this.qp+o}if(Math.abs(h)<hh)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:h=Math.sqrt(2/h),i=this.mode===this.OBLIQ?this.ymf*h*(this.cosb1*a-this.sinb1*l*n):(h=Math.sqrt(2/(1+l*n)))*a*this.ymf,e=this.xmf*h*l*r;break;case this.N_POLE:case this.S_POLE:o>=0?(e=(h=Math.sqrt(o))*r,i=n*(this.mode===this.S_POLE?h:-h)):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,n,r,s,o,a,l,h,u,c=t.x/this.a,d=t.y/this.a;if(this.sphere){var f,p=0,g=0;if((i=.5*(f=Math.sqrt(c*c+d*d)))>1)return null;switch(i=2*Math.asin(i),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(g=Math.sin(i),p=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(f)<=hh?0:Math.asin(d*g/f),c*=g,d=p*f;break;case this.OBLIQ:i=Math.abs(f)<=hh?this.lat0:Math.asin(p*this.sinph0+d*g*this.cosph0/f),c*=g*this.cosph0,d=(p-Math.sin(i)*this.sinph0)*f;break;case this.N_POLE:d=-d,i=lh-i;break;case this.S_POLE:i-=lh}e=0!==d||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(c,d):0}else{if(a=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(c/=this.dd,d*=this.dd,(o=Math.sqrt(c*c+d*d))<hh)return t.x=this.long0,t.y=this.lat0,t;r=2*Math.asin(.5*o/this.rq),n=Math.cos(r),c*=r=Math.sin(r),this.mode===this.OBLIQ?(a=n*this.sinb1+d*r*this.cosb1/o,s=this.qp*a,d=o*this.cosb1*n-d*this.sinb1*r):(a=d*r/o,s=this.qp*a,d=o*n)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(d=-d),!(s=c*c+d*d))return t.x=this.long0,t.y=this.lat0,t;a=1-s/this.qp,this.mode===this.S_POLE&&(a=-a)}e=Math.atan2(c,d),u=(l=Math.asin(a))+l,i=l+(h=this.apa)[0]*Math.sin(u)+h[1]*Math.sin(u+u)+h[2]*Math.sin(u+u+u)}return t.x=Vh(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 Rc(t){return Math.abs(t)>1&&(t=t>1?1:-1),Math.asin(t)}const kc={init:function(){Math.abs(this.lat1+this.lat2)<hh||(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=Wh(this.e3,this.sin_po,this.cos_po),this.qs1=Ic(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=Wh(this.e3,this.sin_po,this.cos_po),this.qs2=Ic(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=Ic(this.e3,this.sin_po),Math.abs(this.lat1-this.lat2)>hh?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 n=Ic(this.e3,this.sin_phi),r=this.a*Math.sqrt(this.c-this.ns0*n)/this.ns0,s=this.ns0*Vh(e-this.long0,this.over),o=r*Math.sin(s)+this.x0,a=this.rh-r*Math.cos(s)+this.y0;return t.x=o,t.y=a,t},inverse:function(t){var e,i,n,r,s,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),n=1):(e=-Math.sqrt(t.x*t.x+t.y*t.y),n=-1),r=0,0!==e&&(r=Math.atan2(n*t.x,n*t.y)),n=e*this.ns0/this.a,this.sphere?o=Math.asin((this.c-n*n)/(2*this.ns0)):(i=(this.c-n*n)/this.ns0,o=this.phi1z(this.e3,i)),s=Vh(r/this.ns0+this.long0,this.over),t.x=s,t.y=o,t},names:["Albers_Conic_Equal_Area","Albers_Equal_Area","Albers","aea"],phi1z:function(t,e){var i,n,r,s,o=Rc(.5*e);if(t<hh)return o;for(var a=t*t,l=1;l<=25;l++)if(o+=s=.5*(r=1-(n=t*(i=Math.sin(o)))*n)*r/Math.cos(o)*(e/(1-a)-i/r+.5/t*Math.log((1-n)/(1+n))),Math.abs(s)<=1e-7)return o;return null}},Ac={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,n,r,s,o,a,l=t.x,h=t.y;return n=Vh(l-this.long0,this.over),e=Math.sin(h),i=Math.cos(h),r=Math.cos(n),(s=this.sin_p14*e+this.cos_p14*i*r)>0||Math.abs(s)<=hh?(o=this.x0+1*this.a*i*Math.sin(n)/s,a=this.y0+1*this.a*(this.cos_p14*e-this.sin_p14*i*r)/s):(o=this.x0+this.infinity_dist*i*Math.sin(n),a=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*i*r)),t.x=o,t.y=a,t},inverse:function(t){var e,i,n,r,s,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))?(r=Math.atan2(e,this.rc),i=Math.sin(r),o=Rc((n=Math.cos(r))*this.sin_p14+t.y*i*this.cos_p14/e),s=Math.atan2(t.x*i,e*this.cos_p14*n-t.y*this.sin_p14*i),s=Vh(this.long0+s,this.over)):(o=this.phic0,s=0),t.x=s,t.y=o,t},names:["gnom"]},Gc={init:function(){this.sphere||(this.k0=Wh(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))},forward:function(t){var e,i,n=t.x,r=t.y,s=Vh(n-this.long0,this.over);if(this.sphere)e=this.x0+this.a*s*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(r)/Math.cos(this.lat_ts);else{var o=Ic(this.e,Math.sin(r));e=this.x0+this.a*this.k0*s,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=Vh(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*lh:lh;for(var n,r,s,o,a=Math.asin(.5*e),l=0;l<30;l++)if(r=Math.sin(a),s=Math.cos(a),o=t*r,a+=n=Math.pow(1-o*o,2)/(2*s)*(e/(1-t*t)-r/(1-o*o)+.5/t*Math.log((1-o)/(1+o))),Math.abs(n)<=1e-10)return a;return NaN}(this.e,2*t.y*this.k0/this.a),e=Vh(this.long0+t.x/(this.a*this.k0),this.over)),t.x=e,t.y=i,t},names:["cea"]},Oc={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,n=Vh(e-this.long0,this.over),r=Ec(i-this.lat0);return t.x=this.x0+this.a*n*this.rc,t.y=this.y0+this.a*r,t},inverse:function(t){var e=t.x,i=t.y;return t.x=Vh(this.long0+(e-this.x0)/(this.a*this.rc),this.over),t.y=Ec(this.lat0+(i-this.y0)/this.a),t},names:["Equirectangular","Equidistant_Cylindrical","Equidistant_Cylindrical_Spherical","eqc"]},Fc={init:function(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=xc(this.es),this.e1=wc(this.es),this.e2=bc(this.es),this.e3=Sc(this.es),this.ml0=this.a*vc(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(t){var e,i,n,r=t.x,s=t.y,o=Vh(r-this.long0,this.over);if(n=o*Math.sin(s),this.sphere)Math.abs(s)<=hh?(e=this.a*o,i=-1*this.a*this.lat0):(e=this.a*Math.sin(n)/Math.tan(s),i=this.a*(Ec(s-this.lat0)+(1-Math.cos(n))/Math.tan(s)));else if(Math.abs(s)<=hh)e=this.a*o,i=-1*this.ml0;else{var a=Mc(this.a,this.e,Math.sin(s))/Math.tan(s);e=a*Math.sin(n),i=this.a*vc(this.e0,this.e1,this.e2,this.e3,s)-this.ml0+a*(1-Math.cos(n))}return t.x=e+this.x0,t.y=i+this.y0,t},inverse:function(t){var e,i,n,r,s,o,a,l,h;if(n=t.x-this.x0,r=t.y-this.y0,this.sphere)if(Math.abs(r+this.a*this.lat0)<=hh)e=Vh(n/this.a+this.long0,this.over),i=0;else{var u;for(o=this.lat0+r/this.a,a=n*n/this.a/this.a+o*o,l=o,s=20;s;--s)if(l+=h=-1*(o*(l*(u=Math.tan(l))+1)-l-.5*(l*l+a)*u)/((l-o)/u-1),Math.abs(h)<=hh){i=l;break}e=Vh(this.long0+Math.asin(n*Math.tan(l)/this.a)/Math.sin(i),this.over)}else if(Math.abs(r+this.ml0)<=hh)i=0,e=Vh(this.long0+n/this.a,this.over);else{var c,d,f,p,g;for(o=(this.ml0+r)/this.a,a=n*n/this.a/this.a+o*o,l=o,s=20;s;--s)if(g=this.e*Math.sin(l),c=Math.sqrt(1-g*g)*Math.tan(l),d=this.a*vc(this.e0,this.e1,this.e2,this.e3,l),f=this.e0-2*this.e1*Math.cos(2*l)+4*this.e2*Math.cos(4*l)-6*this.e3*Math.cos(6*l),l-=h=(o*(c*(p=d/this.a)+1)-p-.5*c*(p*p+a))/(this.es*Math.sin(2*l)*(p*p+a-2*o*p)/(4*c)+(o-p)*(c*f-2/Math.sin(2*l))-f),Math.abs(h)<=hh){i=l;break}c=Math.sqrt(1-this.es*Math.pow(Math.sin(i),2))*Math.tan(i),e=Vh(this.long0+Math.asin(n*c/this.a)/Math.sin(i),this.over)}return t.x=e,t.y=i,t},names:["Polyconic","American_Polyconic","poly"]},Lc={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,n=t.y-this.lat0,r=i-this.long0,s=n/ah*1e-5,o=r,a=1,l=0;for(e=1;e<=10;e++)a*=s,l+=this.A[e]*a;var h,u=l,c=o,d=1,f=0,p=0,g=0;for(e=1;e<=6;e++)h=f*u+d*c,d=d*u-f*c,f=h,p=p+this.B_re[e]*d-this.B_im[e]*f,g=g+this.B_im[e]*d+this.B_re[e]*f;return t.x=g*this.a+this.x0,t.y=p*this.a+this.y0,t},inverse:function(t){var e,i,n=t.x,r=t.y,s=n-this.x0,o=(r-this.y0)/this.a,a=s/this.a,l=1,h=0,u=0,c=0;for(e=1;e<=6;e++)i=h*o+l*a,l=l*o-h*a,h=i,u=u+this.C_re[e]*l-this.C_im[e]*h,c=c+this.C_im[e]*l+this.C_re[e]*h;for(var d=0;d<this.iterations;d++){var f,p=u,g=c,m=o,y=a;for(e=2;e<=6;e++)f=g*u+p*c,p=p*u-g*c,g=f,m+=(e-1)*(this.B_re[e]*p-this.B_im[e]*g),y+=(e-1)*(this.B_im[e]*p+this.B_re[e]*g);p=1,g=0;var _=this.B_re[1],v=this.B_im[1];for(e=2;e<=6;e++)f=g*u+p*c,p=p*u-g*c,g=f,_+=e*(this.B_re[e]*p-this.B_im[e]*g),v+=e*(this.B_im[e]*p+this.B_re[e]*g);var x=_*_+v*v;u=(m*_+y*v)/x,c=(y*_-m*v)/x}var w=u,b=c,S=1,M=0;for(e=1;e<=9;e++)S*=w,M+=this.D[e]*S;var E=this.lat0+M*ah*1e5,C=this.long0+b;return t.x=C,t.y=E,t},names:["New_Zealand_Map_Grid","nzmg"]},jc={init:function(){},forward:function(t){var e=t.x,i=t.y,n=Vh(e-this.long0,this.over),r=this.x0+this.a*n,s=this.y0+this.a*Math.log(Math.tan(Math.PI/4+i/2.5))*1.25;return t.x=r,t.y=s,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e=Vh(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"]},Nc={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=Qu(this.es)},forward:function(t){var e,i,n=t.x,r=t.y;if(n=Vh(n-this.long0,this.over),this.sphere){if(this.m)for(var s=this.n*Math.sin(r),o=20;o;--o){var a=(this.m*r+Math.sin(r)-s)/(this.m+Math.cos(r));if(r-=a,Math.abs(a)<hh)break}else r=1!==this.n?Math.asin(this.n*Math.sin(r)):r;e=this.a*this.C_x*n*(this.m+Math.cos(r)),i=this.a*this.C_y*r}else{var l=Math.sin(r),h=Math.cos(r);i=this.a*tc(r,l,h,this.en),e=this.a*n*h/Math.sqrt(1-this.es*l*l)}return t.x=e,t.y=i,t},inverse:function(t){var e,i,n;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=Rc((this.m*e+Math.sin(e))/this.n):1!==this.n&&(e=Rc(Math.sin(e)/this.n)),i=Vh(i+this.long0,this.over),e=Ec(e)):(e=ec(t.y/this.a,this.es,this.en),(n=Math.abs(e))<lh?(n=Math.sin(e),i=Vh(this.long0+t.x*Math.sqrt(1-this.es*n*n)/(this.a*Math.cos(e)),this.over)):n-hh<lh&&(i=this.long0)),t.x=i,t.y=e,t},names:["Sinusoidal","sinu"]},Dc={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,n=Vh(e-this.long0,this.over),r=i,s=Math.PI*Math.sin(i);;){var o=-(r+Math.sin(r)-s)/(1+Math.cos(r));if(r+=o,Math.abs(o)<hh)break}r/=2,Math.PI/2-Math.abs(i)<hh&&(n=0);var a=.900316316158*this.a*n*Math.cos(r)+this.x0,l=1.4142135623731*this.a*Math.sin(r)+this.y0;return t.x=a,t.y=l,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 n=Vh(this.long0+t.x/(.900316316158*this.a*Math.cos(e)),this.over);n<-Math.PI&&(n=-Math.PI),n>Math.PI&&(n=Math.PI),i=(2*e+Math.sin(2*e))/Math.PI,Math.abs(i)>1&&(i=1);var r=Math.asin(i);return t.x=n,t.y=r,t},names:["Mollweide","moll"]},zc={init:function(){Math.abs(this.lat1+this.lat2)<hh||(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=xc(this.es),this.e1=wc(this.es),this.e2=bc(this.es),this.e3=Sc(this.es),this.sin_phi=Math.sin(this.lat1),this.cos_phi=Math.cos(this.lat1),this.ms1=Wh(this.e,this.sin_phi,this.cos_phi),this.ml1=vc(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<hh?this.ns=this.sin_phi:(this.sin_phi=Math.sin(this.lat2),this.cos_phi=Math.cos(this.lat2),this.ms2=Wh(this.e,this.sin_phi,this.cos_phi),this.ml2=vc(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=vc(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,n=t.y;if(this.sphere)e=this.a*(this.g-n);else{var r=vc(this.e0,this.e1,this.e2,this.e3,n);e=this.a*(this.g-r)}var s=this.ns*Vh(i-this.long0,this.over),o=this.x0+e*Math.sin(s),a=this.y0+this.rh-e*Math.cos(s);return t.x=o,t.y=a,t},inverse:function(t){var e,i,n,r;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 s=0;return 0!==i&&(s=Math.atan2(e*t.x,e*t.y)),this.sphere?(r=Vh(this.long0+s/this.ns,this.over),n=Ec(this.g-i/this.a),t.x=r,t.y=n,t):(n=Cc(this.g-i/this.a,this.e0,this.e1,this.e2,this.e3),r=Vh(this.long0+s/this.ns,this.over),t.x=r,t.y=n,t)},names:["Equidistant_Conic","eqdc"]},qc={init:function(){this.R=this.a},forward:function(t){var e,i,n=t.x,r=t.y,s=Vh(n-this.long0,this.over);Math.abs(r)<=hh&&(e=this.x0+this.R*s,i=this.y0);var o=Rc(2*Math.abs(r/Math.PI));(Math.abs(s)<=hh||Math.abs(Math.abs(r)-lh)<=hh)&&(e=this.x0,i=r>=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/s-s/Math.PI),l=a*a,h=Math.sin(o),u=Math.cos(o),c=u/(h+u-1),d=c*c,f=c*(2/h-1),p=f*f,g=Math.PI*this.R*(a*(c-p)+Math.sqrt(l*(c-p)*(c-p)-(p+l)*(d-p)))/(p+l);s<0&&(g=-g),e=this.x0+g;var m=l+c;return g=Math.PI*this.R*(f*m-a*Math.sqrt((p+l)*(l+1)-m*m))/(p+l),i=r>=0?this.y0+g:this.y0-g,t.x=e,t.y=i,t},inverse:function(t){var e,i,n,r,s,o,a,l,h,u,c,d;return t.x-=this.x0,t.y-=this.y0,c=Math.PI*this.R,s=(n=t.x/c)*n+(r=t.y/c)*r,c=3*(r*r/(l=-2*(o=-Math.abs(r)*(1+s))+1+2*r*r+s*s)+(2*(a=o-2*r*r+n*n)*a*a/l/l/l-9*o*a/l/l)/27)/(h=(o-a*a/3/l)/l)/(u=2*Math.sqrt(-h/3)),Math.abs(c)>1&&(c=c>=0?1:-1),d=Math.acos(c)/3,i=t.y>=0?(-u*Math.cos(d+Math.PI/3)-a/3/l)*Math.PI:-(-u*Math.cos(d+Math.PI/3)-a/3/l)*Math.PI,e=Math.abs(n)<hh?this.long0:Vh(this.long0+Math.PI*(s-1+Math.sqrt(1+2*(n*n-r*r)+s*s))/2/n,this.over),t.x=e,t.y=i,t},names:["Van_der_Grinten_I","VanDerGrinten","Van_der_Grinten","vandg"]},$c={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,n,r,s,o,a,l,h,u,c,d=t.x,f=t.y,p=Math.sin(t.y),g=Math.cos(t.y),m=Vh(d-this.long0,this.over);return this.sphere?Math.abs(this.sin_p12-1)<=hh?(t.x=this.x0+this.a*(lh-f)*Math.sin(m),t.y=this.y0-this.a*(lh-f)*Math.cos(m),t):Math.abs(this.sin_p12+1)<=hh?(t.x=this.x0+this.a*(lh+f)*Math.sin(m),t.y=this.y0+this.a*(lh+f)*Math.cos(m),t):(h=this.sin_p12*p+this.cos_p12*g*Math.cos(m),l=(a=Math.acos(h))?a/Math.sin(a):1,t.x=this.x0+this.a*l*g*Math.sin(m),t.y=this.y0+this.a*l*(this.cos_p12*p-this.sin_p12*g*Math.cos(m)),t):(e=xc(this.es),i=wc(this.es),n=bc(this.es),r=Sc(this.es),Math.abs(this.sin_p12-1)<=hh?(s=this.a*vc(e,i,n,r,lh),o=this.a*vc(e,i,n,r,f),t.x=this.x0+(s-o)*Math.sin(m),t.y=this.y0-(s-o)*Math.cos(m),t):Math.abs(this.sin_p12+1)<=hh?(s=this.a*vc(e,i,n,r,lh),o=this.a*vc(e,i,n,r,f),t.x=this.x0+(s+o)*Math.sin(m),t.y=this.y0+(s+o)*Math.cos(m),t):Math.abs(d)<hh&&Math.abs(f-this.lat0)<hh?(t.x=t.y=0,t):(u=function(t,e,i,n,r,s){const o=n-e,a=Math.atan((1-s)*Math.tan(t)),l=Math.atan((1-s)*Math.tan(i)),h=Math.sin(a),u=Math.cos(a),c=Math.sin(l),d=Math.cos(l);let f,p,g,m,y,_,v,x,w,b,S,M,E,C,P,I=o,T=100;do{if(p=Math.sin(I),g=Math.cos(I),m=Math.sqrt(d*p*(d*p)+(u*c-h*d*g)*(u*c-h*d*g)),0===m)return{azi1:0,s12:0};y=h*c+u*d*g,_=Math.atan2(m,y),v=u*d*p/m,x=1-v*v,w=0!==x?y-2*h*c/x:0,b=s/16*x*(4+s*(4-3*x)),f=I,I=o+(1-b)*s*v*(_+b*m*(w+b*y*(2*w*w-1)))}while(Math.abs(I-f)>1e-12&&--T>0);return 0===T?{azi1:NaN,s12:NaN}:(S=x*(r*r-r*(1-s)*(r*(1-s)))/(r*(1-s)*(r*(1-s))),M=1+S/16384*(4096+S*(S*(320-175*S)-768)),E=S/1024*(256+S*(S*(74-47*S)-128)),C=E*m*(w+E/4*(y*(2*w*w-1)-E/6*w*(4*m*m-3)*(4*w*w-3))),P=r*(1-s)*M*(_-C),{azi1:Math.atan2(d*p,u*c-h*d*g),s12:P})}(this.lat0,this.long0,f,d,this.a,this.f),c=u.azi1,t.x=u.s12*Math.sin(c),t.y=u.s12*Math.cos(c),t))},inverse:function(t){var e,i,n,r,s,o,a,l,h,u,c,d,f,p,g;if(t.x-=this.x0,t.y-=this.y0,this.sphere){if((e=Math.sqrt(t.x*t.x+t.y*t.y))>2*lh*this.a)return;return i=e/this.a,n=Math.sin(i),r=Math.cos(i),s=this.long0,Math.abs(e)<=hh?o=this.lat0:(o=Rc(r*this.sin_p12+t.y*n*this.cos_p12/e),a=Math.abs(this.lat0)-lh,s=Math.abs(a)<=hh?this.lat0>=0?Vh(this.long0+Math.atan2(t.x,-t.y),this.over):Vh(this.long0-Math.atan2(-t.x,t.y),this.over):Vh(this.long0+Math.atan2(t.x*n,e*this.cos_p12*r-t.y*this.sin_p12*n),this.over)),t.x=s,t.y=o,t}return l=xc(this.es),h=wc(this.es),u=bc(this.es),c=Sc(this.es),Math.abs(this.sin_p12-1)<=hh?(o=Cc(((d=this.a*vc(l,h,u,c,lh))-(e=Math.sqrt(t.x*t.x+t.y*t.y)))/this.a,l,h,u,c),s=Vh(this.long0+Math.atan2(t.x,-1*t.y),this.over),t.x=s,t.y=o,t):Math.abs(this.sin_p12+1)<=hh?(d=this.a*vc(l,h,u,c,lh),o=Cc(((e=Math.sqrt(t.x*t.x+t.y*t.y))-d)/this.a,l,h,u,c),s=Vh(this.long0+Math.atan2(t.x,t.y),this.over),t.x=s,t.y=o,t):(f=Math.atan2(t.x,t.y),p=Math.sqrt(t.x*t.x+t.y*t.y),g=function(t,e,i,n,r,s){const o=Math.atan((1-s)*Math.tan(t)),a=Math.sin(o),l=Math.cos(o),h=Math.sin(i),u=Math.cos(i),c=Math.atan2(a,l*u),d=l*h,f=1-d*d,p=f*(r*r-r*(1-s)*(r*(1-s)))/(r*(1-s)*(r*(1-s))),g=1+p/16384*(4096+p*(p*(320-175*p)-768)),m=p/1024*(256+p*(p*(74-47*p)-128));let y,_,v,x,w,b=n/(r*(1-s)*g),S=100;do{_=Math.cos(2*c+b),v=Math.sin(b),x=Math.cos(b),w=m*v*(_+m/4*(x*(2*_*_-1)-m/6*_*(4*v*v-3)*(4*_*_-3))),y=b,b=n/(r*(1-s)*g)+w}while(Math.abs(b-y)>1e-12&&--S>0);if(0===S)return{lat2:NaN,lon2:NaN};const M=a*v-l*x*u,E=s/16*f*(4+s*(4-3*f));return{lat2:Math.atan2(a*x+l*v*u,(1-s)*Math.sqrt(d*d+M*M)),lon2:e+(Math.atan2(v*h,l*x-a*v*u)-(1-E)*s*d*(b+E*v*(_+E*x*(2*_*_-1))))}}(this.lat0,this.long0,f,p,this.a,this.f),t.x=g.lon2,t.y=g.lat2,t)},names:["Azimuthal_Equidistant","aeqd"]},Bc={init:function(){this.sin_p14=Math.sin(this.lat0||0),this.cos_p14=Math.cos(this.lat0||0)},forward:function(t){var e,i,n,r,s,o,a,l=t.x,h=t.y;return n=Vh(l-(this.long0||0),this.over),e=Math.sin(h),i=Math.cos(h),r=Math.cos(n),((s=this.sin_p14*e+this.cos_p14*i*r)>0||Math.abs(s)<=hh)&&(o=1*this.a*i*Math.sin(n),a=(this.y0||0)+1*this.a*(this.cos_p14*e-this.sin_p14*i*r)),t.x=o,t.y=a,t},inverse:function(t){var e,i,n,r,s,o,a,l,h;return t.x-=this.x0||0,t.y-=this.y0||0,i=Rc((e=Math.sqrt(t.x*t.x+t.y*t.y))/this.a),n=Math.sin(i),r=Math.cos(i),l=this.long0||0,h=this.lat0||0,o=l,Math.abs(e)<=hh?(a=h,t.x=o,t.y=a,t):(a=Rc(r*this.sin_p14+t.y*n*this.cos_p14/e),s=Math.abs(h)-lh,Math.abs(s)<=hh?(o=Vh(h>=0?l+Math.atan2(t.x,-t.y):l-Math.atan2(-t.x,t.y),this.over),t.x=o,t.y=a,t):(o=Vh(l+Math.atan2(t.x*n,e*this.cos_p14*r-t.y*this.sin_p14*n),this.over),t.x=o,t.y=a,t))},names:["ortho"]};function Uc(t,e,i,n){var r;return t<hh?(n.value=1,r=0):(r=Math.atan2(e,i),Math.abs(r)<=dh?n.value=1:r>dh&&r<=lh+dh?(n.value=2,r-=lh):r>lh+dh||r<=-(lh+dh)?(n.value=3,r=r>=0?r-ph:r+ph):(n.value=4,r+=lh)),r}function Wc(t,e){var i=t+e;return i<-ph?i+=fh:i>+ph&&(i-=fh),i}const Xc={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>=lh-dh/2?this.face=5:this.lat0<=-(lh-dh/2)?this.face=6:Math.abs(this.long0)<=dh?this.face=1:Math.abs(this.long0)<=lh+dh?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,n,r,s,o,a={x:0,y:0},l={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)r=lh-e,i>=dh&&i<=lh+dh?(l.value=1,n=i-lh):i>lh+dh||i<=-(lh+dh)?(l.value=2,n=i>0?i-ph:i+ph):i>-(lh+dh)&&i<=-dh?(l.value=3,n=i+lh):(l.value=4,n=i);else if(6===this.face)r=lh+e,i>=dh&&i<=lh+dh?(l.value=1,n=-i+lh):i<dh&&i>=-dh?(l.value=2,n=-i):i<-dh&&i>=-(lh+dh)?(l.value=3,n=-i-lh):(l.value=4,n=i>0?-i+ph:-i-ph);else{var h,u,c,d,f,p;2===this.face?i=Wc(i,+lh):3===this.face?i=Wc(i,+ph):4===this.face&&(i=Wc(i,-lh)),d=Math.sin(e),f=Math.cos(e),p=Math.sin(i),h=f*Math.cos(i),u=f*p,c=d,1===this.face?n=Uc(r=Math.acos(h),c,u,l):2===this.face?n=Uc(r=Math.acos(u),c,-h,l):3===this.face?n=Uc(r=Math.acos(-h),c,-u,l):4===this.face?n=Uc(r=Math.acos(-u),c,h,l):(r=n=0,l.value=1)}return o=Math.atan(12/ph*(n+Math.acos(Math.sin(n)*Math.cos(dh))-lh)),s=Math.sqrt((1-Math.cos(r))/(Math.cos(o)*Math.cos(o))/(1-Math.cos(Math.atan(1/Math.cos(n))))),2===l.value?o+=lh:3===l.value?o+=ph:4===l.value&&(o+=1.5*ph),a.x=s*Math.cos(o),a.y=s*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,n,r,s,o,a,l,h,u,c,d,f={lam:0,phi:0},p={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)?p.value=1:t.y>=0&&t.y>=Math.abs(t.x)?(p.value=2,e-=lh):t.x<0&&-t.x>=Math.abs(t.y)?(p.value=3,e=e<0?e+ph:e-ph):(p.value=4,e+=lh),h=ph/12*Math.tan(e),s=Math.sin(h)/(Math.cos(h)-1/Math.sqrt(2)),o=Math.atan(s),(a=1-(n=Math.cos(e))*n*(r=Math.tan(i))*r*(1-Math.cos(Math.atan(1/Math.cos(o)))))<-1?a=-1:a>1&&(a=1),5===this.face)l=Math.acos(a),f.phi=lh-l,1===p.value?f.lam=o+lh:2===p.value?f.lam=o<0?o+ph:o-ph:3===p.value?f.lam=o-lh:f.lam=o;else if(6===this.face)l=Math.acos(a),f.phi=l-lh,1===p.value?f.lam=-o+lh:2===p.value?f.lam=-o:3===p.value?f.lam=-o-lh:f.lam=o<0?-o-ph:-o+ph;else{var g,m,y;h=(g=a)*g,m=(h+=(y=h>=1?0:Math.sqrt(1-h)*Math.sin(o))*y)>=1?0:Math.sqrt(1-h),2===p.value?(h=m,m=-y,y=h):3===p.value?(m=-m,y=-y):4===p.value&&(h=m,m=y,y=-h),2===this.face?(h=g,g=-m,m=h):3===this.face?(g=-g,m=-m):4===this.face&&(h=g,g=m,m=-h),f.phi=Math.acos(-y)-lh,f.lam=Math.atan2(m,g),2===this.face?f.lam=Wc(f.lam,-lh):3===this.face?f.lam=Wc(f.lam,-ph):4===this.face&&(f.lam=Wc(f.lam,+lh))}return 0!==this.es&&(u=f.phi<0?1:0,c=Math.tan(f.phi),d=this.b/Math.sqrt(c*c+this.one_minus_f_squared),f.phi=Math.atan(Math.sqrt(this.a*this.a-d*d)/(this.one_minus_f*d)),u&&(f.phi=-f.phi)),f.lam+=this.long0,t.x=f.lam,t.y=f.phi,t},names:["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"]};var Vc=[[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]],Kc=[[-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]],Yc=.8487,Zc=1.3523,Hc=ch/5,Jc=1/Hc,Qc=function(t,e){return t[0]+e*(t[1]+e*(t[2]+e*t[3]))};const td={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=Vh(t.x-this.long0,this.over),i=Math.abs(t.y),n=Math.floor(i*Hc);n<0?n=0:n>=18&&(n=17);var r={x:Qc(Vc[n],i=ch*(i-Jc*n))*e,y:Qc(Kc[n],i)};return t.y<0&&(r.y=-r.y),r.x=r.x*this.a*Yc+this.x0,r.y=r.y*this.a*Zc+this.y0,r},inverse:function(t){var e={x:(t.x-this.x0)/(this.a*Yc),y:Math.abs(t.y-this.y0)/(this.a*Zc)};if(e.y>=1)e.x/=Vc[18][0],e.y=t.y<0?-lh:lh;else{var i=Math.floor(18*e.y);for(i<0?i=0:i>=18&&(i=17);;)if(Kc[i][0]>e.y)--i;else{if(!(Kc[i+1][0]<=e.y))break;++i}var n=Kc[i],r=5*(e.y-n[0])/(Kc[i+1][0]-n[0]);r=function(t,e,i,n){for(var r=e;n;--n){var s=t(r);if(r-=s,Math.abs(s)<1e-10)break}return r}(function(t){return(Qc(n,t)-e.y)/function(t,e){return t[1]+e*(2*t[2]+3*e*t[3])}(n,t)},r,0,100),e.x/=Qc(Vc[i],r),e.y=(5*i+r)*uh,t.y<0&&(e.y=-e.y)}return e.x=Vh(e.x+this.long0,this.over),e},names:["Robinson","robin"]},ed={init:function(){this.name="geocent"},forward:function(t){return wu(t,this.es,this.a)},inverse:function(t){return bu(t,this.es,this.a,this.b)},names:["Geocentric","geocentric","geocent","Geocent"]};var id={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 nd={init:function(){if(Object.keys(id).forEach(function(t){if(void 0===this[t])this[t]=id[t].def;else{if(id[t].num&&isNaN(this[t]))throw new Error("Invalid parameter value, must be numeric "+t+" = "+this[t]);id[t].num&&(this[t]=parseFloat(this[t]))}id[t].degrees&&(this[t]=this[t]*uh)}.bind(this)),Math.abs(Math.abs(this.lat0)-lh)<hh?this.mode=this.lat0<0?1:0:Math.abs(this.lat0)<hh?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,n,r,s=Math.sin(t.y),o=Math.cos(t.y),a=Math.cos(t.x);switch(this.mode){case 3:i=this.sinph0*s+this.cosph0*o*a;break;case 2:i=o*a;break;case 1:i=-s;break;case 0:i=s}switch(e=(i=this.pn1/(this.p-i))*o*Math.sin(t.x),this.mode){case 3:i*=this.cosph0*s-this.sinph0*o*a;break;case 2:i*=s;break;case 0:i*=-o*a;break;case 1:i*=o*a}return r=1/((n=i*this.cg+e*this.sg)*this.sw*this.h1+this.cw),e=(e*this.cg-i*this.sg)*this.cw*r,i=n*r,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,n,r={x:t.x,y:t.y};n=1/(this.pn1-t.y*this.sw),e=this.pn1*t.x*n,i=this.pn1*t.y*this.cw*n,t.x=e*this.cg+i*this.sg,t.y=i*this.cg-e*this.sg;var s=rc(t.x,t.y);if(Math.abs(s)<hh)r.x=0,r.y=t.y;else{var o,a;switch(a=1-s*s*this.pfact,a=(this.p-Math.sqrt(a))/(this.pn1/s+s/this.pn1),o=Math.sqrt(1-a*a),this.mode){case 3:r.y=Math.asin(o*this.sinph0+t.y*a*this.cosph0/s),t.y=(o-this.sinph0*Math.sin(r.y))*s,t.x*=a*this.cosph0;break;case 2:r.y=Math.asin(t.y*a/s),t.y=o*s,t.x*=a;break;case 0:r.y=Math.asin(o),t.y=-t.y;break;case 1:r.y=-Math.asin(o)}r.x=Math.atan2(t.x,t.y)}return t.x=r.x+this.long0,t.y=r.y,t},names:["Tilted_Perspective","tpers"]},rd={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,n,r,s=t.x,o=t.y;if(s-=this.long0,"ellipse"===this.shape){o=Math.atan(this.radius_p2*Math.tan(o));var a=this.radius_p/rc(this.radius_p*Math.cos(o),Math.sin(o));if(i=a*Math.cos(s)*Math.cos(o),n=a*Math.sin(s)*Math.cos(o),r=a*Math.sin(o),(this.radius_g-i)*i-n*n-r*r*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(n/rc(r,e)),t.y=this.radius_g_1*Math.atan(r/e)):(t.x=this.radius_g_1*Math.atan(n/e),t.y=this.radius_g_1*Math.atan(r/rc(n,e)))}else"sphere"===this.shape&&(e=Math.cos(o),i=Math.cos(s)*e,n=Math.sin(s)*e,r=Math.sin(o),e=this.radius_g-i,this.flip_axis?(t.x=this.radius_g_1*Math.atan(n/rc(r,e)),t.y=this.radius_g_1*Math.atan(r/e)):(t.x=this.radius_g_1*Math.atan(n/e),t.y=this.radius_g_1*Math.atan(r/rc(n,e))));return t.x=t.x*this.a,t.y=t.y*this.a,t},inverse:function(t){var e,i,n,r,s=-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)*rc(1,a)):(o=Math.tan(t.x/this.radius_g_1),a=Math.tan(t.y/this.radius_g_1)*rc(1,o));var l=a/this.radius_p;if(e=o*o+l*l+s*s,(n=(i=2*this.radius_g*s)*i-4*e*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;r=(-i-Math.sqrt(n))/(2*e),s=this.radius_g+r*s,o*=r,a*=r,t.x=Math.atan2(o,s),t.y=Math.atan(a*Math.cos(t.x)/s),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+s*s,(n=(i=2*this.radius_g*s)*i-4*e*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;r=(-i-Math.sqrt(n))/(2*e),s=this.radius_g+r*s,o*=r,a*=r,t.x=Math.atan2(o,s),t.y=Math.atan(a*Math.cos(t.x)/s)}return t.x=t.x+this.long0,t},names:["Geostationary Satellite View","Geostationary_Satellite","geos"]};var sd=1.340264,od=-.081106,ad=893e-6,ld=.003796,hd=Math.sqrt(3)/2;const ud={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=Vh(t.x-this.long0,this.over),i=t.y,n=Math.asin(hd*Math.sin(i)),r=n*n,s=r*r*r;return t.x=e*Math.cos(n)/(hd*(sd+3*od*r+s*(7*ad+9*ld*r))),t.y=n*(sd+od*r+s*(ad+ld*r)),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,n,r,s=t.y;for(r=0;r<12&&(s-=n=(s*(sd+od*(e=s*s)+(i=e*e*e)*(ad+ld*e))-t.y)/(sd+3*od*e+i*(7*ad+9*ld*e)),!(Math.abs(n)<1e-9));++r);return i=(e=s*s)*e*e,t.x=hd*t.x*(sd+3*od*e+i*(7*ad+9*ld*e))/Math.cos(s),t.y=Math.asin(Math.sin(s)/hd),t.x=Vh(t.x+this.long0,this.over),t},names:["eqearth","Equal Earth","Equal_Earth"]};var cd=1e-10;function dd(t){var e,i,n,r=Vh(t.x-(this.long0||0),this.over),s=t.y;return e=this.am1+this.m1-tc(s,i=Math.sin(s),n=Math.cos(s),this.en),i=n*r/(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 fd(t){var e,i,n,r;if(t.x=(t.x-(this.x0||0))/this.a,t.y=(t.y-(this.y0||0))/this.a,i=rc(t.x,t.y=this.am1-t.y),r=ec(this.am1+this.m1-i,this.es,this.en),(e=Math.abs(r))<lh)e=Math.sin(r),n=i*Math.atan2(t.x,t.y)*Math.sqrt(1-this.es*e*e)/Math.cos(r);else{if(!(Math.abs(e-lh)<=cd))throw new Error;n=0}return t.x=Vh(n+(this.long0||0),this.over),t.y=Ec(r),t}function pd(t){var e,i,n=Vh(t.x-(this.long0||0),this.over),r=t.y;return i=this.cphi1+this.phi1-r,Math.abs(i)>cd?(t.x=i*Math.sin(e=n*Math.cos(r)/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 gd(t){var e,i;t.x=(t.x-(this.x0||0))/this.a,t.y=(t.y-(this.y0||0))/this.a;var n=rc(t.x,t.y=this.cphi1-t.y);if(i=this.cphi1+this.phi1-n,Math.abs(i)>lh)throw new Error;return e=Math.abs(Math.abs(i)-lh)<=cd?0:n*Math.atan2(t.x,t.y)/Math.cos(i),t.x=Vh(e+(this.long0||0),this.over),t.y=Ec(i),t}const md={init:function(){var t;if(this.phi1=this.lat1,Math.abs(this.phi1)<cd)throw new Error;this.es?(this.en=Qu(this.es),this.m1=tc(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=fd,this.forward=dd):(Math.abs(this.phi1)+cd>=lh?this.cphi1=0:this.cphi1=1/Math.tan(this.phi1),this.inverse=gd,this.forward=pd)},names:["bonne","Bonne (Werner lat_1=90)"]},yd={OBLIQUE:{forward:function(t,e){let{x:i,y:n}=e;i+=t.long0;const r=Math.cos(i),s=Math.sin(n),o=Math.cos(n);e.x=Vh(Math.atan2(o*Math.sin(i),t.sphip*o*r+t.cphip*s)+t.lamp),e.y=Math.asin(t.sphip*s-t.cphip*o*r);const a=t.obliqueProjection.forward(e);return t.isIdentity&&(a.x*=ch,a.y*=ch),a},inverse:function(t,e){t.isIdentity&&(e.x*=uh,e.y*=uh);const i=t.obliqueProjection.inverse(e);let{x:n,y:r}=i;if(n<Number.MAX_VALUE){n-=t.lamp;const i=Math.cos(n),s=Math.sin(r),o=Math.cos(r);e.x=Math.atan2(o*Math.sin(n),t.sphip*o*i-t.cphip*s),e.y=Math.asin(t.sphip*s+t.cphip*o*i)}return e.x=Vh(e.x+t.long0),e}},TRANSVERSE:{forward:function(t,e){let{x:i,y:n}=e;i+=t.long0;const r=Math.cos(n),s=Math.cos(i);e.x=Vh(Math.atan2(r*Math.sin(i),Math.sin(n))+t.lamp),e.y=Math.asin(-1*r*s);const o=t.obliqueProjection.forward(e);return t.isIdentity&&(o.x*=ch,o.y*=ch),o},inverse:function(t,e){t.isIdentity&&(e.x*=uh,e.y*=uh);const i=t.obliqueProjection.inverse(e);let{x:n,y:r}=i;if(n<Number.MAX_VALUE){const i=Math.cos(r);n-=t.lamp,e.x=Math.atan2(i*Math.sin(n),-1*Math.sin(r)),e.y=Math.asin(i*Math.cos(n))}return e.x=Vh(e.x+t.long0),e}}},_d={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"}},vd={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=Hh.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=xu(t);if(!e)throw new Error("Invalid parameter: o_proj. Unknown projection "+this.o_proj);let i;e.long0=0,this.obliqueProjection=e;const n=Object.keys(_d),r=t=>{if(void 0===this[t])return;const e=parseFloat(this[t])*uh;if(isNaN(e))throw new Error("Invalid value for "+t+": "+this[t]);return e};for(let t=0;t<n.length;t++){const e=n[t],s=_d[e],o=Object.entries(s);if(o.some(([t])=>void 0!==this[t])){i=s;for(let t=0;t<o.length;t++){const[e,i]=o[t],n=r(e);if(void 0===n)throw new Error("Missing parameter: "+e+".");this[i]=n}break}}if(!i)throw new Error("No valid parameters provided for ob_tran projection.");const{lamp:s,phip:o}=function(t,e){let i,n;if(e===_d.ROTATE){let e=t.oLongC,r=t.oLatC,s=t.oAlpha;if(Math.abs(Math.abs(r)-lh)<=hh)throw new Error("Invalid value for o_lat_c: "+t.o_lat_c+" should be < 90°");n=e+Math.atan2(-1*Math.cos(s),-1*Math.sin(s)*Math.sin(r)),i=Math.asin(Math.cos(r)*Math.sin(s))}else if(e===_d.NEW_POLE)n=t.oLongP,i=t.oLatP;else{let e=t.oLong1,r=t.oLat1,s=t.oLong2,o=t.oLat2,a=Math.abs(r);if(Math.abs(r)>lh-hh)throw new Error("Invalid value for o_lat_1: "+t.o_lat_1+" should be < 90°");if(Math.abs(o)>lh-hh)throw new Error("Invalid value for o_lat_2: "+t.o_lat_2+" should be < 90°");if(Math.abs(r-o)<hh)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<hh)throw new Error("Invalid value for o_lat_1: o_lat_1 should be different from zero");n=Math.atan2(Math.cos(r)*Math.sin(o)*Math.cos(e)-Math.sin(r)*Math.cos(o)*Math.cos(s),Math.sin(r)*Math.cos(o)*Math.sin(s)-Math.cos(r)*Math.sin(o)*Math.sin(e)),i=Math.atan(-1*Math.cos(n-e)/Math.tan(r))}return{lamp:n,phip:i}}(this,i);this.lamp=s,Math.abs(o)>hh?(this.cphip=Math.cos(o),this.sphip=Math.sin(o),this.projectionType=yd.OBLIQUE):this.projectionType=yd.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"]},xd=Object.assign(function(t,e,i){var n,r,s,o=!1;return void 0===e?(r=Gu(t),n=ku,o=!0):(void 0!==e.x||Array.isArray(e))&&(i=e,r=Gu(t),n=ku,o=!0),n||(n=Gu(t)),r||(r=Gu(e)),i?Au(n,r,i):(s={forward:function(t,e){return Au(n,r,t,e)},inverse:function(t,e){return Au(r,n,t,e)}},o&&(s.oProj=r),s)},{defaultDatum:"WGS84",Proj:xu,WGS84:new xu("WGS84"),Point:Yu,toPoint:Iu,defs:$h,nadgrid:function(t,e,i){return e instanceof ArrayBuffer?function(t,e,i){var n=!0;void 0!==i&&!1===i.includeErrorFields&&(n=!1);var r=new DataView(e),s=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)}(r),o=function(t,e){return{nFields:t.getInt32(8,e),nSubgridFields:t.getInt32(24,e),nSubgrids:t.getInt32(40,e),shiftType:gu(t,56,64).trim(),fromSemiMajorAxis:t.getFloat64(120,e),fromSemiMinorAxis:t.getFloat64(136,e),toSemiMajorAxis:t.getFloat64(152,e),toSemiMinorAxis:t.getFloat64(168,e)}}(r,s),a=function(t,e,i,n){for(var r=176,s=[],o=0;o<e.nSubgrids;o++){var a=yu(t,r,i),l=_u(t,r,a,i,n),h=Math.round(1+(a.upperLongitude-a.lowerLongitude)/a.longitudeInterval),u=Math.round(1+(a.upperLatitude-a.lowerLatitude)/a.latitudeInterval);s.push({ll:[pu(a.lowerLongitude),pu(a.lowerLatitude)],del:[pu(a.longitudeInterval),pu(a.latitudeInterval)],lim:[h,u],count:a.gridNodeCount,cvs:mu(l)});var c=16;!1===n&&(c=8),r+=176+a.gridNodeCount*c}return s}(r,o,s,n),l={header:o,subgrids:a};return uu[t]=l,l}(t,e,i):{ready:cu(t,e)}},transform:Ru,mgrs:Du,version:"__VERSION__"});var wd;(wd=xd).Proj.projections.add(ic),wd.Proj.projections.add(ac),wd.Proj.projections.add(lc),wd.Proj.projections.add(cc),wd.Proj.projections.add(fc),wd.Proj.projections.add(pc),wd.Proj.projections.add(mc),wd.Proj.projections.add(yc),wd.Proj.projections.add(_c),wd.Proj.projections.add(Pc),wd.Proj.projections.add(Tc),wd.Proj.projections.add(kc),wd.Proj.projections.add(Ac),wd.Proj.projections.add(Gc),wd.Proj.projections.add(Oc),wd.Proj.projections.add(Fc),wd.Proj.projections.add(Lc),wd.Proj.projections.add(jc),wd.Proj.projections.add(Nc),wd.Proj.projections.add(Dc),wd.Proj.projections.add(zc),wd.Proj.projections.add(qc),wd.Proj.projections.add($c),wd.Proj.projections.add(Bc),wd.Proj.projections.add(Xc),wd.Proj.projections.add(td),wd.Proj.projections.add(ed),wd.Proj.projections.add(nd),wd.Proj.projections.add(rd),wd.Proj.projections.add(ud),wd.Proj.projections.add(md),wd.Proj.projections.add(vd);const bd=xd;let Sd=null;var Md=[896,448,224,112,56,28,14,7,3.5,1.75,.875,.4375,.21875,.109375],Ed=[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],Cd=[-238375,1376256],Pd=300,Id=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom"];function Td(t){return"world"===t?{resolutions:Ed,defaultMinZoom:6,maxZoom:20}:{resolutions:Md,defaultMinZoom:0,maxZoom:Md.length-1}}var Rd=function(t,e){var i=null,n=function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];clearTimeout(i),i=setTimeout(function(){t.apply(void 0,r)},e)};return n.cancel=function(){i&&(clearTimeout(i),i=null)},n};function kd(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Ad(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)?Ad(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ad(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function Gd(t){var e=t.map,i=t.source,n=t.events,r=t.eventBus,s=t.getZoom,o=t.getCenter,a=t.getBounds,l=t.getResolution,h=!1,u=[],c=[],d=[],f=e.getView(),p=function(t){var e=function(){if(h)return null;var t=s();return{center:o(),bounds:a(),resolution:l(),zoom:t,isAtMaxZoom:t+.01>=f.getMaxZoom(),isAtMinZoom:t-.01<=f.getMinZoom()}}();e&&r.emit(t,e)},g=function(t,e,i){t.on(e,i),u.push([t,e,i])},m=function(t,e,i){t.on(e,i),c.push([t,e,i])},y=!1,_=function(){y||(y=!0,r.emit(n.MAP_LOADED))},v=Rd(function(){return p(n.MAP_DATA_CHANGE)},500);d.push(v);var x=function(t){h||(c.forEach(function(t){var e=kd(t,3),i=e[0],n=e[1],r=e[2];return i.un(n,r)}),c=[],m(t,"tileloadend",_),m(t,"tileloadend",v))};return function(t){var e=t.map,i=t.view,n=t.emit,r=t.eventBus,s=t.events,o=t.on,a=t.debouncers,l=!1,h=Rd(function(){l=!1,n(s.MAP_MOVE_END)},500);a.push(h);var u,c,d=(u=function(){return n(s.MAP_MOVE)},c=0,function(){var t=Date.now();t-c>=10&&(c=t,u.apply(void 0,arguments))});o(i,"change",function(){l||(l=!0,r.emit(s.MAP_MOVE_START)),h()}),o(e,"postrender",function(){l&&d()})}({map:e,view:e.getView(),emit:p,eventBus:r,events:n,on:g,debouncers:d}),x(i),e.once("rendercomplete",function(){return p(n.MAP_FIRST_IDLE)}),function(t){var e=t.map,i=t.eventBus,n=t.events,r=t.on,s=null;r(e,"pointerdown",function(t){s=t.pixel}),r(e,"click",function(t){if(s){var e=t.pixel[0]-s[0],r=t.pixel[1]-s[1];if(Math.hypot(e,r)>6)return}i.emit(n.MAP_CLICK,{point:{x:t.pixel[0],y:t.pixel[1]},coords:t.coordinate})})}({map:e,eventBus:r,events:n,on:g}),g(e,"postrender",function(){return r.emit(n.MAP_RENDER)}),{setSource:x,remove:function(){h=!0,d.forEach(function(t){return t.cancel()}),u.forEach(function(t){var e=kd(t,3),i=e[0],n=e[1],r=e[2];return i.un(n,r)}),c.forEach(function(t){var e=kd(t,3),i=e[0],n=e[1],r=e[2];return i.un(n,r)})}}}class Od{constructor(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function Fd(t,e,i,n,r){return void 0!==r?(r.minX=t,r.maxX=e,r.minY=i,r.maxY=n,r):new Od(t,e,i,n)}const Ld=Od;function jd(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function Nd(t,e,i,n,r){return`${z(t)},${e},${function(t,e,i){return t+"/"+e+"/"+i}(i,n,r)}`}function Dd(t){return e=t[0],(t[1]<<e)+t[2];var e}const zd=[0,0,0],qd=class{constructor(t){let e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,ct(function(t){const e=((t,e)=>e-t)||S;return t.every(function(i,n){if(0===n)return!0;const r=e(t[n-1],i);return!(r>0||0===r)})}(this.resolutions_),"`resolutions` must be sorted in descending order"),!t.origins)for(let t=0,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,ct(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_=ne(i)),ct(!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,ct(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,ct(!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 n=new Ld(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);n.minX=Math.max(t.minX,n.minX),n.maxX=Math.min(t.maxX,n.maxX),n.minY=Math.max(t.minY,n.minY),n.maxY=Math.min(t.maxY,n.maxY)}return n}):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const n=this.getTileRangeForExtentAndZ(t,e);for(let t=n.minX,r=n.maxX;t<=r;++t)for(let r=n.minY,s=n.maxY;r<=s;++r)i([e,t,r])}forEachTileCoordParentTileRange(t,e,i,n){let r,s,o,a=null,l=t[0]-1;for(2===this.zoomFactor_?(s=t[1],o=t[2]):a=this.getTileCoordExtent(t,n);l>=this.minZoom;){if(void 0!==s&&void 0!==o?(s=Math.floor(s/2),o=Math.floor(o/2),r=Fd(s,s,o,o,i)):r=this.getTileRangeForExtentAndZ(a,l,i),e(l,r))return!0;--l}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getOrigins(){return this.origins_}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(2===this.zoomFactor_){const i=2*t[1],n=2*t[2];return Fd(i,i+1,n,n+1,e)}const n=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(n,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const n=t[0],r=t[1],s=t[2];if(e===n)return Fd(r,s,r,s,i);if(this.zoomFactor_){const t=Math.pow(this.zoomFactor_,e-n),o=Math.floor(r*t),a=Math.floor(s*t);return e<n?Fd(o,o,a,a,i):Fd(o,Math.floor(t*(r+1))-1,a,Math.floor(t*(s+1))-1,i)}const o=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(o,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,zd);const n=zd[1],r=zd[2];return this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,zd),Fd(n,zd[1],r,zd[2],i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),n=ao(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*n[0]*i,e[1]-(t[2]+.5)*n[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),n=this.getResolution(t[0]),r=ao(this.getTileSize(t[0]),this.tmpSize_),s=i[0]+t[1]*r[0]*n,o=i[1]-(t[2]+1)*r[1]*n;return Nt(s,o,s+r[0]*n,o+r[1]*n,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,n,r){const s=this.getZForResolution(i),o=i/this.getResolution(s),a=this.getOrigin(s),l=ao(this.getTileSize(s),this.tmpSize_);let h=o*(t-a[0])/i/l[0],u=o*(a[1]-e)/i/l[1];return n?(h=Ct(h,5)-1,u=Ct(u,5)-1):(h=Et(h,5),u=Et(u,5)),jd(s,h,u,r)}getTileCoordForXYAndZ_(t,e,i,n,r){const s=this.getOrigin(i),o=this.getResolution(i),a=ao(this.getTileSize(i),this.tmpSize_);let l=(t-s[0])/o/a[0],h=(s[1]-e)/o/a[1];return n?(l=Ct(l,5)-1,h=Ct(h,5)-1):(l=Et(l,5),h=Et(h,5)),jd(i,l,h,r)}getTileCoordForCoordAndZ(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){return mt(E(this.resolutions_,t,e||0),this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return Fn(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,i=new Array(e);for(let n=this.minZoom;n<e;++n)i[n]=this.getTileRangeForExtentAndZ(t,n);this.fullTileRanges_=i}};function $d(t){let e=t.getDefaultTileGrid();return e||(e=function(t){return function(t,e,i,n){n=void 0!==n?n:"top-left";const r=Ud(t,e,i);return new qd({extent:t,origin:Jt(t,n),resolutions:r,tileSize:i})}(Wd(t),void 0,void 0,void 0)}(t),t.setDefaultTileGrid(e)),e}function Bd(t){const e=t||{},i=e.extent||_i("EPSG:3857").getExtent(),n={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:Ud(i,e.maxZoom,e.tileSize,e.maxResolution)};return new qd(n)}function Ud(t,e,i,n){e=void 0!==e?e:42,i=ao(void 0!==i?i:256);const r=ee(t),s=se(t);n=n>0?n:Math.max(s/i[0],r/i[1]);const o=e+1,a=new Array(o);for(let t=0;t<o;++t)a[t]=n/Math.pow(2,t);return a}function Wd(t){let e=(t=_i(t)).getExtent();if(!e){const i=180*Se.degrees/t.getMetersPerUnit();e=Nt(-i,-i,i,i)}return e}const Xd=class extends F{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(g)}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(){N()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;const n=e-i+1e3/60;return n>=this.transition_?1:pe(n/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}},Vd=class extends Xd{constructor(t,e,i,n,r,s){super(t,e,s),this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.src_=i,this.key=i,this.image_,Q?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=2,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=3,this.unlistenImage_(),this.image_=function(){const t=ur(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}handleImageLoad_(){if(Q)this.state=2;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=2:this.state=4}this.unlistenImage_(),this.changed()}load(){3==this.state&&(this.state=0,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),0==this.state&&(this.state=1,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=function(t,e,i){const n=t;let r=!0,s=!1,o=!1;const a=[f(n,"load",function(){o=!0,s||e()})];return n.src&&tt?(s=!0,n.decode().then(function(){r&&e()}).catch(function(t){r&&(o?e():i())})):a.push(f(n,"error",i)),function(){r=!1,a.forEach(p)}}(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}};let Kd;const Yd=[];function Zd(t,e,i,n,r){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(n,r),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(i,r)),t.restore()}function Hd(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function Jd(t,e,i,n){const r=Ii(i,e,t);let s=vi(e,n,i);const o=e.getMetersPerUnit();void 0!==o&&(s*=o);const a=t.getMetersPerUnit();void 0!==a&&(s/=a);const l=t.getExtent();if(!l||Ot(l,r)){const e=vi(t,s,r)/s;isFinite(e)&&e>0&&(s/=e)}return s}const Qd=class{constructor(t,e,i,n,r,s,o){this.sourceProj_=t,this.targetProj_=e;let a={};const l=o?bi(t=>Wi(o,Ii(t,this.targetProj_,this.sourceProj_))):Pi(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){const e=t[0]+"/"+t[1];return a[e]||(a[e]=l(t)),a[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&se(n)>=se(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?se(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?se(this.targetProj_.getExtent()):null;const h=ne(i),u=re(i),c=Zt(i),d=Yt(i),f=this.transformInv_(h),p=this.transformInv_(u),g=this.transformInv_(c),m=this.transformInv_(d),y=10+(s?Math.max(0,Math.ceil(Math.log2(Kt(i)/(s*s*256*256)))):0);if(this.addQuad_(h,u,c,d,f,p,g,m,y),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach(function(e,i,n){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])}),this.triangles_.forEach(e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const i=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];i[0][0]-t>this.sourceWorldWidth_/2&&(i[0][0]-=this.sourceWorldWidth_),i[1][0]-t>this.sourceWorldWidth_/2&&(i[1][0]-=this.sourceWorldWidth_),i[2][0]-t>this.sourceWorldWidth_/2&&(i[2][0]-=this.sourceWorldWidth_);const n=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-n<this.sourceWorldWidth_/2&&(e.source=i)}})}a={}}addTriangle_(t,e,i,n,r,s){this.triangles_.push({source:[n,r,s],target:[t,e,i]})}addQuad_(t,e,i,n,r,s,o,a,l){const h=Rt([r,s,o,a]),u=this.sourceWorldWidth_?se(h)/this.sourceWorldWidth_:null,c=this.sourceWorldWidth_,d=this.sourceProj_.canWrapX()&&u>.5&&u<1;let f=!1;if(l>0&&(this.targetProj_.isGlobal()&&this.targetWorldWidth_&&(f=se(Rt([t,e,i,n]))/this.targetWorldWidth_>.25||f),!d&&this.sourceProj_.isGlobal()&&u&&(f=u>.25||f)),!f&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!oe(h,this.maxSourceExtent_))return;let p=0;if(!(f||isFinite(r[0])&&isFinite(r[1])&&isFinite(s[0])&&isFinite(s[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)f=!0;else if(p=(isFinite(r[0])&&isFinite(r[1])?0:8)+(isFinite(s[0])&&isFinite(s[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=p&&2!=p&&4!=p&&8!=p)return;if(l>0){if(!f){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],n=this.transformInv_(e);let s;s=d?(wt(r[0],c)+wt(o[0],c))/2-wt(n[0],c):(r[0]+o[0])/2-n[0];const a=(r[1]+o[1])/2-n[1];f=s*s+a*a>this.errorThresholdSquared_}if(f){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const h=[(e[0]+i[0])/2,(e[1]+i[1])/2],u=this.transformInv_(h),c=[(n[0]+t[0])/2,(n[1]+t[1])/2],d=this.transformInv_(c);this.addQuad_(t,e,h,c,r,s,u,d,l-1),this.addQuad_(c,h,i,n,d,u,o,a,l-1)}else{const h=[(t[0]+e[0])/2,(t[1]+e[1])/2],u=this.transformInv_(h),c=[(i[0]+n[0])/2,(i[1]+n[1])/2],d=this.transformInv_(c);this.addQuad_(t,h,c,n,r,u,d,a,l-1),this.addQuad_(h,e,i,c,u,s,o,d,l-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}11&p||this.addTriangle_(t,i,n,r,o,a),14&p||this.addTriangle_(t,i,e,r,o,s),p&&(13&p||this.addTriangle_(e,n,t,s,a,r),7&p||this.addTriangle_(e,n,i,s,a,o))}calculateSourceExtent(){const t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach(function(e,i,n){const r=e.source;Ut(t,r[0]),Ut(t,r[1]),Ut(t,r[2])}),t}getTriangles(){return this.triangles_}},tf=class extends Xd{constructor(t,e,i,n,r,s,o,a,l,h,u,c){super(r,0,c),this.renderEdges_=void 0!==u&&u,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=n,this.wrappedTileCoord_=s||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const d=n.getTileCoordExtent(this.wrappedTileCoord_),f=this.targetTileGrid_.getExtent();let p=this.sourceTileGrid_.getExtent();const g=f?ie(d,f):d;if(0===Kt(g))return void(this.state=4);const m=t.getExtent();m&&(p=p?ie(p,m):m);const y=n.getResolution(this.wrappedTileCoord_[0]),_=function(t,e,i,n){const r=Ht(i);let s=Jd(t,e,r,n);return(!isFinite(s)||s<=0)&&Vt(i,function(i){return s=Jd(t,e,i,n),isFinite(s)&&s>0}),s}(t,i,g,y);if(!isFinite(_)||_<=0)return void(this.state=4);const v=void 0!==h?h:.5;if(this.triangulation_=new Qd(t,i,g,p,_*v,y),0===this.triangulation_.getTriangles().length)return void(this.state=4);this.sourceZ_=e.getZForResolution(_);let x=this.triangulation_.calculateSourceExtent();if(p&&(t.canWrapX()?(x[1]=mt(x[1],p[1],p[3]),x[3]=mt(x[3],p[1],p[3])):x=ie(x,p)),Kt(x)){let i=0,n=0;t.canWrapX()&&(i=se(m),n=Math.floor((x[0]-m[0])/i)),he(x.slice(),t,!0).forEach(t=>{const r=e.getTileRangeForExtentAndZ(t,this.sourceZ_);for(let t=r.minX;t<=r.maxX;t++)for(let e=r.minY;e<=r.maxY;e++){const r=n*i;this.sourceTiles_.push({getTile:()=>l(this.sourceZ_,t,e,o),offset:r})}++n}),0===this.sourceTiles_.length&&(this.state=4)}else this.state=4}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{const i=e.tile;if(i&&2==i.getState()){const n=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);n[0]+=e.offset,n[2]+=e.offset;const r=this.clipExtent_?.slice();r&&(r[0]+=e.offset,r[2]+=e.offset),t.push({extent:n,clipExtent:r,image:i.getImage()})}}),this.sourceTiles_.length=0,0===t.length)this.state=3;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],r="number"==typeof i?i:i[1],s=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=function(t,e,i,n,r,s,o,a,l,h,u,c,d,f){const p=ur(Math.round(i*t),Math.round(i*e),Yd);if(c||(p.imageSmoothingEnabled=!1),0===l.length)return p.canvas;function g(t){return Math.round(t*i)/i}p.scale(i,i),p.globalCompositeOperation="lighter";const m=[1/0,1/0,-1/0,-1/0];let y;l.forEach(function(t,e,i){Bt(m,t.extent)});const _=i/n,v=(c?1:1+Math.pow(2,-24))/_;if(!d||1!==l.length||0!==h){if(y=ur(Math.round(se(m)*_),Math.round(ee(m)*_),Yd),c||(y.imageSmoothingEnabled=!1),r&&f){const t=(r[0]-m[0])*_,e=-(r[3]-m[3])*_,i=se(r)*_,n=ee(r)*_;y.rect(t,e,i,n),y.clip()}l.forEach(function(t,e,i){if(t.image.width>0&&t.image.height>0){if(t.clipExtent){y.save();const e=(t.clipExtent[0]-m[0])*_,i=-(t.clipExtent[3]-m[3])*_,n=se(t.clipExtent)*_,r=ee(t.clipExtent)*_;y.rect(c?e:Math.round(e),c?i:Math.round(i),c?n:Math.round(e+n)-Math.round(e),c?r:Math.round(i+r)-Math.round(i)),y.clip()}const e=(t.extent[0]-m[0])*_,i=-(t.extent[3]-m[3])*_,n=se(t.extent)*_,r=ee(t.extent)*_;y.drawImage(t.image,h,h,t.image.width-2*h,t.image.height-2*h,c?e:Math.round(e),c?i:Math.round(i),c?n:Math.round(e+n)-Math.round(e),c?r:Math.round(i+r)-Math.round(i)),t.clipExtent&&y.restore()}})}const x=ne(o);return a.getTriangles().forEach(function(t,e,i){const n=t.source,r=t.target;let o=n[0][0],a=n[0][1],h=n[1][0],u=n[1][1],d=n[2][0],f=n[2][1];const _=g((r[0][0]-x[0])/s),w=g(-(r[0][1]-x[1])/s),b=g((r[1][0]-x[0])/s),S=g(-(r[1][1]-x[1])/s),M=g((r[2][0]-x[0])/s),E=g(-(r[2][1]-x[1])/s),C=o,P=a;o=0,a=0,h-=C,u-=P,d-=C,f-=P;const I=function(t){const e=t.length;for(let i=0;i<e;i++){let n=i,r=Math.abs(t[i][i]);for(let s=i+1;s<e;s++){const e=Math.abs(t[s][i]);e>r&&(r=e,n=s)}if(0===r)return null;const s=t[n];t[n]=t[i],t[i]=s;for(let n=i+1;n<e;n++){const r=-t[n][i]/t[i][i];for(let s=i;s<e+1;s++)i==s?t[n][s]=0:t[n][s]+=r*t[i][s]}}const i=new Array(e);for(let n=e-1;n>=0;n--){i[n]=t[n][e]/t[n][n];for(let r=n-1;r>=0;r--)t[r][e]-=t[r][n]*i[n]}return i}([[h,u,0,0,b-_],[d,f,0,0,M-_],[0,0,h,u,S-w],[0,0,d,f,E-w]]);if(!I)return;if(p.save(),p.beginPath(),function(){if(void 0===Kd){const t=ur(6,6,Yd);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",Zd(t,4,5,4,0),Zd(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;Kd=Hd(e,0)||Hd(e,4)||Hd(e,8),fr(t),Yd.push(t.canvas)}return Kd}()||!c){p.moveTo(b,S);const t=4,e=_-b,i=w-S;for(let n=0;n<t;n++)p.lineTo(b+g((n+1)*e/t),S+g(n*i/(t-1))),n!=t-1&&p.lineTo(b+g((n+1)*e/t),S+g((n+1)*i/(t-1)));p.lineTo(M,E)}else p.moveTo(b,S),p.lineTo(_,w),p.lineTo(M,E);let T;if(p.clip(),p.transform(I[0],I[2],I[1],I[3],_,w),p.translate(m[0]-C,m[3]-P),y)T=y.canvas,p.scale(v,-v);else{const t=l[0],e=t.extent;T=t.image,p.scale(se(e)/T.width,-ee(e)/T.height)}p.drawImage(T,0,0),p.restore()}),y&&(fr(y),Yd.push(y.canvas)),u&&(p.save(),p.globalCompositeOperation="source-over",p.strokeStyle="black",p.lineWidth=1,a.getTriangles().forEach(function(t,e,i){const n=t.target,r=(n[0][0]-x[0])/s,o=-(n[0][1]-x[1])/s,a=(n[1][0]-x[0])/s,l=-(n[1][1]-x[1])/s,h=(n[2][0]-x[0])/s,u=-(n[2][1]-x[1])/s;p.beginPath(),p.moveTo(a,l),p.lineTo(r,o),p.lineTo(h,u),p.closePath(),p.stroke()}),p.restore()),p.canvas}(n,r,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),s,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=2}this.changed()}load(){for(const t of this.sourceTiles_)t.tile=t.getTile();if(0==this.state){this.state=1,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const i=e.getState();if(0==i||1==i){t++;const i=d(e,g,n=>{const r=e.getState();2!=r&&3!=r&&4!=r||(p(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(p),this.sourcesListenerKeys_=null}release(){this.canvas_&&(fr(this.canvas_.getContext("2d")),Yd.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}};function ef(t,e){const i=[];Object.keys(e).forEach(function(t){null!==e[t]&&void 0!==e[t]&&i.push(t+"="+encodeURIComponent(e[t]))});const n=i.join("&");return t=t.replace(/[?&]$/,""),(t+=t.includes("?")?"&":"?")+n}const nf=/\{z\}/g,rf=/\{x\}/g,sf=/\{y\}/g,of=/\{-y\}/g;function af(t,e){return function(i,n,r){if(!i)return;let s;const o=i[0];if(e){const t=e.getFullTileRange(o);t&&(s=t.getHeight()-1)}return function(t,e,i,n,r){return t.replace(nf,e.toString()).replace(rf,i.toString()).replace(sf,n.toString()).replace(of,function(){if(void 0===r)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(r-n).toString()})}(t,o,i[1],i[2],s)}}function lf(t){return t?"function"==typeof t?t:(Array.isArray(t)||(t=[t]),e=>t):null}const hf=class extends ${constructor(t){super(),this.projection=_i(t.projection),this.attributions_=lf(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_=lf(t),this.changed()}setState(t){this.state_=t,this.changed()}};class uf extends O{constructor(t,e){super(t),this.tile=e}}const cf=class extends hf{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&&ao(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),[256,256]),this.tmpSize=[0,0],this.key_=t.key||z(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,n,r,s){return N()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:$d(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const n=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),s=ao(n.getTileSize(t),this.tmpSize);return 1==r?s:(o=s,a=r,void 0===(l=this.tmpSize)&&(l=[0,0]),l[0]=o[0]*a+.5|0,l[1]=o[1]*a+.5|0,l);var o,a,l}getTileCoordForTileUrlFunction(t,e){const i=void 0!==e?e:this.getProjection(),n=void 0!==e?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=function(t,e,i){const n=e[0],r=t.getTileCoordCenter(e),s=Wd(i);if(!Ot(s,r)){const e=se(s),i=Math.ceil((s[0]-r[0])/e);return r[0]+=e*i,t.getTileCoordForCoordAndZ(r,n)}return e}(n,t,i)),function(t,e){const i=t[0],n=t[1],r=t[2];if(e.getMinZoom()>i||i>e.getMaxZoom())return!1;const s=e.getFullTileRange(i);return!s||s.containsXY(n,r)}(t,n)?t:null}clear(){}refresh(){this.clear(),super.refresh()}};class df extends cf{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===df.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=z(e),n=e.getState();let r;1==n?(this.tileLoadingKeys_[i]=!0,r="tileloadstart"):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=3==n?"tileloaderror":2==n?"tileloadend":void 0),null!=r&&this.dispatchEvent(new uf(r,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,void 0!==e?this.setKey(e):this.changed()}setUrl(t){const e=function(t){const e=[];let i=/\{([a-z])-([a-z])\}/.exec(t);if(i){const n=i[1].charCodeAt(0),r=i[2].charCodeAt(0);let s;for(s=n;s<=r;++s)e.push(t.replace(i[0],String.fromCharCode(s)));return e}if(i=/\{(\d+)-(\d+)\}/.exec(t),i){const n=parseInt(i[2],10);for(let r=parseInt(i[1],10);r<=n;r++)e.push(t.replace(i[0],r.toString()));return e}return e.push(t),e}(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(function(t,e){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=af(t[r],e);return function(t){return 1===t.length?t[0]:function(e,i,n){if(!e)return;const r=wt(Dd(e),t.length);return t[r](e,i,n)}}(n)}(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}const ff=df;function pf(t,e){if(Q){const i=t.getCrossOrigin();let n="same-origin",r="same-origin";"anonymous"===i||""===i?(n="cors",r="omit"):"use-credentials"===i&&(n="cors",r="include");const s={mode:n,credentials:r,referrerPolicy:t.getReferrerPolicy()};return void fetch(e,s).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 gf=class extends ff{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:pf,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:Vd,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!Mi(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||Mi(e,t)))return this.tileGrid;const i=z(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=$d(t)),this.tileGridForProjection[i]}createTile_(t,e,i,n,r,s){const o=[t,e,i],a=this.getTileCoordForTileUrlFunction(o,r),l=a?this.tileUrlFunction(a,n,r):void 0,h=new this.tileClass(o,void 0!==l?0:4,void 0!==l?l:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return h.key=s,h.addEventListener(g,this.handleTileChange.bind(this)),h}getTile(t,e,i,n,r,s){const o=this.getProjection();if(!o||!r||Mi(o,r))return this.getTileInternal(t,e,i,n,o||r);const a=[t,e,i],l=this.getKey(),h=this.getTileGridForProjection(o),u=this.getTileGridForProjection(r),c=this.getTileCoordForTileUrlFunction(a,r),d=new tf(o,h,r,u,a,c,this.getTilePixelRatio(n),this.getGutter(),(t,e,i,n)=>this.getTileInternal(t,e,i,n,o,s),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return d.key=l,d}getTileInternal(t,e,i,n,r,s){const o=this.getKey(),a=Nd(this,o,t,e,i);if(s&&s.containsKey(a))return s.get(a);const l=this.createTile_(t,e,i,n,r,o);return s?.set(a,l),l}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const i=_i(t);if(i){const t=z(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}},mf=class extends gf{constructor(t){const e=void 0!==(t=t||{}).projection?t.projection:"EPSG:3857",i=void 0!==t.tileGrid?t.tileGrid:Bd({extent:Wd(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 yf(t,e){const i=(""+t).split("."),n=(""+e).split(".");for(let t=0;t<Math.max(i.length,n.length);t++){const e=parseInt(i[t]||"0",10),r=parseInt(n[t]||"0",10);if(e>r)return 1;if(r>e)return-1}return 0}const _f="1.3.0";function vf(t,e,i,n,r,s,o){s=Object.assign({REQUEST:"GetMap"},s);const a=e/i,l=[Mt(se(t)/a,4),Mt(ee(t)/a,4)];if(1!=i)switch(o){case"geoserver":const t=90*i+.5|0;"FORMAT_OPTIONS"in s?s.FORMAT_OPTIONS+=";dpi:"+t:s.FORMAT_OPTIONS="dpi:"+t;break;case"mapserver":s.MAP_RESOLUTION=90*i;break;case"carmentaserver":case"qgis":s.DPI=90*i;break;default:throw new Error("Unknown `serverType` configured")}return function(t,e,i,n,r){r.WIDTH=i[0],r.HEIGHT=i[1];const s=n.getAxisOrientation(),o=yf(r.VERSION,"1.3")>=0;r[o?"CRS":"SRS"]=n.getCode();const a=o&&s.startsWith("ne")?[e[1],e[0],e[3],e[2]]:e;return r.BBOX=a.join(","),ef(t,r)}(r,t,l,n,s)}function xf(t,e){return Object.assign({REQUEST:e,SERVICE:"WMS",VERSION:_f,FORMAT:"image/png",STYLES:"",TRANSPARENT:"TRUE"},t)}const wf=class extends gf{constructor(t){t=t||{};const e=Object.assign({},t.params);super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.gutter_=void 0!==t.gutter?t.gutter:0,this.params_=e,this.v13_=!0,this.serverType_=t.serverType,this.hidpi_=void 0===t.hidpi||t.hidpi,this.tmpExtent_=[1/0,1/0,-1/0,-1/0],this.updateV13_(),this.setKey(this.getKeyForParams_())}getFeatureInfoUrl(t,e,i,n){const r=_i(i),s=this.getProjection()||r;let o=this.getTileGrid();o||(o=this.getTileGridForProjection(s));const a=Ii(t,r,s),l=Jd(s,r,t,e),h=o.getZForResolution(l,this.zDirection),u=o.getResolution(h),c=o.getTileCoordForCoordAndZ(a,h);if(o.getResolutions().length<=c[0])return;let d=o.getTileCoordExtent(c,this.tmpExtent_);const f=this.gutter_;0!==f&&(d=kt(d,u*f,d));const p={QUERY_LAYERS:this.params_.LAYERS};Object.assign(p,xf(this.params_,"GetFeatureInfo"),n);const g=Math.floor((a[0]-d[0])/u),m=Math.floor((d[3]-a[1])/u);return p[this.v13_?"I":"X"]=g,p[this.v13_?"J":"Y"]=m,this.getRequestUrl_(c,d,1,s||r,p)}getLegendUrl(t,e){if(void 0===this.urls[0])return;const i={SERVICE:"WMS",VERSION:_f,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){const t=this.params_.LAYERS;if(Array.isArray(t)&&1!==t.length)return;i.LAYER=t}if(void 0!==t){const e=this.getProjection()?this.getProjection().getMetersPerUnit():1,n=28e-5;i.SCALE=t*e/n}return Object.assign(i,e),ef(this.urls[0],i)}getGutter(){return this.gutter_}getParams(){return this.params_}getRequestUrl_(t,e,i,n,r){const s=this.urls;if(!s)return;let o;return o=1==s.length?s[0]:s[wt(Dd(t),s.length)],vf(e,(this.tileGrid||this.getTileGridForProjection(n)).getResolution(t[0]),i,n,o,r,this.serverType_)}getTilePixelRatio(t){return this.hidpi_&&void 0!==this.serverType_?t:1}getKeyForParams_(){let t=0;const e=[];for(const i in this.params_)e[t++]=i+"-"+this.params_[i];return e.join("/")}setParams_(t){this.params_=t,this.updateV13_(),this.setKey(this.getKeyForParams_())}setParams(t){this.setParams_(Object.assign({},t))}updateParams(t){this.setParams_(Object.assign(this.params_,t))}updateV13_(){const t=this.params_.VERSION||_f;this.v13_=yf(t,"1.3")>=0}tileUrlFunction(t,e,i){let n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(i)),n.getResolutions().length<=t[0])return;1==e||this.hidpi_&&void 0!==this.serverType_||(e=1);const r=n.getResolution(t[0]);let s=n.getTileCoordExtent(t,this.tmpExtent_);const o=this.gutter_;0!==o&&(s=kt(s,r*o,s));const a=Object.assign({},xf(this.params_,"GetMap"));return this.getRequestUrl_(t,s,e,i,a)}},bf=[],Sf=class extends Xd{constructor(t,e,i,n,r){super(t,e,{transition:0}),this.context_=null,this.executorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=n.bind(void 0,this),this.removeSourceTiles_=r,this.wrappedTileCoord=i}getContext(){return this.context_||(this.context_=ur(1,1,bf)),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(t){const e=z(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedPixelRatio:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[e]}load(){this.getSourceTiles()}release(){this.context_&&(fr(this.context_),bf.push(this.context_.canvas),this.context_=null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}},Mf=class extends Xd{constructor(t,e,i,n,r,s){super(t,e,s),this.extent=null,this.format_=n,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=r,this.url_=i,this.key=i}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){0==this.state&&(this.setState(1),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(t,e){this.setFeatures(t)}onError(){this.setState(3)}setFeatures(t){this.features_=t,this.setState(2)}setLoader(t){this.loader_=t}};function Ef(t,e,i,n,r,s,o){const a=new XMLHttpRequest;a.open("GET","function"==typeof t?t(i,n,r):t,!0),"arraybuffer"==e.getType()&&(a.responseType="arraybuffer"),a.withCredentials=false,a.onload=function(t){if(!a.status||a.status>=200&&a.status<300){const t=e.getType();try{let n;"text"==t||"json"==t?n=a.responseText:"xml"==t?n=a.responseXML||a.responseText:"arraybuffer"==t&&(n=a.response),n?s(e.readFeatures(n,{extent:i,featureProjection:r}),e.readProjection(n)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function Cf(t,e){return function(i,n,r,s,o){Ef(t,e,i,n,r,(t,e)=>{this.addFeatures(t),void 0!==s&&s(t)},()=>{this.changed(),void 0!==o&&o()})}}const Pf=class extends ff{constructor(t){const e=t.projection||"EPSG:3857",i=t.extent||Wd(e),n=t.tileGrid||Bd({extent:i,maxResolution:t.maxResolution,maxZoom:void 0!==t.maxZoom?t.maxZoom:22,minZoom:t.minZoom,tileSize:t.tileSize||512});super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,interpolate:!0,projection:e,state:t.state,tileGrid:n,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:If,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:void 0===t.zDirection?1:t.zDirection}),this.format_=t.format?t.format:null,this.tileKeysBySourceTileUrl_={},this.sourceTiles_={},this.overlaps_=null==t.overlaps||t.overlaps,this.tileClass=t.tileClass?t.tileClass:Mf,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceTiles(t,e,i,n){if(0===i.getState()){i.setState(1);const r=i.wrappedTileCoord,s=this.getTileGridForProjection(e);let o=s.getTileCoordExtent(r);const a=r[0],l=s.getResolution(a);kt(o,-l,o);const h=this.projection;e&&this.projection&&!Mi(e,h)&&(o=Ti(o,e,h));const u=this.tileGrid,d=u.getExtent();d&&ie(o,d,o);let f=l;e&&h&&!Mi(e,h)&&(f=l/h.getMetersPerUnit()/e.getMetersPerUnit());const p=u.getZForResolution(f,this.zDirection),m=n||this.tileUrlFunction;u.forEachTileCoord(o,p,n=>{const r=m(n,t,e);this.sourceTiles_[r]||(this.sourceTiles_[r]=new this.tileClass(n,r?0:4,r,this.format_,this.tileLoadFunction));const s=this.sourceTiles_[r];i.sourceTiles.push(s),this.tileKeysBySourceTileUrl_[r]||(this.tileKeysBySourceTileUrl_[r]=[]),this.tileKeysBySourceTileUrl_[r].push(i.getKey());const o=s.getState();if(o<2){const t=e=>{this.handleTileChange(e);const n=s.getState();if(2===n||3===n){const e=s.getKey();e in i.errorTileKeys?2===s.getState()&&delete i.errorTileKeys[e]:i.loadingSourceTiles--,3===n?i.errorTileKeys[e]=!0:s.removeEventListener(g,t),0===i.loadingSourceTiles&&i.setState(c(i.errorTileKeys)?2:3)}};s.addEventListener(g,t),i.loadingSourceTiles++}0===o&&(s.extent=u.getTileCoordExtent(n),s.projection=this.projection,s.resolution=u.getResolution(n[0]),s.load())}),i.loadingSourceTiles||i.setState(i.sourceTiles.some(t=>3===t.getState())?3:2)}return i.sourceTiles}removeSourceTiles(t){const e=t.getKey(),i=t.sourceTiles;for(let t=0,n=i.length;t<n;++t){const n=i[t].getTileUrl();if(!this.tileKeysBySourceTileUrl_[n])return;const r=this.tileKeysBySourceTileUrl_[n].indexOf(e);-1!==r&&(this.tileKeysBySourceTileUrl_[n].splice(r,1),0===this.tileKeysBySourceTileUrl_[n].length&&(delete this.tileKeysBySourceTileUrl_[n],delete this.sourceTiles_[n]))}}getTile(t,e,i,n,r){const s=[t,e,i];let o=this.getTileCoordForTileUrlFunction(s,r);const a=this.getTileGrid().getExtent(),l=this.projection,h=this.getTileGridForProjection(r);if(o&&a){const e=h.getTileCoordExtent(o);kt(e,-h.getResolution(t),e),oe(a,r&&l&&!Mi(r,l)?Ti(e,r,l):e)||(o=null)}let u=!0;if(null!==o){const e=this.tileGrid,i=h.getResolution(t);let s=i;r&&l&&!Mi(r,l)&&(s=i/l.getMetersPerUnit()/r.getMetersPerUnit());const a=e.getZForResolution(s,1),c=h.getTileCoordExtent(o);kt(c,-i,c),e.forEachTileCoord(r&&l&&!Mi(r,l)?Ti(c,r,l):c,a,t=>{u=u&&!this.tileUrlFunction(t,n,l)})}const c=this.tileUrlFunction,d=new Sf(s,u?4:0,o,t=>this.getSourceTiles(n,r,t,c),this.removeSourceTiles.bind(this));return d.key=this.getKey(),d}getTileGridForProjection(t){const e=t.getCode();let i=this.tileGrids_[e];if(!i){const n=this.projection;if(null!==n&&!Mi(n,t))return $d(t);const r=this.tileGrid,s=r.getResolutions().slice(),o=s.map(function(t,e){return r.getOrigin(e)}),a=s.map(function(t,e){return r.getTileSize(e)}),l=43;for(let t=s.length;t<l;++t)s.push(s[t-1]/2),o.push(o[t-1]),a.push(a[t-1]);i=new qd({extent:r.getExtent(),origins:o,resolutions:s,tileSizes:a}),this.tileGrids_[e]=i}return i}getTilePixelRatio(t){return t}getTilePixelSize(t,e,i){const n=ao(this.getTileGridForProjection(i).getTileSize(t),this.tmpSize);return[Math.round(n[0]*e),Math.round(n[1]*e)]}setOverlaps(t){this.overlaps_=t,this.changed()}};function If(t,e){t.setLoader(function(i,n,r){Ef(e,t.getFormat(),i,n,r,t.onLoad.bind(t),t.onError.bind(t))})}function Tf(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageBitmap?t:null}const Rf=new Error("disposed"),kf=[256,256],Af=class extends Xd{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=Tf(this.data_);return t?[t.width,t.height]:kf}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(Rf),this.controller_=null),super.disposeInternal()}},Gf=class{constructor(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const t=this.pop();t instanceof b&&t.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return ct(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 ct(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){ct(!(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}},Of=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(dr(),{get:(t,e)=>{if("function"==typeof dr()[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,n=e.length;i<n;++i){const n=e[i];if("function"==typeof n){n(t);continue}const r=e[++i];if("function"==typeof t[n])t[n](...r);else{if("function"==typeof r){t[n]=r(t);continue}t[n]=r}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},Ff=class extends j{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=5}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return N()}getData(t){return null}prepareFrame(t){return N()}renderFrame(t,e){return N()}forEachFeatureAtCoordinate(t,e,i,n,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;2!==e.getState()&&3!==e.getState()||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return 2!=e&&3!=e&&t.addEventListener(g,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()}},Lf=[];let jf=null;const Nf=class extends Ff{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 n;jf||(jf=ur(1,1,void 0,{willReadFrequently:!0})),jf.clearRect(0,0,1,1);try{jf.drawImage(t,e,i,1,1,0,0,1,1),n=jf.getImageData(0,0,1,1).data}catch{return jf=null,null}return n}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let r,s;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&I(ro(t.style.backgroundColor),ro(i)))){const e=t.firstElementChild;mr(e)&&(s=e.getContext("2d"))}if(s&&function(t,e){const i=Zi(t),n=Zi(e);for(let t=0;t<6;++t)if(0!==Math.round((i[t]-n[t])*Yi[t]))return!1;return!0}(s.canvas.style.transform,e)?(this.container=t,this.context=s,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=Q?gr():document.createElement("div"),r.className=n;let t=r.style;t.position="absolute",t.width="100%",t.height="100%",s=ur();const e=s.canvas;r.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=r,this.context=s}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=ne(i),r=re(i),s=Zt(i),o=Yt(i);Wi(e.coordinateToPixelTransform,n),Wi(e.coordinateToPixelTransform,r),Wi(e.coordinateToPixelTransform,s),Wi(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;Wi(a,n),Wi(a,r),Wi(a,s),Wi(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}prepareContainer(t,e){const i=t.extent,n=t.viewState.resolution,r=t.viewState.rotation,s=t.pixelRatio,o=Math.round(se(i)/n*s),a=Math.round(ee(i)/n*s);Vi(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/s,1/s,r,-o/2,-a/2),Ki(this.inversePixelTransform,this.pixelTransform);const l="matrix("+this.pixelTransform.join(", ")+")";if(this.useContainer(e,l,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),l!==t.style.transform&&(t.style.transform=l)}}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const r=new Jl(t,this.inversePixelTransform,i,e);n.dispatchEvent(r)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(ms,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(ys,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new Of),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(ms,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(ys,this.context,t))}getRenderTransform(t,e,i,n,r,s,o){const a=r/2,l=s/2,h=n/e,u=-h,c=-t[0]+o,d=-t[1];return Vi(this.tempTransform,a,l,h,u,-i,c,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}};function Df(t,e,i){if(!(i in t))return t[i]=new Set([e]),!0;const n=t[i],r=n.has(e);return r||n.add(e),!r}function zf(t,e,i){const n=t[i];return!!n&&n.delete(e)}function qf(t,e){const i=t.layerStatesArray[t.layerIndex];i.extent&&(e=ie(e,Fi(i.extent,t.viewState.projection)));const n=i.layer.getRenderSource();if(!n.getWrapX()){const i=n.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=ie(e,i))}return e}const $f=class extends Nf{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 Ld(0,0,0,0),this.tempTileCoord_=jd(0,0,0);const i=void 0!==e.cacheSize?e.cacheSize:512;this.tileCache_=new Gf(i),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=.5*i}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Gf(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,n){const r=this.tileCache_,s=this.getLayer().getSource(),o=Nd(s,s.getKey(),t,e,i);let a;if(r.containsKey(o))a=r.get(o);else{const l=n.viewState.projection,h=s.getProjection();if(a=s.getTile(t,e,i,n.pixelRatio,l,!h||Mi(h,l)?void 0:this.getSourceTileCache()),!a)return null;r.set(o,a)}return a}getTile(t,e,i,n){return this.getOrCreateTile(t,e,i,n)||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=Wi(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!Ot(r,n))return null;const s=e.viewState,o=i.getRenderSource(),a=o.getTileGridForProjection(s.projection),l=o.getTilePixelRatio(e.pixelRatio);for(let t=a.getZForResolution(s.resolution);t>=a.getMinZoom();--t){const i=a.getTileCoordForCoordAndZ(n,t),r=this.getTile(t,i[1],i[2],e);if(!r||2!==r.getState())continue;const h=a.getOrigin(t),u=ao(a.getTileSize(t)),c=a.getResolution(t);let d;if(r instanceof Vd||r instanceof tf)d=r.getImage();else{if(!(r instanceof Af))continue;if(d=Tf(r.getData()),!d)continue}const f=Math.floor(l*((n[0]-h[0])/c-i[1]*u[0])),p=Math.floor(l*((h[1]-n[1])/c-i[2]*u[1])),g=Math.round(l*o.getGutterForProjection(s.projection));return this.getImageData(d,f+g,p+g)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=i,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,i,n,r){const s=t.viewState,o=this.getLayer(),a=o.getRenderSource(),l=a.getTileGridForProjection(s.projection),h=z(a);h in t.wantedTiles||(t.wantedTiles[h]={});const u=t.wantedTiles[h],c=o.getMapInternal(),d=Math.max(i-r,l.getMinZoom(),l.getZForResolution(Math.min(o.getMaxResolution(),c?c.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):l.getResolution(0)),a.zDirection)),f=s.rotation,p=f?te(s.center,s.resolution,f,t.size):void 0;for(let r=i;r>=d;--r){const i=l.getTileRangeForExtentAndZ(e,r,this.tempTileRange_),s=l.getResolution(r);for(let e=i.minX;e<=i.maxX;++e)for(let o=i.minY;o<=i.maxY;++o){if(f&&!l.tileCoordIntersectsViewport([r,e,o],p))continue;const i=this.getTile(r,e,o,t);if(!i)continue;if(!Df(n,i,r))continue;const a=i.getKey();if(u[a]=!0,0===i.getState()&&!t.tileQueue.isKeyQueued(a)){const n=jd(r,e,o,this.tempTileCoord_);t.tileQueue.enqueue([i,h,l.getTileCoordCenter(n),s])}}}}findStaleTile_(t,e){const i=this.tileCache_,n=t[0],r=t[1],s=t[2],o=this.getStaleKeys();for(let t=0;t<o.length;++t){const a=Nd(this.getLayer().getSource(),o[t],n,r,s);if(i.containsKey(a)){const t=i.peek(a);if(2===t.getState())return t.endTransition(z(this)),Df(e,t,n),!0}}return!1}findAltTiles_(t,e,i,n){const r=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!r)return!1;let s=!0;const o=this.tileCache_,a=this.getLayer().getRenderSource(),l=a.getKey();for(let t=r.minX;t<=r.maxX;++t)for(let e=r.minY;e<=r.maxY;++e){const r=Nd(a,l,i,t,e);let h=!1;if(o.containsKey(r)){const t=o.peek(r);2===t.getState()&&(Df(n,t,i),h=!0)}h||(s=!1)}return s}renderFrame(t,e){this.renderComplete=!0;const i=t.layerStatesArray[t.layerIndex],n=t.viewState,r=n.projection,s=n.resolution,o=n.center,a=t.pixelRatio,l=this.getLayer(),h=l.getSource(),u=h.getTileGridForProjection(r),c=u.getZForResolution(s,h.zDirection),d=u.getResolution(c),f=h.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==f&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=f):this.renderedSourceKey_=f;let p=t.extent;const g=h.getTilePixelRatio(a);this.prepareContainer(t,e);const m=this.context.canvas.width,y=this.context.canvas.height;this.layerExtent=i.extent?Fi(i.extent):null,this.layerExtent&&(p=ie(p,this.layerExtent));const _=d*m/2/g,v=d*y/2/g,x=[o[0]-_,o[1]-v,o[0]+_,o[1]+v],w={};this.renderedTiles.length=0;const b=l.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const e=u.getZForResolution(n.nextResolution,h.zDirection),i=qf(t,t.nextExtent);this.enqueueTiles(t,i,e,w,b)}const M=qf(t,p);if(this.enqueueTiles(t,M,c,w,0),b>0&&setTimeout(()=>{this.enqueueTiles(t,M,c-1,w,b-1)},0),!(c in w))return this.container;const E=z(this),C=t.time;for(const e of w[c]){const i=e.getState();if(4===i)continue;const n=e.tileCoord;if(2===i&&1===e.getAlpha(E,C)){e.endTransition(E);continue}if(3!==i&&(this.renderComplete=!1),this.findStaleTile_(n,w)){zf(w,e,c),t.animate=!0;continue}if(this.findAltTiles_(u,n,c+1,w))continue;const r=u.getMinZoom();for(let t=c-1;t>=r&&!this.findAltTiles_(u,n,t,w);--t);}const P=d/s*a/g,I=this.getRenderContext(t);Vi(this.tempTransform,m/2,y/2,P,P,0,-m/2,-y/2),this.layerExtent&&this.clipUnrotated(I,t,this.layerExtent),h.getInterpolate()||(I.imageSmoothingEnabled=!1),this.preRender(I,t);const T=Object.keys(w).map(Number);let R;T.sort(S);const k=[],A=[];for(let e=T.length-1;e>=0;--e){const i=T[e],n=h.getTilePixelSize(i,a,r),s=u.getResolution(i)/d,o=n[0]*s*P,l=n[1]*s*P,c=u.getTileCoordForCoordAndZ(ne(x),i),f=u.getTileCoordExtent(c),p=Wi(this.tempTransform,[g*(f[0]-x[0])/d,g*(x[3]-f[3])/d]),m=g*h.getGutterForProjection(r);for(const e of w[i]){if(2!==e.getState())continue;const n=e.tileCoord,r=c[1]-n[1],s=Math.round(p[0]-(r-1)*o),a=c[2]-n[2],u=Math.round(p[1]-(a-1)*l),d=Math.round(p[0]-r*o),f=Math.round(p[1]-a*l),g=s-d,y=u-f,_=1===T.length;let v=!1;R=[d,f,d+g,f,d+g,f+y,d,f+y];for(let t=0,e=k.length;t<e;++t)if(!_&&i<A[t]){const e=k[t];oe([d,f,d+g,f+y],[e[0],e[3],e[4],e[7]])&&(v||(I.save(),v=!0),I.beginPath(),I.moveTo(R[0],R[1]),I.lineTo(R[2],R[3]),I.lineTo(R[4],R[5]),I.lineTo(R[6],R[7]),I.moveTo(e[6],e[7]),I.lineTo(e[4],e[5]),I.lineTo(e[2],e[3]),I.lineTo(e[0],e[1]),I.clip())}k.push(R),A.push(i),this.drawTile(e,t,d,f,g,y,m,_),v&&I.restore(),this.renderedTiles.unshift(e),this.updateUsedTiles(t.usedTiles,h,e)}}if(this.renderedResolution=d,this.extentChanged=!this.renderedExtent_||!$t(this.renderedExtent_,x),this.renderedExtent_=x,this.renderedPixelRatio=a,this.postRender(this.context,t),this.layerExtent&&I.restore(),I.imageSmoothingEnabled=!0,this.renderComplete){const e=(t,e)=>{const i=z(h),n=e.wantedTiles[i],r=n?Object.keys(n).length:0;this.updateCacheSize(r),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(e)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,2*t)}drawTile(t,e,i,n,r,s,o,a){let l;if(t instanceof Af){if(l=Tf(t.getData()),!l)throw new Error("Rendering array data is not yet supported")}else l=this.getTileImage(t);if(!l)return;const h=this.getRenderContext(e),u=z(this),c=e.layerStatesArray[e.layerIndex],d=c.opacity*(a?t.getAlpha(u,e.time):1),f=d!==h.globalAlpha;f&&(h.save(),h.globalAlpha=d),h.drawImage(l,o,o,l.width-2*o,l.height-2*o,i,n,r,s),f&&h.restore(),d!==c.opacity?e.animate=!0:a&&t.endTransition(u)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,i){const n=z(e);n in t||(t[n]={}),t[n][i.getKey()]=!0}},Bf="preload",Uf="useInterimTilesOnError",Wf=class extends ws{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(Bf)}setPreload(t){this.set(Bf,t)}getUseInterimTilesOnError(){return this.get(Uf)}setUseInterimTilesOnError(t){this.set(Uf,t)}getData(t){return super.getData(t)}},Xf=class extends Wf{constructor(t){super(t)}createRenderer(){return new $f(this,{cacheSize:this.getCacheSize()})}},Vf=class{drawCustom(t,e,i,n,r){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}},Kf={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},Yf=[Kf.FILL],Zf=[Kf.STROKE],Hf=[Kf.BEGIN_PATH],Jf=[Kf.CLOSE_PATH],Qf=Kf,tp=class extends Vf{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return 1==e?t:t.map(function(t){return t*e})}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,r=this.coordinates;let s=r.length;for(let o=0,a=t.length;o<a;o+=e)n[0]=t[o],n[1]=t[o+1],Ot(i,n)&&(r[s++]=n[0],r[s++]=n[1]);return s}appendFlatLineCoordinates(t,e,i,n,r,s){const o=this.coordinates;let a=o.length;const l=this.getBufferedMaxExtent();s&&(e+=n);let h=t[e],u=t[e+1];const c=this.tmpCoordinate_;let d,f,p,g=!0;for(d=e+n;d<i;d+=n)c[0]=t[d],c[1]=t[d+1],p=jt(l,c),p!==f?(g&&(o[a++]=h,o[a++]=u,g=!1),o[a++]=c[0],o[a++]=c[1]):1===p?(o[a++]=c[0],o[a++]=c[1],g=!1):g=!0,h=c[0],u=c[1],f=p;return(r&&g||d===e+n)&&(o[a++]=h,o[a++]=u),a}drawCustomCoordinates_(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s],a=this.appendFlatLineCoordinates(t,e,o,n,!1,!1);r.push(a),e=o}return e}drawCustom(t,e,i,n,r){this.beginGeometry(t,e,r);const s=t.getType(),o=t.getStride(),a=this.coordinates.length;let l,h,u,c,d;switch(s){case"MultiPolygon":l=t.getOrientedFlatCoordinates(),c=[];const e=t.getEndss();d=0;for(let t=0,i=e.length;t<i;++t){const i=[];d=this.drawCustomCoordinates_(l,d,e[t],o,i),c.push(i)}this.instructions.push([Qf.CUSTOM,a,c,t,i,_n,r]),this.hitDetectionInstructions.push([Qf.CUSTOM,a,c,t,n||i,_n,r]);break;case"Polygon":case"MultiLineString":u=[],l="Polygon"==s?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(l,0,t.getEnds(),o,u),this.instructions.push([Qf.CUSTOM,a,u,t,i,yn,r]),this.hitDetectionInstructions.push([Qf.CUSTOM,a,u,t,n||i,yn,r]);break;case"LineString":case"Circle":l=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(l,0,l.length,o,!1,!1),this.instructions.push([Qf.CUSTOM,a,h,t,i,mn,r]),this.hitDetectionInstructions.push([Qf.CUSTOM,a,h,t,n||i,mn,r]);break;case"MultiPoint":l=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(l,o),h>a&&(this.instructions.push([Qf.CUSTOM,a,h,t,i,mn,r]),this.hitDetectionInstructions.push([Qf.CUSTOM,a,h,t,n||i,mn,r]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([Qf.CUSTOM,a,h,t,i,void 0,r]),this.hitDetectionInstructions.push([Qf.CUSTOM,a,h,t,n||i,void 0,r])}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[Qf.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[Qf.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let n,r,s=-1;for(e=0;e<i;++e)n=t[e],r=n[0],r==Qf.END_GEOMETRY?s=e:r==Qf.BEGIN_GEOMETRY&&(n[2]=e,C(this.hitDetectionInstructions,s,e),s=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&"object"==typeof i&&"src"in i?this.pixelRatio:1,e.fillStyle=Da(i||qa)??void 0}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=Da(i||Wa);const n=t.getLineCap();e.lineCap=void 0!==n?n:$a;const r=t.getLineDash();e.lineDash=r?r.slice():Ba;const s=t.getLineDashOffset();e.lineDashOffset=s||0;const o=t.getLineJoin();e.lineJoin=void 0!==o?o:Ua;const a=t.getWidth();e.lineWidth=void 0!==a?a:1;const l=t.getMiterLimit();e.miterLimit=void 0!==l?l:10;const h=t.getOffset();e.strokeOffset=h??0,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0,e.strokeOffset=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[Qf.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[Qf.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;(void 0!==i&&"string"!=typeof i||t.currentFillStyle!=i)&&(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,r=t.lineDash,s=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit,h=t.strokeOffset;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!I(t.currentLineDash,r)||t.currentLineDashOffset!=s||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l||t.currentStrokeOffset!=h)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=s,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l,t.currentStrokeOffset=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[Qf.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=At(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;kt(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},ep=class extends tp{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinatess_(t,e,i,n,r){const s=this.state,o=void 0!==s.fillStyle,a=void 0!==s.strokeStyle,l=i.length;this.instructions.push(Hf),this.hitDetectionInstructions.push(Hf);for(let s=0;s<l;++s){const o=i[s],l=this.coordinates.length,h=this.appendFlatLineCoordinates(t,e,o,n,!0,!a);this.instructions.push([Qf.MOVE_TO_LINE_TO,l,h,r*this.pixelRatio,!0]),this.hitDetectionInstructions.push([Qf.MOVE_TO_LINE_TO,l,h,r,!0]),a&&(this.instructions.push(Jf),this.hitDetectionInstructions.push(Jf)),e=o}return o&&(this.instructions.push(Yf),this.hitDetectionInstructions.push(Yf)),a&&(this.instructions.push(Zf),this.hitDetectionInstructions.push(Zf)),e}drawCircle(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_(()=>this.drawCircle(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Qf.SET_FILL_STYLE,qa]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Qf.SET_STROKE_STYLE,Wa,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Ba,0]);const a=t.getFlatCoordinates(),l=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const u=[Qf.CIRCLE,h,o];this.instructions.push(Hf,u),this.hitDetectionInstructions.push(Hf,u),void 0!==n.fillStyle&&(this.instructions.push(Yf),this.hitDetectionInstructions.push(Yf)),void 0!==n.strokeStyle&&(this.instructions.push(Zf),this.hitDetectionInstructions.push(Zf)),this.endGeometry(e)}drawPolygon(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_(()=>this.drawPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Qf.SET_FILL_STYLE,qa]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Qf.SET_STROKE_STYLE,Wa,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Ba,0]);const a=t.getEnds(),l=t.getOrientedFlatCoordinates(),h=t.getStride();this.drawFlatCoordinatess_(l,0,a,h,o),this.endGeometry(e)}drawMultiPolygon(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_(()=>this.drawMultiPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Qf.SET_FILL_STYLE,qa]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Qf.SET_STROKE_STYLE,Wa,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Ba,0]);const a=t.getEndss(),l=t.getOrientedFlatCoordinates(),h=t.getStride();let u=0;for(let t=0,e=a.length;t<e;++t)u=this.drawFlatCoordinatess_(l,u,a[t],h,o);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(0!==t){const e=this.coordinates;for(let i=0,n=e.length;i<n;++i)e[i]=wn(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}handleStrokeOffset_(t){const e=this.state,i=e.fillStyle,n=e.strokeStyle,r=e.strokeOffset;return Math.abs(r)>0&&void 0!==i&&void 0!==n&&(e.strokeStyle=void 0,e.strokeOffset=0,t(),e.fillStyle=void 0,e.strokeStyle=n,e.strokeOffset=r,t(),e.fillStyle=i,!0)}};function ip(t,e,i,n,r){const s=[];let o=i,a=0,l=e.slice(i,2);for(;a<t&&o+r<n;){const[i,n]=l.slice(-2),h=e[o+r],u=e[o+r+1],c=Math.sqrt((h-i)*(h-i)+(u-n)*(u-n));if(a+=c,a>=t){const e=(t-a+c)/c,d=bt(i,h,e),f=bt(n,u,e);l.push(d,f),s.push(l),l=[d,f],a==t&&(o+=r),a=0}else if(a<t)l.push(e[o+r],e[o+r+1]),o+=r;else{const t=c-a,e=bt(i,h,t/c),d=bt(n,u,t/c);l.push(e,d),s.push(l),l=[e,d],a=0,o+=r}}return a>0&&s.push(l),s}function np(t,e,i,n,r){let s,o,a,l,h,u,c,d,f,p,g=i,m=i,y=0,_=0,v=i;for(o=i;o<n;o+=r){const i=e[o],n=e[o+1];void 0!==h&&(f=i-h,p=n-u,l=Math.sqrt(f*f+p*p),void 0!==c&&(_+=a,s=Math.acos((c*f+d*p)/(a*l)),s>t&&(_>y&&(y=_,g=v,m=o),_=0,v=o-r)),a=l,c=f,d=p),h=i,u=n}return _+=l,_>y?[v,o]:[g,m]}const rp={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},sp={Circle:ep,Default:tp,Image:class extends tp{constructor(t,e,i,n){super(t,e,i,n),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!Ot(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=t.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(n,r);this.instructions.push([Qf.DRAW_IMAGE,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([Qf.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=[];for(let e=0,i=n.length;e<i;e+=t.getStride())this.maxExtent&&!Ot(this.maxExtent,n.slice(e,e+2))||r.push(n[e],n[e+1]);const s=this.coordinates.length,o=this.appendFlatPointCoordinates(r,2);this.instructions.push([Qf.DRAW_IMAGE,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([Qf.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),n=t.getSize(),r=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}},LineString:class extends tp{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n,r){const s=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,n,!1,!1);return this.instructions.push([Qf.MOVE_TO_LINE_TO,s,o,r*this.pixelRatio]),this.hitDetectionInstructions.push([Qf.MOVE_TO_LINE_TO,s,o,r]),i}drawLineString(t,e,i){const n=this.state,r=n.strokeStyle,s=n.lineWidth,o=n.strokeOffset;if(void 0===r||void 0===s)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([Qf.SET_STROKE_STYLE,Wa,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Ba,0],Hf);const a=t.getFlatCoordinates(),l=t.getStride();this.drawFlatCoordinates_(a,0,a.length,l,o),this.hitDetectionInstructions.push(Zf),this.endGeometry(e)}drawMultiLineString(t,e,i){const n=this.state,r=n.strokeStyle,s=n.lineWidth,o=n.strokeOffset;if(void 0===r||void 0===s)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([Qf.SET_STROKE_STYLE,Wa,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Ba,0],Hf);const a=t.getEnds(),l=t.getFlatCoordinates(),h=t.getStride();let u=0;for(let t=0,e=a.length;t<e;++t)u=this.drawFlatCoordinates_(l,u,a[t],h,o);this.hitDetectionInstructions.push(Zf),this.endGeometry(e)}finish(){const t=this.state;return null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(Zf),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(Zf),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(Hf)}},Polygon:ep,Text:class extends tp{constructor(t,e,i,n){super(t,e,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[qa]={fillStyle:qa},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){const n=this.textFillState_,r=this.textStrokeState_,s=this.textState_;if(""===this.text_||!s||!n&&!r)return;const o=this.coordinates;let a=o.length;const l=t.getType();let h=null,u=t.getStride();if("line"!==s.placement||"LineString"!=l&&"MultiLineString"!=l&&"Polygon"!=l&&"MultiPolygon"!=l){let n=s.overflow?null:[];switch(l){case"Point":case"MultiPoint":h=t.getFlatCoordinates();break;case"LineString":h=t.getFlatMidpoint();break;case"Circle":h=t.getCenter();break;case"MultiLineString":h=t.getFlatMidpoints(),u=2;break;case"Polygon":h=t.getFlatInteriorPoint(),s.overflow||n.push(h[2]/this.resolution),u=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();h=[];for(let t=0,i=e.length;t<i;t+=3)s.overflow||n.push(e[t+2]/this.resolution),h.push(e[t],e[t+1]);if(0===h.length)return;u=2}const r=this.appendFlatPointCoordinates(h,u);if(r===a)return;if(n&&(r-a)/2!==h.length/u){let t=a/2;n=n.filter((e,i)=>{const n=o[2*(t+i)]===h[i*u]&&o[2*(t+i)+1]===h[i*u+1];return n||--t,n})}this.saveTextStates_();const c=s.backgroundFill?this.createFill(this.fillStyleToState(s.backgroundFill)):null,d=s.backgroundStroke?this.createStroke(this.strokeStyleToState(s.backgroundStroke)):null;this.beginGeometry(t,e,i);let f=s.padding;if(f!=Ka&&(s.scale[0]<0||s.scale[1]<0)){let t=s.padding[0],e=s.padding[1],i=s.padding[2],n=s.padding[3];s.scale[0]<0&&(e=-e,n=-n),s.scale[1]<0&&(t=-t,i=-i),f=[t,e,i,n]}const p=this.pixelRatio;this.instructions.push([Qf.DRAW_IMAGE,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,f==Ka?Ka:f.map(function(t){return t*p}),c,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]);const g=1/p,m=c?c.slice(0):null;m&&(m[1]=qa),this.hitDetectionInstructions.push([Qf.DRAW_IMAGE,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[g,g],NaN,this.declutterMode_,this.declutterImageWithText_,f,m,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?qa:this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]),this.endGeometry(e)}else{if(!oe(this.maxExtent,t.getExtent()))return;let n;if(h=t.getFlatCoordinates(),"LineString"==l)n=[h.length];else if("MultiLineString"==l)n=t.getEnds();else if("Polygon"==l)n=t.getEnds().slice(0,1);else if("MultiPolygon"==l){const e=t.getEndss();n=[];for(let t=0,i=e.length;t<i;++t)n.push(e[t][0])}this.beginGeometry(t,e,i);const r=s.repeat,c=r?void 0:s.textAlign;let d=0;for(let t=0,e=n.length;t<e;++t){let e;e=r?ip(r*this.resolution,h,d,n[t],u):[h.slice(d,n[t])];for(let i=0,r=e.length;i<r;++i){const r=e[i];let l=0,h=r.length;if(null==c){const t=np(s.maxAngle,r,0,r.length,2);l=t[0],h=t[1]}for(let t=l;t<h;t+=u)o.push(r[t],r[t+1]);const f=o.length;d=n[t],this.drawChars_(a,f),a=f}}this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,n=this.strokeKey_;t&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const r=this.textKey_;r in this.textStates||(this.textStates[r]={font:e.font,textAlign:e.textAlign||Xa,justify:e.justify,textBaseline:e.textBaseline||Va,scale:e.scale});const s=this.fillKey_;i&&(s in this.fillStates||(this.fillStates[s]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,n=this.textState_,r=this.strokeKey_,s=this.textKey_,o=this.fillKey_;this.saveTextStates_();const a=this.pixelRatio,l=rp[n.textBaseline],h=this.textOffsetY_*a,u=this.text_,c=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([Qf.DRAW_CHARS,t,e,l,n.overflow,o,n.maxAngle,a,h,r,c*a,u,s,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([Qf.DRAW_CHARS,t,e,l,n.overflow,o?qa:o,n.maxAngle,a,h,r,c*a,u,s,1/a,this.declutterMode_,this.textKeepUpright_])}setTextStyle(t,e){let i,n,r;if(t){const e=t.getFill();e?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=Da(e.getColor()||qa)):(n=null,this.textFillState_=n);const s=t.getStroke();if(s){r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const t=s.getLineDash(),e=s.getLineDashOffset(),i=s.getWidth(),n=s.getMiterLimit();r.lineCap=s.getLineCap()||$a,r.lineDash=t?t.slice():Ba,r.lineDashOffset=void 0===e?0:e,r.lineJoin=s.getLineJoin()||Ua,r.lineWidth=void 0===i?1:i,r.miterLimit=void 0===n?10:n,r.strokeStyle=Da(s.getColor()||Wa)}else r=null,this.textStrokeState_=r;i=this.textState_;const o=t.getFont()||za;el(o);const a=t.getScaleArray();i.overflow=t.getOverflow(),i.font=o,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||Va,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||Ka,i.scale=void 0===a?[1,1]:a;const l=t.getOffsetX(),h=t.getOffsetY(),u=t.getRotateWithView(),c=t.getKeepUpright(),d=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=void 0===l?0:l,this.textOffsetY_=void 0===h?0:h,this.textRotateWithView_=void 0!==u&&u,this.textKeepUpright_=void 0===c||c,this.textRotation_=void 0===d?0:d,this.strokeKey_=r?("string"==typeof r.strokeStyle?r.strokeStyle:z(r.strokeStyle))+r.lineCap+r.lineDashOffset+"|"+r.lineWidth+r.lineJoin+r.miterLimit+"["+r.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=n&&n.fillStyle?"string"==typeof n.fillStyle?n.fillStyle:"|"+z(n.fillStyle):""}else this.text_="";this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}},op=class{constructor(t,e,i,n){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=n,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const n in i){const r=i[n].finish();t[e][n]=r}}return t}getBuilder(t,e){const i=void 0!==t?t.toString():"0";let n=this.buildersByZIndex_[i];void 0===n&&(n={},this.buildersByZIndex_[i]=n);let r=n[e];return void 0===r&&(r=new(0,sp[e])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=r),r}};function ap(t,e,i,n){let r=t[e],s=t[e+1],o=0;for(let a=e+n;a<i;a+=n){const e=t[a],i=t[a+1];o+=Math.sqrt((e-r)*(e-r)+(i-s)*(i-s)),r=e,s=i}return o}function lp(t,e,i,n,r,s,o,a){o=o??[],a=a??n;const l=t[e+n],h=t[e+n+1],u=t[i-2*n],c=t[i-2*n+1];let d,f,p,g,m,y,_,v,x=0;for(let w=e;w<i;w+=n){p=d,g=f,m=void 0,y=void 0,w+n<i&&(m=t[w+n],y=t[w+n+1]),s&&w===e&&(p=u,g=c),s&&w===i-n&&(m=l,y=h),d=t[w],f=t[w+1],[_,v]=hp(d,f,p,g,m,y,r),o[x++]=_,o[x++]=v;for(let e=2;e<a;e++)o[x++]=t[w+e]}return o.length!=x&&(o.length=x),o}function hp(t,e,i,n,r,s,o){let a,l;void 0!==i&&void 0!==n?(a=t-i,l=e-n):void 0!==r&&void 0!==s?(a=r-t,l=s-e):(a=1,l=0);const h=Math.hypot(a,l),u=a/h,c=l/h;if(a=-c,l=u,void 0===i||void 0===n)return[t+a*o,e+l*o];if(void 0===r||void 0===s)return[t+a*o,e+l*o];const d=function(t,e,i){const n=Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),r=[(e[0]-t[0])/n,(e[1]-t[1])/n],s=[-r[1],r[0]],o=Math.sqrt((i[0]-t[0])*(i[0]-t[0])+(i[1]-t[1])*(i[1]-t[1])),a=[(i[0]-t[0])/o,(i[1]-t[1])/o];let l=0===n||0===o?0:Math.acos(mt(a[0]*r[0]+a[1]*r[1],-1,1));return l=Math.max(l,1e-5),a[0]*s[0]+a[1]*s[1]>0?l:2*Math.PI-l}([t,e],[i,n],[r,s]);if(Math.cos(d)>.998)return[t+u*o,e+c*o];const f=Math.cos(d/2),p=Math.sin(d/2);return[t+1/p*(p*a+f*l)*o,e+1/p*(-f*a+p*l)*o]}function up(t,e){for(let i=0,n=t.length-2;i<n;i+=e)for(let n=t.length-2*e;n>i+e;n-=e){const r=t[i],s=t[i+1],o=t[i+e],a=t[i+e+1],l=t[n],h=t[n+1],u=t[n+e],c=t[n+e+1],d=(c-h)*(o-r)-(u-l)*(a-s);if(0===d)continue;const f=((u-l)*(s-h)-(c-h)*(r-l))/d,p=((o-r)*(s-h)-(a-s)*(r-l))/d;if(f>0&&f<1&&p>0&&p<1){const l=r+f*(o-r),h=s+f*(a-s);t[i+e]=l,t[i+e+1]=h,t.splice(i+2*e,n-i-e);break}}return t}function cp(t,e,i,n,r,s,o,a,l,h,u,c,d=!0){let f=t[e],p=t[e+1],g=0,m=0,y=0,_=0;function v(){g=f,m=p,f=t[e+=n],p=t[e+1],_+=y,y=Math.sqrt((f-g)*(f-g)+(p-m)*(p-m))}do{v()}while(e<i-n&&_+y<s);let x=0===y?0:(s-_)/y;const w=bt(g,f,x),b=bt(m,p,x),S=e-n,M=_,E=s+a*l(h,r,u);for(;e<i-n&&_+y<E;)v();x=0===y?0:(E-_)/y;const C=bt(g,f,x),P=bt(m,p,x);let I=!1;if(d)if(c){const t=[w,b,C,P];Ji(t,0,4,2,c,t,t),I=t[0]>t[2]}else I=w>C;const T=Math.PI,R=[],k=S+n===e;let A;if(y=0,_=M,f=t[e=S],p=t[e+1],k){v(),A=Math.atan2(p-m,f-g),I&&(A+=A>0?-T:T);const t=(C+w)/2,e=(P+b)/2;return R[0]=[t,e,(E-s)/2,A,r],R}for(let t=0,c=(r=r.replace(/\n/g," ")).length;t<c;){v();let d=Math.atan2(p-m,f-g);if(I&&(d+=d>0?-T:T),void 0!==A){let t=d-A;if(t+=t>T?-2*T:t<-T?2*T:0,Math.abs(t)>o)return null}A=d;const w=t;let b=0;for(;t<c;++t){const o=a*l(h,r[I?c-t-1:t],u);if(e+n<i&&_+y<s+b+o/2)break;b+=o}if(t===w)continue;const S=I?r.substring(c-w,c-t):r.substring(w,t);x=0===y?0:(s+b/2-_)/y;const M=bt(g,f,x),E=bt(m,p,x);R.push([M,E,b/2,d,S]),s+=b}return R}const dp=[1/0,1/0,-1/0,-1/0],fp=[],pp=[],gp=[],mp=[];function yp(t){return t[3].declutterBox}const _p=new RegExp("["+String.fromCharCode(1425)+"-"+String.fromCharCode(2303)+String.fromCharCode(64285)+"-"+String.fromCharCode(65023)+String.fromCharCode(65136)+"-"+String.fromCharCode(65276)+String.fromCharCode(67584)+"-"+String.fromCharCode(69631)+String.fromCharCode(124928)+"-"+String.fromCharCode(126975)+"]");function vp(t,e){return"start"===e?e=_p.test(t)?"right":"left":"end"===e&&(e=_p.test(t)?"left":"right"),rp[e]}function xp(t,e,i){return i>0&&t.push("\n",""),t.push(e,""),t}function wp(t,e,i){return i%2==0&&(t+=e),t}const bp=class{constructor(t,e,i,n,r){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=[1,0,0,1,0,0],this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=r?new Of:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,n){const r=t+e+i+n;if(this.labels_[r])return this.labels_[r];const s=n?this.strokeStates[n]:null,o=i?this.fillStates[i]:null,a=this.textStates[e],l=this.pixelRatio,h=[a.scale[0]*l,a.scale[1]*l],u=a.justify?rp[a.justify]:vp(Array.isArray(t)?t[0]:t,a.textAlign||Xa),c=n&&s.lineWidth?s.lineWidth:0,d=Array.isArray(t)?t:String(t).split("\n").reduce(xp,[]),{width:f,height:p,widths:g,heights:m,lineWidths:y}=function(t,e){const i=[],n=[],r=[];let s=0,o=0,a=0,l=0;for(let h=0,u=e.length;h<=u;h+=2){const c=e[h];if("\n"===c||h===u){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}const d=e[h+1]||t.font,f=rl(d,c);i.push(f),o+=f;const p=il(d);n.push(p),l=Math.max(l,p)}return{width:s,height:a,widths:i,heights:n,lineWidths:r}}(a,d),_=f+c,v=[],x=(_+2)*h[0],w=(p+c)*h[1],b={width:x<0?Math.floor(x):Math.ceil(x),height:w<0?Math.floor(w):Math.ceil(w),contextInstructions:v};1==h[0]&&1==h[1]||v.push("scale",h),n&&(v.push("strokeStyle",s.strokeStyle),v.push("lineWidth",c),v.push("lineCap",s.lineCap),v.push("lineJoin",s.lineJoin),v.push("miterLimit",s.miterLimit),v.push("setLineDash",[s.lineDash]),v.push("lineDashOffset",s.lineDashOffset)),i&&v.push("fillStyle",o.fillStyle),v.push("textBaseline","middle"),v.push("textAlign","center");const S=.5-u;let M=u*_+S*c;const E=[],C=[];let P,I=0,T=0,R=0,k=0;for(let t=0,e=d.length;t<e;t+=2){const e=d[t];if("\n"===e){T+=I,I=0,M=u*_+S*c,++k;continue}const r=d[t+1]||a.font;r!==P&&(n&&E.push("font",r),i&&C.push("font",r),P=r),I=Math.max(I,m[R]);const s=[e,M+S*g[R]+u*(g[R]-y[k]),.5*(c+I)+T];M+=g[R],n&&E.push("strokeText",s),i&&C.push("fillText",s),++R}return Array.prototype.push.apply(v,E),Array.prototype.push.apply(v,C),this.labels_[r]=b,b}replayTextBackground_(t,e,i,n,r,s,o){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,n),t.lineTo.apply(t,r),t.lineTo.apply(t,e),s&&(this.alignAndScaleFill_=s[2],t.fillStyle=s[1],this.fill_(t)),o&&(this.setStrokeStyle_(t,o),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,n,r,s,o,a,l,h,u,c,d,f,p,g){let m=i-(o*=c[0]),y=n-(a*=c[1]);const _=r+l>t?t-l:r,v=s+h>e?e-h:s,x=f[3]+_*c[0]+f[1],w=f[0]+v*c[1]+f[2],b=m-f[3],S=y-f[0];let M;return(p||0!==u)&&(fp[0]=b,mp[0]=b,fp[1]=S,pp[1]=S,pp[0]=b+x,gp[0]=pp[0],gp[1]=S+w,mp[1]=gp[1]),0!==u?(M=Vi([1,0,0,1,0,0],i,n,1,1,u,-i,-n),Wi(M,fp),Wi(M,pp),Wi(M,gp),Wi(M,mp),Nt(Math.min(fp[0],pp[0],gp[0],mp[0]),Math.min(fp[1],pp[1],gp[1],mp[1]),Math.max(fp[0],pp[0],gp[0],mp[0]),Math.max(fp[1],pp[1],gp[1],mp[1]),dp)):Nt(Math.min(b,b+x),Math.min(S,S+w),Math.max(b,b+x),Math.max(S,S+w),dp),d&&(m=Math.round(m),y=Math.round(y)),{drawImageX:m,drawImageY:y,drawImageW:_,drawImageH:v,originX:l,originY:h,declutterBox:{minX:dp[0],minY:dp[1],maxX:dp[2],maxY:dp[3],value:g},canvasTransform:M,scale:c}}replayImageOrLabel_(t,e,i,n,r,s,o){const a=!(!s&&!o),l=n.declutterBox,h=o?o[2]*n.scale[0]/2:0;return l.minX-h<=e[0]&&l.maxX+h>=0&&l.minY-h<=e[1]&&l.maxY+h>=0&&(a&&this.replayTextBackground_(t,fp,pp,gp,mp,s,o),function(t,e,i,n,r,s,o,a,l,h,u){t.save(),1!==i&&(void 0===t.globalAlpha?t.globalAlpha=t=>t.globalAlpha*=i:t.globalAlpha*=i),e&&t.transform.apply(t,e),n.contextInstructions?(t.translate(l,h),t.scale(u[0],u[1]),function(t,e){const i=t.contextInstructions;for(let t=0,n=i.length;t<n;t+=2)Array.isArray(i[t+1])?e[i[t]].apply(e,i[t+1]):e[i[t]]=i[t+1]}(n,t)):u[0]<0||u[1]<0?(t.translate(l,h),t.scale(u[0],u[1]),t.drawImage(n,r,s,o,a,0,0,o,a)):t.drawImage(n,r,s,o,a,l,h,o*u[0],a*u[1]),t.restore()}(t,n.canvasTransform,r,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=Wi(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(i[0]%n,i[1]%n),1!==e&&t.scale(e,e)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,n){const r=this.textStates[e],s=this.createLabel(t,e,n,i),o=this.strokeStates[i],a=this.pixelRatio,l=vp(Array.isArray(t)?t[0]:t,r.textAlign||Xa),h=rp[r.textBaseline||Va],u=o&&o.lineWidth?o.lineWidth:0;return{label:s,anchorX:l*(s.width/a-2*r.scale[0])+2*(.5-l)*u,anchorY:h*s.height/a+2*(.5-h)*u}}execute_(t,e,i,n,r,s,o,a){const l=this.zIndexContext_;let h;var u,c;this.pixelCoordinates_&&I(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=Hi(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),c=i,(u=this.renderedTransform_)[0]=c[0],u[1]=c[1],u[2]=c[2],u[3]=c[3],u[4]=c[4],u[5]=c[5]);let d=0;const f=n.length;let p,g=0;const m=[];let y,_,v,x,w,b,S,M,E,C,P,T,R,k=0,A=0;const G=this.coordinateCache_,O=this.viewRotation_,F=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,L={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:O},j=this.instructions!=n||this.overlaps?0:200;let N,D,z,q;for(;d<f;){const i=n[d];switch(i[0]){case Qf.BEGIN_GEOMETRY:N=i[1],q=i[3],N.getGeometry()?void 0===o||oe(o,q.getExtent())?++d:d=i[2]+1:d=i[2],l&&(l.zIndex=i[4]);break;case Qf.BEGIN_PATH:k>j&&(this.fill_(t),k=0),A>j&&(t.stroke(),A=0),k||A||(t.beginPath(),w=NaN,b=NaN),++d;break;case Qf.CIRCLE:g=i[1],v=i[2]??0;const n=h[g],u=h[g+1],c=h[g+2]-v-n,f=h[g+3]-v-u,I=Math.sqrt(c*c+f*f);t.moveTo(n+I,u),t.arc(n,u,I,0,2*Math.PI,!0),++d;break;case Qf.CLOSE_PATH:t.closePath(),++d;break;case Qf.CUSTOM:g=i[1],p=i[2];const $=i[3],B=i[4],U=i[5];L.geometry=$,L.feature=N,d in G||(G[d]=[]);const W=G[d];U?U(h,g,p,2,W):(W[0]=h[g],W[1]=h[g+1],W.length=2),l&&(l.zIndex=i[6]),B(W,L),++d;break;case Qf.DRAW_IMAGE:g=i[1],p=i[2],E=i[3],y=i[4],_=i[5];let X=i[6];const V=i[7],K=i[8],Y=i[9],Z=i[10];let H=i[11];const J=i[12];let Q=i[13];x=i[14]||"declutter";const tt=i[15];if(!E&&i.length>=20){C=i[19],P=i[20],T=i[21],R=i[22];const t=this.drawLabelWithPointPlacement_(C,P,T,R);E=t.label,i[3]=E;const e=i[23];y=(t.anchorX-e)*this.pixelRatio,i[4]=y;const n=i[24];_=(t.anchorY-n)*this.pixelRatio,i[5]=_,X=E.height,i[6]=X,Q=E.width,i[13]=Q}let et,it,nt,rt;i.length>25&&(et=i[25]),i.length>17?(it=i[16],nt=i[17],rt=i[18]):(it=Ka,nt=null,rt=null),Z&&F?H+=O:Z||F||(H-=O);let st=0;for(;g<p;g+=2){if(et&&et[st++]<Q/this.pixelRatio)continue;const i=this.calculateImageOrLabelDimensions_(E.width,E.height,h[g],h[g+1],Q,X,y,_,K,Y,H,J,r,it,!!nt||!!rt,N),n=[t,e,E,i,V,nt,rt];if(a){let t,e,r,s,o;if(tt){const i=p-g;if(!tt[i]){tt[i]={args:n,declutterMode:x};continue}const s=tt[i];t=s.args,e=s.declutterMode,delete tt[i],r=yp(t)}if(!t||"declutter"===e&&a.collides(r)||(s=!0),"declutter"===x&&a.collides(i.declutterBox)||(o=!0),"declutter"===e&&"declutter"===x){const t=s&&o;s=t,o=t}s&&("none"!==e&&a.insert(r),this.replayImageOrLabel_.apply(this,t)),o&&("none"!==x&&a.insert(i.declutterBox),this.replayImageOrLabel_.apply(this,n))}else this.replayImageOrLabel_.apply(this,n)}++d;break;case Qf.DRAW_CHARS:const ot=i[1],at=i[2],lt=i[3],ht=i[4];R=i[5];const ut=i[6],ct=i[7],dt=i[8];T=i[9];const ft=i[10];C=i[11],Array.isArray(C)&&(C=C.reduce(wp,"")),P=i[12];const pt=[i[13],i[13]];x=i[14]||"declutter";const gt=i[15],mt=this.textStates[P],yt=mt.font,_t=[mt.scale[0]*ct,mt.scale[1]*ct];let vt;yt in this.widths_?vt=this.widths_[yt]:(vt={},this.widths_[yt]=vt);const xt=ap(h,ot,at,2),wt=Math.abs(_t[0])*sl(yt,C,vt);if(ht||wt<=xt){const i=cp(h,ot,at,2,C,(xt-wt)*vp(C,this.textStates[P].textAlign),ut,Math.abs(_t[0]),sl,yt,vt,F?0:this.viewRotation_,gt);t:if(i){const n=[];let r,s,o,l,h;if(T)for(r=0,s=i.length;r<s;++r){h=i[r],o=h[4],l=this.createLabel(o,P,"",T),y=h[2]+(_t[0]<0?-ft:ft),_=lt*l.height+2*(.5-lt)*ft*_t[1]/_t[0]-dt;const s=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,y,_,0,0,h[3],pt,!1,Ka,!1,N);if(a&&"declutter"===x&&a.collides(s.declutterBox))break t;n.push([t,e,l,s,1,null,null])}if(R)for(r=0,s=i.length;r<s;++r){h=i[r],o=h[4],l=this.createLabel(o,P,R,""),y=h[2],_=lt*l.height-dt;const s=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,y,_,0,0,h[3],pt,!1,Ka,!1,N);if(a&&"declutter"===x&&a.collides(s.declutterBox))break t;n.push([t,e,l,s,1,null,null])}a&&"none"!==x&&a.load(n.map(yp));for(let t=0,e=n.length;t<e;++t)this.replayImageOrLabel_.apply(this,n[t])}}++d;break;case Qf.END_GEOMETRY:if(void 0!==s){N=i[1];const t=s(N,q,x);if(t)return t}++d;break;case Qf.FILL:j?k++:this.fill_(t),++d;break;case Qf.MOVE_TO_LINE_TO:let bt,St,Mt;g=i[1],p=i[2],v=i[3],v?(lp(h,g,p,2,v,i[4]??!1,m),up(m,2),bt=m,St=0,Mt=bt.length):(bt=h,St=g,Mt=p),D=bt[St],z=bt[St+1],t.moveTo(D,z),w=D+.5|0,b=z+.5|0;for(let e=St+2;e<Mt;e+=2)D=bt[e],z=bt[e+1],S=D+.5|0,M=z+.5|0,e!=Mt-2&&S===w&&M===b||(t.lineTo(D,z),w=S,b=M);++d;break;case Qf.SET_FILL_STYLE:this.alignAndScaleFill_=i[2],k?(this.fill_(t),k=0,A&&(t.stroke(),A=0)):A&&i[1]&&(t.stroke(),A=0),t.fillStyle=i[1],++d;break;case Qf.SET_STROKE_STYLE:k&&i[1]&&(this.fill_(t),k=0),A&&(t.stroke(),A=0),this.setStrokeStyle_(t,i),++d;break;case Qf.STROKE:j?A++:t.stroke(),++d;break;default:++d}}k&&this.fill_(t),A&&t.stroke()}execute(t,e,i,n,r,s){this.viewRotation_=n,this.execute_(t,e,i,this.instructions,r,void 0,void 0,s)}executeHitDetection(t,e,i,n,r){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,n,r)}},Sp=["Polygon","Circle","LineString","Image","Text","Default"],Mp=["Image","Text"],Ep=Sp.filter(t=>!Mp.includes(t));let Cp=!1,Pp=!1;const Ip={},Tp=class{constructor(t,e,i,n,r,s,o){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=s,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=[1,0,0,1,0,0],this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,o)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let n=this.executorsByZIndex_[i];void 0===n&&(n={},this.executorsByZIndex_[i]=n);const r=t[i];for(const t in r){const i=r[t];n[t]=new bp(this.resolution_,this.pixelRatio_,this.overlaps_,i,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let e=0,n=t.length;e<n;++e)if(t[e]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,n,r,s){!1===Pp&&function(){let t=0;const e=e=>{const i=ur(1,1,null,{willReadFrequently:e});let n=0;const r=performance.now();for(;performance.now()-r<50;++n)i.fillStyle=`rgba(255,0,${n%256},1)`,i.fillRect(0,0,1,1),i.getImageData(0,0,1,1);return t=n>t?n:t,n},i={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0};Cp=i[t],Pp=!0}();const o=2*(n=Math.round(n))+1,a=Vi(this.hitDetectionTransform_,n+.5,n+.5,1/e,-1/e,-i,-t[0],-t[1]),l=!this.hitDetectionContext_;l&&(this.hitDetectionContext_=ur(o,o,null,{willReadFrequently:Cp}));const h=this.hitDetectionContext_;let u;h.canvas.width!==o||h.canvas.height!==o?(h.canvas.width=o,h.canvas.height=o):l||h.clearRect(0,0,o,o),void 0!==this.renderBuffer_&&(u=[1/0,1/0,-1/0,-1/0],Ut(u,t),kt(u,e*(this.renderBuffer_+n),u));const c=function(t){if(void 0!==Ip[t])return Ip[t];const e=2*t+1,i=t*t,n=new Array(i+1);for(let r=0;r<=t;++r)for(let s=0;s<=t;++s){const o=r*r+s*s;if(o>i)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+r)*e+(t+s))+3),r>0&&a.push(4*((t-r)*e+(t+s))+3),s>0&&(a.push(4*((t+r)*e+(t-s))+3),r>0&&a.push(4*((t-r)*e+(t-s))+3))}const r=[];for(let t=0,e=n.length;t<e;++t)n[t]&&r.push(...n[t]);return Ip[t]=r,r}(n);let d;function f(t,e,i){const a=h.getImageData(0,0,o,o).data;for(let l=0,u=c.length;l<u;l++)if(a[c[l]]>0){if(!s||"none"===i||"Image"!==d&&"Text"!==d||s.includes(t)){const i=(c[l]-3)/4,s=n-i%o,a=n-(i/o|0),h=r(t,e,s*s+a*a);if(h)return h}h.clearRect(0,0,o,o);break}}const p=Object.keys(this.executorsByZIndex_).map(Number);let g,m,y,_,v;for(p.sort(S),g=p.length-1;g>=0;--g){const t=p[g].toString();for(y=this.executorsByZIndex_[t],m=Sp.length-1;m>=0;--m)if(d=Sp[m],_=y[d],void 0!==_&&(v=_.executeHitDetection(h,a,i,f,u),v))return v}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],r=e[2],s=e[3],o=[i,n,i,s,r,s,r,n];return Hi(o,0,8,2,t,o),o}isEmpty(){return c(this.executorsByZIndex_)}execute(t,e,i,n,r,s,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?M:S),s=s||Sp;const l=Sp.length;for(let h=0,u=a.length;h<u;++h){const u=a[h].toString(),c=this.executorsByZIndex_[u];for(let u=0,d=s.length;u<d;++u){const d=s[u],f=c[d];if(void 0!==f){const s=null===o?void 0:f.getZIndexContext(),u=s?s.getContext():t,c=this.maxExtent_&&"Image"!==d&&"Text"!==d;if(c&&(u.save(),this.clip(u,i)),s&&"Text"!==d&&"Image"!==d?s.pushFunction(t=>f.execute(t,e,i,n,r,o)):f.execute(u,e,i,n,r,o),c&&u.restore(),s){s.offset();const t=a[h]*l+Sp.indexOf(d);this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(s)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(S);for(let i=0,n=e.length;i<n;++i)t[e[i]].forEach(t=>{t.draw(this.renderedContext_),t.clear()}),t[e[i]].length=0}},Rp=class extends Vf{constructor(t,e,i,n,r,s,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?St(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=r,this.squaredTolerance_=s,this.userTransform_=o,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=[1,0,0,1,0,0]}drawImages_(t,e,i,n){if(!this.image_)return;const r=Hi(t,e,i,n,this.transform_,this.pixelCoordinates_),s=this.context_,o=this.tmpLocalTransform_,a=s.globalAlpha;1!=this.imageOpacity_&&(s.globalAlpha=a*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let t=0,e=r.length;t<e;t+=2){const e=r[t]-this.imageAnchorX_,i=r[t+1]-this.imageAnchorY_;if(0!==l||1!=this.imageScale_[0]||1!=this.imageScale_[1]){const t=e+this.imageAnchorX_,n=i+this.imageAnchorY_;Vi(o,t,n,1,1,l,-t,-n),s.save(),s.transform.apply(s,o),s.translate(t,n),s.scale(this.imageScale_[0],this.imageScale_[1]),s.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),s.restore()}else s.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,e,i,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(s.globalAlpha=a)}drawText_(t,e,i,n){if(!this.textState_||""===this.text_)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const r=Hi(t,e,i,n,this.transform_,this.pixelCoordinates_),s=this.context_;let o=this.textRotation_;for(0===this.transformRotation_&&(o-=this.viewRotation_),this.textRotateWithView_&&(o+=this.viewRotation_);e<i;e+=n){const t=r[e]+this.textOffsetX_,i=r[e+1]+this.textOffsetY_;0!==o||1!=this.textScale_[0]||1!=this.textScale_[1]?(s.save(),s.translate(t-this.textOffsetX_,i-this.textOffsetY_),s.rotate(o),s.translate(this.textOffsetX_,this.textOffsetY_),s.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&s.strokeText(this.text_,0,0),this.textFillState_&&s.fillText(this.text_,0,0),s.restore()):(this.textStrokeState_&&s.strokeText(this.text_,t,i),this.textFillState_&&s.fillText(this.text_,t,i))}}moveToLineTo_(t,e,i,n,r,s){const o=this.context_;let a=Hi(t,e,i,n,this.transform_,this.pixelCoordinates_);Math.abs(s)>0&&(a=lp(a,0,a.length,2,s,r,a),up(a,2)),o.moveTo(a[0],a[1]);let l=a.length;r&&(l-=2);for(let t=2;t<l;t+=2)o.lineTo(a[t],a[t+1]);return r&&o.closePath(),i}drawRings_(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s)e=this.moveToLineTo_(t,e,i[s],n,!0,r);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),oe(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=function(t,e,i){const n=t.getFlatCoordinates();if(!n)return null;const r=t.getStride();return Hi(n,0,n.length,r,e,i)}(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],n=e[3]-e[1],r=Math.sqrt(i*i+n*n),s=this.context_;s.beginPath(),s.arc(e[0],e[1],r,0,2*Math.PI),this.fillState_&&s.fill(),this.strokeState_&&s.stroke()}""!==this.text_&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t)}}drawFeature(t,e){const i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let t=0,i=e.length;t<i;++t)this.drawGeometry(e[t])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),oe(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1,this.strokeState_.strokeOffset),e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(oe(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();let n=0;const r=t.getEnds(),s=t.getStride();e.beginPath();for(let t=0,e=r.length;t<e;++t)n=this.moveToLineTo_(i,n,r[t],s,!1,this.strokeState_.strokeOffset);e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoints();this.drawText_(e,0,e.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),oe(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),oe(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let n=0;const r=t.getEndss(),s=t.getStride();e.beginPath();for(let t=0,e=r.length;t<e;++t){const e=r[t];n=this.drawRings_(i,n,e,s,this.strokeState_?.strokeOffset)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),I(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),i.lineJoin!=t.lineJoin&&(i.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,i=this.contextTextState_,n=t.textAlign?t.textAlign:Xa;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=n&&(i.textAlign=n,e.textAlign=n),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=n,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:n,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(t){const e=t.getColor();this.fillState_={fillStyle:Da(e||qa)}}else this.fillState_=null;if(e){const t=e.getColor(),i=e.getLineCap(),n=e.getLineDash(),r=e.getLineDashOffset(),s=e.getLineJoin(),o=e.getWidth(),a=e.getMiterLimit(),l=n||Ba,h=e.getOffset();this.strokeState_={lineCap:void 0!==i?i:$a,lineDash:1===this.pixelRatio_?l:l.map(t=>t*this.pixelRatio_),lineDashOffset:(r||0)*this.pixelRatio_,lineJoin:void 0!==s?s:Ua,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:Da(t||Wa),strokeOffset:(h??0)*this.pixelRatio_}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const s=t.getScaleArray();this.imageScale_=[s[0]*this.pixelRatio_/i,s[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:Da(t||qa)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),r=i.getLineDashOffset(),s=i.getLineJoin(),o=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:$a,lineDash:n||Ba,lineDashOffset:r||0,lineJoin:void 0!==s?s:Ua,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:Da(t||Wa)}}else this.textStrokeState_=null;const n=t.getFont(),r=t.getOffsetX(),s=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),l=t.getScaleArray(),h=t.getText(),u=t.getTextAlign(),c=t.getTextBaseline();this.textState_={font:void 0!==n?n:za,textAlign:void 0!==u?u:Xa,textBaseline:void 0!==c?c:Va},this.text_=void 0!==h?Array.isArray(h)?h.reduce((t,e,i)=>t+(i%2?" ":e),""):h:"",this.textOffsetX_=void 0!==r?this.pixelRatio_*r:0,this.textOffsetY_=void 0!==s?this.pixelRatio_*s:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*l[0],this.pixelRatio_*l[1]]}else this.text_=""}},kp=.5;function Ap(t,e,i,n,r,s,o,a,l){const h=l?Oi(r):r,u=ur(t[0]*kp,t[1]*kp);u.imageSmoothingEnabled=!1;const c=u.canvas,d=new Rp(u,kp,r,null,o,a,l?Ei(ki(),l):null),f=i.length,p=Math.floor(16777215/f),g={};for(let t=1;t<=f;++t){const e=i[t-1],r=e.getStyleFunction()||n;if(!r)continue;let o=r(e,s);if(!o)continue;Array.isArray(o)||(o=[o]);const a=(t*p).toString(16).padStart(7,"#00000");for(let t=0,i=o.length;t<i;++t){const i=o[t],n=i.getGeometryFunction()(e);if(!n||!oe(h,n.getExtent()))continue;const r=i.clone(),s=r.getFill();s&&s.setColor(a);const l=r.getStroke();l&&(l.setColor(a),l.setLineDash(null)),r.setText(void 0);const u=i.getImage();if(u){const t=u.getImageSize();if(!t)continue;const e=ur(t[0],t[1],void 0,{alpha:!1}),i=e.canvas;e.fillStyle=a,e.fillRect(0,0,i.width,i.height),r.setImage(new ml({img:i,anchor:u.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:u.getOrigin(),opacity:1,size:u.getSize(),scale:u.getScale(),rotation:u.getRotation(),rotateWithView:u.getRotateWithView()}))}const c=r.getZIndex()||0;let d=g[c];d||(d={},g[c]=d,d.Polygon=[],d.Circle=[],d.LineString=[],d.Point=[]);const f=n.getType();if("GeometryCollection"===f){const t=n.getGeometriesArrayRecursive();for(let e=0,i=t.length;e<i;++e){const i=t[e];d[i.getType().replace("Multi","")].push(i,r)}}else d[f.replace("Multi","")].push(n,r)}}const m=Object.keys(g).map(Number).sort(S);for(let t=0,i=m.length;t<i;++t){const i=g[m[t]];for(const t in i){const n=i[t];for(let t=0,i=n.length;t<i;t+=2){d.setStyle(n[t+1]);for(let i=0,r=e.length;i<r;++i)d.setTransform(e[i]),d.drawGeometry(n[t])}}}return u.getImageData(0,0,c.width,c.height)}function Gp(t,e,i){const n=[];if(i){const r=Math.floor(Math.round(t[0])*kp),s=Math.floor(Math.round(t[1])*kp),o=4*(mt(r,0,i.width-1)+mt(s,0,i.height-1)*i.width),a=i.data[o],l=i.data[o+1],h=i.data[o+2]+256*(l+256*a),u=Math.floor(16777215/e.length);h&&h%u===0&&n.push(e[h/u-1])}return n}const Op={Point:function(t,e,i,n,r,s){const o=i.getImage(),a=i.getText(),l=a&&a.getText(),h=s&&o&&l?{}:void 0;if(o){if(2!=o.getImageState())return;const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(o,h),s.drawPoint(e,n,r)}if(l){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a,h),s.drawText(e,n,r)}},LineString:function(t,e,i,n,r){const s=i.getStroke();if(s){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawLineString(e,n,r)}const o=i.getText();if(o&&o.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,n,r)}},Polygon:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(s||o){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawPolygon(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}},MultiPoint:function(t,e,i,n,r,s){const o=i.getImage(),a=o&&0!==o.getOpacity(),l=i.getText(),h=l&&l.getText(),u=s&&a&&h?{}:void 0;if(a){if(2!=o.getImageState())return;const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(o,u),s.drawMultiPoint(e,n,r)}if(h){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(l,u),s.drawText(e,n,r)}},MultiLineString:function(t,e,i,n,r){const s=i.getStroke();if(s){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawMultiLineString(e,n,r)}const o=i.getText();if(o&&o.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,n,r)}},MultiPolygon:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(o||s){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawMultiPolygon(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}},GeometryCollection:function(t,e,i,n,r,s){const o=e.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a)(0,Op[o[a].getType()])(t,o[a],i,n,r,s)},Circle:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(s||o){const a=t.getBuilder(i.getZIndex(),"Circle");a.setFillStrokeStyle(s,o),a.drawCircle(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}}};function Fp(t,e){return parseInt(z(t),10)-parseInt(z(e),10)}function Lp(t,e){const i=jp(t,e);return i*i}function jp(t,e){return.5*t/e}function Np(t,e,i,n,r,s,o,a){const l=[],h=i.getImage();if(h){let t=!0;const e=h.getImageState();2==e||3==e?t=!1:0==e&&h.load(),t&&l.push(h.ready())}const u=i.getFill();u&&u.loading()&&l.push(u.ready());const c=l.length>0;return c&&Promise.all(l).then(()=>r(null)),function(t,e,i,n,r,s,o){const a=i.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(n,r);i.getRenderer()?Dp(t,l,i,e,o):(0,Op[l.getType()])(t,l,i,e,o,s)}(t,e,i,n,s,o,a),c}function Dp(t,e,i,n,r){if("GeometryCollection"==e.getType()){const s=e.getGeometries();for(let e=0,o=s.length;e<o;++e)Dp(t,s[e],i,n,r);return}t.getBuilder(i.getZIndex(),"Default").drawCustom(e,n,i.getRenderer(),i.getHitDetectionRenderer(),r)}const zp={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},qp={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]},$p=class extends $f{constructor(t,e){super(t,e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=[1,0,0,1,0,0],this.tileClipContexts_=null}enqueueTilesForNextExtent(){return"vector"!==this.getLayer().getRenderMode()}drawTile(t,e,i,n,r,s,o,a){this.updateExecutorGroup_(t,e.pixelRatio,e.viewState.projection),this.tileImageNeedsRender_(t)&&this.renderTileImage_(t,e),super.drawTile(t,e,i,n,r,s,o,a)}getTile(t,e,i,n){const r=this.getOrCreateTile(t,e,i,n);if(!r)return null;const s=n.viewState,o=s.resolution,a=n.viewHints,l=this.getLayer().getSource(),h=l.getTileGridForProjection(s.projection),u=!(a[0]||a[1]),c=h.getZForResolution(o,l.zDirection)===t;return u&&c?r.wantedResolution=o:r.wantedResolution||(r.wantedResolution=h.getResolution(t)),r}prepareFrame(t){const e=this.getLayer().getRevision();return this.renderedLayerRevision_!==e&&(this.renderedLayerRevision_=e,this.renderedTiles.length=0),super.prepareFrame(t)}updateExecutorGroup_(t,e,i){const n=this.getLayer(),r=n.getRevision(),s=n.getRenderOrder()||null,o=t.wantedResolution,a=t.getReplayState(n);if(!a.dirty&&a.renderedResolution===o&&a.renderedRevision==r&&a.renderedPixelRatio===e&&a.renderedRenderOrder==s)return;const l=n.getSource(),h=!!n.getDeclutter(),u=l.getTileGrid(),c=l.getTileGridForProjection(i).getTileCoordExtent(t.wrappedTileCoord),d=l.getSourceTiles(e,i,t),f=z(n);delete t.hitDetectionImageData[f],t.executorGroups[f]=[],a.dirty=!1;for(let r=0,p=d.length;r<p;++r){const p=d[r];if(2!=p.getState())continue;const g=l.getProjection(),m=p.tileCoord;let y=u.getTileCoordExtent(m);i&&g&&!Mi(i,g)&&(y=Ti(y,g,i,32));const _=ie(c,y),v=kt(_,n.getRenderBuffer()*o,this.tempExtent),x=$t(y,_)?null:v,w=new op(0,_,o,e),b=Lp(o,e),S=function(t,e){let i;const r=t.getStyleFunction()||n.getStyleFunction();if(r&&(i=r(t,o)),i){const n=this.renderFeature(t,b,i,w,h,e);a.dirty=a.dirty||n}},M=p.getFeatures();s&&s!==a.renderedRenderOrder&&M.sort(s);for(let t=0,e=M.length;t<e;++t){let e=M[t];i&&p.projection&&!Mi(i,p.projection)&&(e=e.clone(),e.getGeometry().applyTransform(Pi(p.projection,i))),x&&!oe(x,e.getGeometry().getExtent())||S.call(this,e,t)}const E=w.finish(),C="vector"!==n.getRenderMode()&&h&&1===d.length?null:_,P=new Tp(C,o,e,l.getOverlaps(),E,n.getRenderBuffer(),!0);t.executorGroups[f].push(P)}a.renderedRevision=r,a.renderedPixelRatio=e,a.renderedRenderOrder=s,a.renderedResolution=o}forEachFeatureAtCoordinate(t,e,i,n,r){const s=e.viewState.resolution,o=e.viewState.rotation;i=null==i?0:i;const a=this.getLayer(),l=a.getSource().getTileGridForProjection(e.viewState.projection),h=a.getRenderBuffer(),u=Rt([t]);kt(u,s*(h+i),u);const c={},d=function(t,e,i){let s=t.getId();void 0===s&&(s=z(t));const o=c[s];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return c[s]=!0,r.splice(r.lastIndexOf(o),1),n(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return c[s]=!0,n(t,a,e);r.push(c[s]={feature:t,layer:a,geometry:e,distanceSq:i,callback:n})}},f=this.renderedTiles,p=z(a),g=a.getDeclutter(),m=g?e.declutter?.[g]?.all().map(t=>t.value):null;let y;t:for(let e=f.length-1;e>=0;--e){const n=f[e];if(!oe(l.getTileCoordExtent(n.wrappedTileCoord),u))continue;const r=n.executorGroups[p];for(let e=0,n=r.length;e<n;++e)if(y=r[e].forEachFeatureAtCoordinate(t,s,o,i,d,m),y)break t}return y}getFeatures(t){return 0===this.renderedTiles.length?Promise.resolve([]):new Promise((e,i)=>{const n=this.getLayer(),r=n.getSource(),s=this.renderedProjection,o=s.getExtent(),a=this.renderedResolution,l=r.getTileGridForProjection(s),h=Wi(this.renderedPixelToCoordinateTransform_,t.slice()),u=l.getTileCoordForCoordAndResolution(h,a).toString(),c=this.renderedTiles.find(t=>t.tileCoord.toString()===u&&2===t.getState());if(!c||c.loadingSourceTiles>0)return void e([]);r.getWrapX()&&s.canWrapX()&&!Ft(o,l.getTileCoordExtent(c.tileCoord))&&de(h,s);const d=z(n),f=ne(l.getTileCoordExtent(c.wrappedTileCoord)),p=[(h[0]-f[0])/a,(f[1]-h[1])/a],g=c.getSourceTiles().reduce((t,e)=>t.concat(e.getFeatures()),[]);let m=c.hitDetectionImageData[d];if(!m){const t=ao(l.getTileSize(l.getZForResolution(a,r.zDirection))),e=this.renderedRotation_;m=Ap(t,[this.getRenderTransform(l.getTileCoordCenter(c.wrappedTileCoord),a,0,kp,t[0]*kp,t[1]*kp,0)],g,n.getStyleFunction(),l.getTileCoordExtent(c.wrappedTileCoord),c.getReplayState(n).renderedResolution,e),c.hitDetectionImageData[d]=m}e(Gp(p,g,m))})}getFeaturesInExtent(t){const e=[],i=this.getTileCache();if(0===i.getCount())return e;const n=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),r=n.getZForResolution(this.renderedResolution),s={};return i.forEach(i=>{if(i.tileCoord[0]!==r||2!==i.getState())return;const o=i.getSourceTiles();for(let i=0,r=o.length;i<r;++i){const r=o[i],a=r.getKey();if(a in s)continue;s[a]=!0;const l=r.tileCoord;if(oe(t,n.getTileCoordExtent(l))){const i=r.getFeatures();if(i)for(let n=0,r=i.length;n<r;++n){const r=i[n],s=r.getGeometry();oe(t,s.getExtent())&&e.push(r)}}}}),e}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&void 0!==this.renderedLayerRevision_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}renderDeclutter(t,e){const i=this.context,n=i.globalAlpha;i.globalAlpha=e.opacity;const r=t.viewHints,s=!(r[0]||r[1]),o=[this.context.canvas.width,this.context.canvas.height],a=this.getLayer().getDeclutter(),l=a?t.declutter?.[a]:void 0,h=z(this.getLayer()),u=this.renderedTiles;for(let e=0,i=u.length;e<i;++e){const i=u[e],n=i.executorGroups[h];if(n)for(let e=n.length-1;e>=0;--e)n[e].execute(this.context,o,this.getTileRenderTransform(i,t),t.viewState.rotation,s,Mp,l)}i.globalAlpha=n}renderDeferredInternal(t){const e=this.renderedTiles,i=z(this.getLayer()),n=e.reduce((t,e,n)=>(e.executorGroups[i].forEach(e=>t.push({executorGroup:e,index:n})),t),[]),r=n.map(({executorGroup:t})=>t.getDeferredZIndexContexts()),s={};for(let t=0,e=n.length;t<e;++t){const e=n[t].executorGroup.getDeferredZIndexContexts();for(const t in e)s[t]=!0}const o=Object.keys(s).map(Number).sort(S);this.layerExtent&&this.clipUnrotated(this.context,t,this.layerExtent),o.forEach(t=>{r.forEach((e,i)=>{e[t]&&(e[t].forEach(t=>{const{executorGroup:e,index:r}=n[i],s=e.getRenderedContext(),o=s.globalAlpha;s.globalAlpha=this.renderedOpacity_;const a=this.tileClipContexts_[r];a&&a.draw(s),t.draw(s),a&&s.restore(),s.globalAlpha=o,t.clear()}),e[t].length=0)})}),this.layerExtent&&this.context.restore()}getTileRenderTransform(t,e){const i=e.pixelRatio,n=e.viewState,r=n.center,s=n.resolution,o=n.rotation,a=e.size,l=Math.round(a[0]*i),h=Math.round(a[1]*i),u=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),c=t.tileCoord,d=u.getTileCoordExtent(t.wrappedTileCoord),f=u.getTileCoordExtent(c,this.tempExtent)[0]-d[0];return Bi(Xi(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(r,s,o,i,l,h,f))}postRender(t,e){const i=e.viewHints,n=!(i[0]||i[1]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation,this.renderedOpacity_=e.layerStatesArray[e.layerIndex].opacity;const r=this.getLayer(),s=r.getRenderMode(),o=t.globalAlpha;t.globalAlpha=this.renderedOpacity_;const a=r.getDeclutter(),l=a?qp[s].filter(t=>!Mp.includes(t)):qp[s],h=e.viewState,u=h.rotation;this.layerExtent&&this.clipUnrotated(t,e,this.layerExtent);const c=r.getSource(),d=c.getTileGridForProjection(h.projection).getZForResolution(h.resolution,c.zDirection),f=this.renderedTiles,p=[],g=[],m=[],y=z(r);let _=!0;for(let i=f.length-1;i>=0;--i){const s=f[i];_=_&&!s.getReplayState(r).dirty;const o=s.executorGroups[y].filter(t=>t.hasExecutors(l));if(0===o.length)continue;const h=this.getTileRenderTransform(s,e),c=s.tileCoord[0];let v=!1;const x=o[0].getClipCoords(h);let w,b=t;if(x){w=new Of,b=w.getContext();for(let t=0,e=p.length;t<e;++t)if(d!==c&&c<g[t]){const e=p[t];oe([x[0],x[3],x[4],x[7]],[e[0],e[3],e[4],e[7]])&&(v||(b.save(),v=!0),b.beginPath(),b.moveTo(x[0],x[1]),b.lineTo(x[2],x[3]),b.lineTo(x[4],x[5]),b.lineTo(x[6],x[7]),b.moveTo(e[6],e[7]),b.lineTo(e[4],e[5]),b.lineTo(e[2],e[3]),b.lineTo(e[0],e[1]),b.clip())}p.push(x),g.push(c)}for(let i=0,r=o.length;i<r;++i)o[i].execute(t,[t.canvas.width,t.canvas.height],h,u,n,l,e.declutter?.[a]);v&&(b===t?b.restore():m[i]=w)}this.layerExtent&&t.restore(),t.globalAlpha=o,this.ready=_,this.tileClipContexts_=m,e.declutter||this.renderDeferredInternal(e),super.postRender(t,e)}renderFeature(t,e,i,n,r,s){if(!i)return!1;let o=!1;if(Array.isArray(i))for(let a=0,l=i.length;a<l;++a)o=Np(n,t,i[a],e,this.boundHandleStyleImageChange_,void 0,r,s)||o;else o=Np(n,t,i,e,this.boundHandleStyleImageChange_,void 0,r,s);return o}tileImageNeedsRender_(t){const e=this.getLayer();if("vector"===e.getRenderMode())return!1;const i=t.getReplayState(e),n=e.getRevision(),r=t.wantedResolution;return i.renderedTileResolution!==r||i.renderedTileRevision!==n}renderTileImage_(t,e){const i=this.getLayer(),n=t.getReplayState(i),r=i.getRevision(),s=t.executorGroups[z(i)];n.renderedTileRevision=r;const o=t.wrappedTileCoord,a=o[0],l=i.getSource();let h=e.pixelRatio;const u=e.viewState.projection,c=l.getTileGridForProjection(u),d=c.getResolution(t.tileCoord[0]),f=e.pixelRatio/t.wantedResolution*d,p=c.getResolution(a),g=t.getContext();h=Math.round(Math.max(h,f/h));const m=l.getTilePixelSize(a,h,u);g.canvas.width=m[0],g.canvas.height=m[1];const y=h/f;if(1!==y){const t=$i(this.tmpTransform_);Xi(t,y,y),g.setTransform.apply(g,t)}const _=c.getTileCoordExtent(o,this.tempExtent),v=f/p,x=$i(this.tmpTransform_);Xi(x,v,-v),function(t,e,i){Bi(t,Ui(qi,1,0,0,1,e,i))}(x,-_[0],-_[3]);for(let t=0,e=s.length;t<e;++t)s[t].execute(g,[g.canvas.width*y,g.canvas.height*y],x,0,!0,zp[i.getRenderMode()],null);n.renderedTileResolution=t.wantedResolution}},Bp=class extends Hl{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload;const i=void 0===t.cacheSize?0:t.cacheSize;delete t.cacheSize,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i;const n=t.renderMode||"hybrid";ct("hybrid"==n||"vector"==n,"`renderMode` must be `'hybrid'` or `'vector'`"),this.renderMode_=n,this.setPreload(t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError),this.getBackground,this.setBackground}createRenderer(){return new $p(this,{cacheSize:this.cacheSize_})}getFeatures(t){return super.getFeatures(t)}getFeaturesInExtent(t){return this.getRenderer().getFeaturesInExtent(t)}getRenderMode(){return this.renderMode_}getPreload(){return this.get(Bf)}getUseInterimTilesOnError(){return this.get(Uf)}setPreload(t){this.set(Bf,t)}setUseInterimTilesOnError(t){this.set(Uf,t)}};class Up extends Error{constructor(t){super("Unexpected response status: "+t.status),this.name="ResponseError",this.response=t}}class Wp extends Error{constructor(t){super("Failed to issue request"),this.name="ClientError",this.client=t}}function Xp(t){return new Promise(function(e,i){const n=new XMLHttpRequest;n.addEventListener("load",function(t){const n=t.target;if(!n.status||n.status>=200&&n.status<300){let t;try{t=JSON.parse(n.responseText)}catch(t){const e="Error parsing response text as JSON: "+t.message;return void i(new Error(e))}return void e(t)}i(new Up(n))}),n.addEventListener("error",function(t){i(new Wp(t.target))}),n.open("GET",t),n.setRequestHeader("Accept","application/json"),n.send()})}function Vp(t,e){return e.includes("://")?e:new URL(e,t).href}const Kp=class extends qd{constructor(t){super({extent:t.extent,origin:t.origin,origins:t.origins,resolutions:t.resolutions,tileSize:t.tileSize,tileSizes:t.tileSizes,sizes:t.sizes}),this.matrixIds_=t.matrixIds}getMatrixId(t){return this.matrixIds_[t]}getMatrixIds(){return this.matrixIds_}},Yp={"image/png":!0,"image/jpeg":!0,"image/gif":!0,"image/webp":!0},Zp={"application/vnd.mapbox-vector-tile":!0,"application/geo+json":!0};function Hp(t,e){if(!e.length)return t;const i=new URL(t,"file:/");if(i.pathname.split("/").includes("collections"))return be('The "collections" query parameter cannot be added to collection endpoints'),t;const n=e.map(t=>encodeURIComponent(t)).join(",");return i.searchParams.append("collections",n),`${t.split("?")[0]}?${decodeURIComponent(i.searchParams.toString())}`}function Jp(t,e,i,n){let r=t.projection;if(!r&&("string"==typeof e.crs?r=_i(e.crs):"uri"in e.crs&&(r=_i(e.crs.uri)),!r))throw new Error(`Unsupported CRS: ${JSON.stringify(e.crs)}`);const s=e.orderedAxes,o=!(s?s.slice(0,2).map(t=>t.replace(/E|X|Lon/i,"e").replace(/N|Y|Lat/i,"n")).join(""):r.getAxisOrientation()).startsWith("en"),a=e.tileMatrices.sort(function(t,e){return e.cellSize-t.cellSize}),l={};for(let t=0;t<a.length;++t){const e=a[t];l[e.id]=e}const h={},u=[];if(n)for(let t=0;t<n.length;++t){const e=n[t],i=e.tileMatrix,r=l[i],s=a.indexOf(r);u[s]=i,h[i]=e}else for(let t=0;t<a.length;++t){const e=a[t].id;u.push(e)}const c=u.length,d=new Array(c),f=new Array(c),p=new Array(c),g=new Array(c),m=[-1/0,-1/0,1/0,1/0];for(let t=0;t<c;++t){const e=u[t],i=l[e],n=i.pointOfOrigin;d[t]=o?[n[1],n[0]]:n,f[t]=i.cellSize,p[t]=[i.matrixWidth,i.matrixHeight],g[t]=[i.tileWidth,i.tileHeight];const r=h[e];if(r){const e=i.cellSize*i.tileWidth,n=d[t][0]+r.minTileCol*e,s=d[t][0]+(r.maxTileCol+1)*e,o=i.cellSize*i.tileHeight;let a,l;"bottomLeft"===i.cornerOfOrigin?(a=d[t][1]+r.minTileRow*o,l=d[t][1]+(r.maxTileRow+1)*o):(a=d[t][1]-(r.maxTileRow+1)*o,l=d[t][1]-r.minTileRow*o),ie(m,[n,a,s,l],m)}}const y=new Kp({origins:d,resolutions:f,sizes:p,tileSizes:g,extent:n?m:void 0,matrixIds:u});if(!i)return{grid:y,projection:r};const _=t.context,v=t.url;return{grid:y,projection:r,urlTemplate:i,urlFunction:function(t,e,r){if(!t)return;const s=u[t[0]],o=l[s],a="bottomLeft"===o.cornerOfOrigin,c={tileMatrix:s,tileCol:t[1],tileRow:a?-t[2]-1:t[2]};if(n){const t=h[o.id];if(c.tileCol<t.minTileCol||c.tileCol>t.maxTileCol||c.tileRow<t.minTileRow||c.tileRow>t.maxTileRow)return}Object.assign(c,{z:c.tileMatrix,x:c.tileCol,y:c.tileRow},_);const d=i.replace(/\{(\w+?)\}/g,function(t,e){return c[e]});return Vp(v,d)}}}const Qp=class extends Pf{constructor(t){var e;super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,format:t.format,overlaps:t.overlaps,projection:t.projection,tileClass:t.tileClass,transition:t.transition,wrapX:t.wrapX,zDirection:t.zDirection,state:"loading"}),(e={url:t.url,projection:this.getProjection(),mediaType:t.mediaType,supportedMediaTypes:t.format.supportedMediaTypes,context:t.context||null,collections:t.collections},Xp(e.url).then(function(t){return function(t,e){const i=e.tileMatrixSetLimits;let n;if("map"===e.dataType)n=function(t,e,i){let n,r;for(let i=0;i<t.length;++i){const s=t[i];if("item"===s.rel){if(s.type===e){n=s.href;break}(Yp[s.type]||!r&&s.type.startsWith("image/"))&&(r=s.href)}}if(!n){if(!r)throw new Error('Could not find "item" link');n=r}return i&&(n=Hp(n,i)),n}(e.links,t.mediaType,t.collections);else{if("vector"!==e.dataType)throw new Error('Expected tileset data type to be "map" or "vector"');n=function(t,e,i,n){let r,s;const o={};for(let i=0;i<t.length;++i){const n=t[i];if(o[n.type]=n.href,"item"===n.rel){if(n.type===e){r=n.href;break}Zp[n.type]&&(s=n.href)}}if(!r&&i)for(let t=0;t<i.length;++t){const e=i[t];if(o[e]){r=o[e];break}}if(!r){if(!s)throw new Error('Could not find "item" link');r=s}return n&&(r=Hp(r,n)),r}(e.links,t.mediaType,t.supportedMediaTypes,t.collections)}if(e.tileMatrixSet)return Jp(t,e.tileMatrixSet,n,i);const r=e.links.find(t=>"http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme"===t.rel);if(!r)throw new Error("Expected http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme link or tileMatrixSet");const s=r.href;return Xp(Vp(t.url,s)).then(function(e){return Jp(t,e,n,i)})}(e,t)})).then(this.handleTileSetInfo_.bind(this)).catch(this.handleError_.bind(this))}handleTileSetInfo_(t){this.tileGrid=t.grid,this.projection=t.projection,this.setTileUrlFunction(t.urlFunction,t.urlTemplate),this.setState("ready")}handleError_(t){be(t),this.setState("error")}},tg=4294967296,eg=1/tg,ig="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class ng{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,e,i=this.length){for(;this.pos<i;){const i=this.readVarint(),n=i>>3,r=this.pos;this.type=7&i,t(n,e,this),this.pos===r&&this.skip(i)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*tg;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*tg;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let i,n;return n=e[this.pos++],i=127&n,n<128?i:(n=e[this.pos++],i|=(127&n)<<7,n<128?i:(n=e[this.pos++],i|=(127&n)<<14,n<128?i:(n=e[this.pos++],i|=(127&n)<<21,n<128?i:(n=e[this.pos],i|=(15&n)<<28,function(t,e,i){const n=i.buf;let r,s;if(s=n[i.pos++],r=(112&s)>>4,s<128)return rg(t,r,e);if(s=n[i.pos++],r|=(127&s)<<3,s<128)return rg(t,r,e);if(s=n[i.pos++],r|=(127&s)<<10,s<128)return rg(t,r,e);if(s=n[i.pos++],r|=(127&s)<<17,s<128)return rg(t,r,e);if(s=n[i.pos++],r|=(127&s)<<24,s<128)return rg(t,r,e);if(s=n[i.pos++],r|=(1&s)<<31,s<128)return rg(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(i,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&ig?ig.decode(this.buf.subarray(e,t)):function(t,e,i){let n="",r=e;for(;r<i;){const e=t[r];let s,o,a,l=null,h=e>239?4:e>223?3:e>191?2:1;if(r+h>i)break;1===h?e<128&&(l=e):2===h?(s=t[r+1],128==(192&s)&&(l=(31&e)<<6|63&s,l<=127&&(l=null))):3===h?(s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&(l=(15&e)<<12|(63&s)<<6|63&o,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===h&&(s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&e)<<18|(63&s)<<12|(63&o)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,h=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),r+=h}return n}(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(t){const e=7&t;if(0===e)for(;this.buf[this.pos++]>127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else{if(1!==e)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e<this.pos+t;)e*=2;if(e!==this.length){const t=new Uint8Array(e);t.set(this.buf),this.buf=t,this.dataView=new DataView(t.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*eg),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*eg),!0),this.pos+=8}writeVarint(t){(t=+t||0)>268435455||t<0?function(t,e){let i,n;if(t>=0?(i=t%4294967296|0,n=t/4294967296|0):(i=~(-t%4294967296),n=~(-t/4294967296),4294967295^i?i=i+1|0:(i=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,e),function(t,e){const i=(7&t)<<4;e.buf[e.pos++]|=i|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))}writeSVarint(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const e=this.pos;this.pos=function(t,e,i){for(let n,r,s=0;s<e.length;s++){if(n=e.charCodeAt(s),n>55295&&n<57344){if(!r){n>56319||s+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);const i=this.pos-e;i>=128&&sg(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let i=0;i<e;i++)this.buf[this.pos++]=t[i]}writeRawMessage(t,e){this.pos++;const i=this.pos;t(e,this);const n=this.pos-i;n>=128&&sg(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n}writeMessage(t,e,i){this.writeTag(t,2),this.writeRawMessage(e,i)}writePackedVarint(t,e){e.length&&this.writeMessage(t,og,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,ag,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,ug,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,lg,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,hg,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,cg,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,dg,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,fg,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,pg,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}}function rg(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function sg(t,e,i){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(let e=i.pos-1;e>=t;e--)i.buf[e+n]=i.buf[e]}function og(t,e){for(let i=0;i<t.length;i++)e.writeVarint(t[i])}function ag(t,e){for(let i=0;i<t.length;i++)e.writeSVarint(t[i])}function lg(t,e){for(let i=0;i<t.length;i++)e.writeFloat(t[i])}function hg(t,e){for(let i=0;i<t.length;i++)e.writeDouble(t[i])}function ug(t,e){for(let i=0;i<t.length;i++)e.writeBoolean(t[i])}function cg(t,e){for(let i=0;i<t.length;i++)e.writeFixed32(t[i])}function dg(t,e){for(let i=0;i<t.length;i++)e.writeSFixed32(t[i])}function fg(t,e){for(let i=0;i<t.length;i++)e.writeFixed64(t[i])}function pg(t,e){for(let i=0;i<t.length;i++)e.writeSFixed64(t[i])}function gg(t,e,i,n,r,s,o){let a,l;const h=(i-e)/n;if(1===h)a=e;else if(2===h)a=e,l=r;else if(0!==h){let s=t[e],o=t[e+1],h=0;const u=[0];for(let r=e+n;r<i;r+=n){const e=t[r],i=t[r+1];h+=Math.sqrt((e-s)*(e-s)+(i-o)*(i-o)),u.push(h),s=e,o=i}const c=r*h,d=function(t,e,i){let n,r;i=i||S;let s=0,o=t.length,a=!1;for(;s<o;)n=s+(o-s>>1),r=+i(t[n],e),r<0?s=n+1:(o=n,a=!r);return a?s:~s}(u,c);d<0?(l=(c-u[-d-2])/(u[-d-1]-u[-d-2]),a=e+(-d-2)*n):a=e+d*n}o=o>1?o:2,s=s||new Array(o);for(let e=0;e<o;++e)s[e]=void 0===a?NaN:void 0===l?t[a+e]:bt(t[a+e],t[a+n+e],l);return s}function mg(t,e,i,n,r,s){if(i==e)return null;let o;if(r<t[e+n-1])return s?(o=t.slice(e,e+n),o[n-1]=r,o):null;if(t[i-1]<r)return s?(o=t.slice(i-n,i),o[n-1]=r,o):null;if(r==t[e+n-1])return t.slice(e,e+n);let a=e/n,l=i/n;for(;a<l;){const e=a+l>>1;r<t[(e+1)*n-1]?l=e:a=e+1}const h=t[a*n-1];if(r==h)return t.slice((a-1)*n,(a-1)*n+n);const u=(r-h)/(t[(a+1)*n-1]-h);o=[];for(let e=0;e<n-1;++e)o.push(bt(t[(a-1)*n+e],t[a*n+e],u));return o.push(r),o}class yg extends sn{constructor(t,e){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}appendCoordinate(t){P(this.flatCoordinates,t),this.changed()}clone(){const t=new yg(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Gt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(hn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),cn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,n))}forEachSegment(t){return Gn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinateAtM(t,e){return"XYM"!=this.layout&&"XYZM"!=this.layout?null:(e=void 0!==e&&e,mg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return mn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return gg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return ap(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const e=[];return e.length=vn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new yg(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return On(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,this.getExtent())}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=fn(this.flatCoordinates,0,t,this.stride),this.changed()}}const _g=yg;class vg extends sn{constructor(t,e,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(void 0!==e&&i)this.setFlatCoordinates(e,t),this.ends_=i;else{const e=t,i=[],n=[];for(let t=0,r=e.length;t<r;++t)P(i,e[t].getFlatCoordinates()),n.push(i.length);const r=0===e.length?this.getLayout():e[0].getLayout();this.setFlatCoordinates(r,i),this.ends_=n}}appendLineString(t){P(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new vg(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Gt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(un(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),dn(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,i,n))}getCoordinateAtM(t,e,i){return"XYM"!=this.layout&&"XYZM"!=this.layout||0===this.flatCoordinates.length?null:(e=void 0!==e&&e,i=void 0!==i&&i,function(t,e,i,n,r,s,o){if(o)return mg(t,e,i[i.length-1],n,r,s);let a;if(r<t[n-1])return s?(a=t.slice(0,n),a[n-1]=r,a):null;if(t[t.length-1]<r)return s?(a=t.slice(t.length-n),a[n-1]=r,a):null;for(let s=0,o=i.length;s<o;++s){const o=i[s];if(e!=o){if(r<t[e+n-1])return null;if(r<=t[o-1])return mg(t,e,o,n,r,!1);e=o}}return null}(this.flatCoordinates,0,this.ends_,this.stride,t,e,i))}getCoordinates(){return yn(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new _g(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,e=this.ends_,i=this.layout,n=[];let r=0;for(let s=0,o=e.length;s<o;++s){const o=e[s],a=new _g(t.slice(r,o),i);n.push(a),r=o}return n}getLength(){const t=this.ends_;let e=0,i=0;for(let n=0,r=t.length;n<r;++n)i+=ap(this.flatCoordinates,e,t[n],this.stride),e=t[n];return i}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let i=0;const n=this.ends_,r=this.stride;for(let s=0,o=n.length;s<o;++s){const o=n[s];P(t,gg(e,i,o,r,.5)),i=o}return t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=xn(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,i),new vg(e,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(t){return function(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){if(On(t,e,i[s],n,r))return!0;e=i[s]}return!1}(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=pn(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}const xg=vg;class wg extends sn{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){P(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new wg(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<Gt(this.getExtent(),t,e))return n;const r=this.flatCoordinates,s=this.stride;for(let o=0,a=r.length;o<a;o+=s){const a=_t(t,e,r[o],r[o+1]);if(a<n){n=a;for(let t=0;t<s;++t)i[t]=r[o+t];i.length=s}}return n}getCoordinates(){return mn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new Pn(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,i=this.stride,n=[];for(let r=0,s=t.length;r<s;r+=i){const s=new Pn(t.slice(r,r+i),e);n.push(s)}return n}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,i=this.stride;for(let n=0,r=e.length;n<r;n+=i)if(Lt(t,e[n],e[n+1]))return!0;return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=fn(this.flatCoordinates,0,t,this.stride),this.changed()}}const bg=wg;function Sg(t,e,i,n){const r=[];let s=[1/0,1/0,-1/0,-1/0];for(let o=0,a=i.length;o<a;++o){const a=i[o];s=qt(t,e,a[0],n),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),e=a[a.length-1]}return r}class Mg extends sn{constructor(t,e,i){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!i&&!Array.isArray(t[0])){const n=t,r=[],s=[];for(let t=0,e=n.length;t<e;++t){const e=n[t],i=r.length,o=e.getEnds();for(let t=0,e=o.length;t<e;++t)o[t]+=i;P(r,e.getFlatCoordinates()),s.push(o)}e=0===n.length?this.getLayout():n[0].getLayout(),t=r,i=s}void 0!==e&&i?(this.setFlatCoordinates(e,t),this.endss_=i):this.setCoordinates(t,e)}appendPolygon(t){let e;if(this.flatCoordinates){const i=this.flatCoordinates.length;P(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let t=0,n=e.length;t<n;++t)e[t]+=i}else this.flatCoordinates=t.getFlatCoordinates().slice(),e=t.getEnds().slice(),this.endss_.push();this.endss_.push(e),this.changed()}clone(){const t=this.endss_.length,e=new Array(t);for(let i=0;i<t;++i)e[i]=this.endss_[i].slice();const i=new Mg(this.flatCoordinates.slice(),this.layout,e);return i.applyProperties(this),i}closestPointXY(t,e,i,n){return n<Gt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(function(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];r=un(t,e,o,n,r),e=o[o.length-1]}return r}(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),function(t,e,i,n,r,s,o,a,l,h,u){u=u||[NaN,NaN];for(let s=0,c=i.length;s<c;++s){const c=i[s];h=dn(t,e,c,n,r,true,o,a,l,h,u),e=c[c.length-1]}return h}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,0,t,e,i,n))}containsXY(t,e){return function(t,e,i,n,r,s){if(0===i.length)return!1;for(let o=0,a=i.length;o<a;++o){const a=i[o];if(Rn(t,e,a,n,r,s))return!0;e=a[a.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return function(t,e,i,n){let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s];r+=an(t,e,o,n),e=o[o.length-1]}return r}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),$n(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,_n(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=Sg(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=An(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new bg(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;zn(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=$n(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=function(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l],u=[];o=Sn(t,e,h,n,r,s,o,u),a.push(u),e=h[h.length-1]}return o}(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new Mg(e,"XY",i)}getPolygon(t){if(t<0||this.endss_.length<=t)return null;let e;if(0===t)e=0;else{const i=this.endss_[t-1];e=i[i.length-1]}const i=this.endss_[t].slice(),n=i[i.length-1];if(0!==e)for(let t=0,n=i.length;t<n;++t)i[t]-=e;return new Wn(this.flatCoordinates.slice(e,n),this.layout,i)}getPolygons(){const t=this.layout,e=this.flatCoordinates,i=this.endss_,n=[];let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s].slice(),a=o[o.length-1];if(0!==r)for(let t=0,e=o.length;t<e;++t)o[t]-=r;const l=new Wn(e.slice(r,a),t,o);n.push(l),r=a}return n}getType(){return"MultiPolygon"}intersectsExtent(t){return function(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];if(Ln(t,e,o,n,r))return!0;e=o[o.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=gn(this.flatCoordinates,0,t,this.stride,this.endss_);if(0===i.length)this.flatCoordinates.length=0;else{const t=i[i.length-1];this.flatCoordinates.length=0===t.length?0:t[t.length-1]}this.changed()}}const Eg=Mg,Cg=[1,0,0,1,0,0];class Pg{constructor(t,e,i,n,r,s){this.styleFunction,this.extent_,this.id_=s,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=r,this.squaredTolerance_,this.stride_=n,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?zt(this.flatCoordinates_):qt(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=Ht(this.getExtent());this.flatInteriorPoints_=kn(this.flatCoordinates_,0,this.ends_,this.stride_,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=Bn(this.flatCoordinates_,this.ends_),e=Sg(this.flatCoordinates_,0,t,this.stride_);this.flatInteriorPoints_=An(this.flatCoordinates_,0,t,this.stride_,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=gg(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let n=0,r=i.length;n<r;++n){const r=i[n],s=gg(t,e,r,this.stride_,.5);P(this.flatMidpoints_,s),e=r}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){const e=(t=_i(t)).getExtent(),i=t.getWorldExtent();if(e&&i){const t=ee(i)/ee(e);Vi(Cg,i[0],i[3],t,-t,0,0,0),Hi(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,Cg,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new Pg(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=A((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let n;switch(this.type_){case"LineString":i.length=vn(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),n=[i.length];break;case"MultiLineString":n=[],i.length=xn(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,n);break;case"Polygon":n=[],i.length=Sn(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,n)}return n&&(this.simplifiedGeometry_=new Pg(this.type_,i,n,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}Pg.prototype.getFlatCoordinates=Pg.prototype.getOrientedFlatCoordinates;const Ig=Pg;class Tg extends ${constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if("function"==typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new Tg,e=this.geometryName_;t.setGeometryName(e);const i=this.getPropertiesInternal();if(i){const n=this.getGeometry();for(const r in i)r===e&&n?t.set(r,n.clone()):t.set(r,i[r],!0)}const n=this.getStyle();return n&&t.setStyle(n),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(p(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=d(t,g,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?function(t){if("function"==typeof t)return t;let e;return Array.isArray(t)?e=t:(ct("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[t]),function(){return e}}(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){t!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}}const Rg=Tg;class kg extends en{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(p),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,i=t.length;e<i;++e)this.changeEventsKeys_.push(d(t[e],g,this.changed,this))}clone(){const t=new kg(Ag(this.geometries_));return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<Gt(this.getExtent(),t,e))return n;const r=this.geometries_;for(let s=0,o=r.length;s<o;++s)n=r[s].closestPointXY(t,e,i,n);return n}containsXY(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)if(i[n].containsXY(t,e))return!0;return!1}computeExtent(t){Dt(t);const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)Bt(t,e[i].getExtent());return t}getGeometries(){return Ag(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].getType()===this.getType()?t=t.concat(e[i].getGeometriesArrayRecursive()):t.push(e[i]);return t}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=[],i=this.geometries_;let n=!1;for(let r=0,s=i.length;r<s;++r){const s=i[r],o=s.getSimplifiedGeometry(t);e.push(o),o!==s&&(n=!0)}return n?new kg(e):(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getType(){return"GeometryCollection"}intersectsExtent(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)if(e[i].intersectsExtent(t))return!0;return!1}isEmpty(){return 0===this.geometries_.length}rotate(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)i[n].rotate(t,e);this.changed()}scale(t,e,i){i||(i=Ht(this.getExtent()));const n=this.geometries_;for(let r=0,s=n.length;r<s;++r)n[r].scale(t,e,i);this.changed()}setGeometries(t){this.setGeometriesArray(Ag(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].applyTransform(t);this.changed()}translate(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)i[n].translate(t,e);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function Ag(t){return t.map(t=>t.clone())}const Gg=kg,Og=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Rg,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let i=e.dataProjection?_i(e.dataProjection):this.readProjection(t);e.extent&&i&&"tile-pixels"===i.getUnits()&&(i=_i(i),i.setWorldExtent(e.extent)),e={dataProjection:i,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return N()}readFeature(t,e){return N()}readFeatures(t,e){return N()}readGeometry(t,e){return N()}readProjection(t){return N()}writeFeature(t,e){return N()}writeFeatures(t,e){return N()}writeGeometry(t,e){return N()}};function Fg(t,e,i){const n=i?_i(i.featureProjection):null,r=i?_i(i.dataProjection):null;let s=t;if(n&&r&&!Mi(n,r)){e&&(s=t.clone());const i=e?n:r,o=e?r:n;"tile-pixels"===i.getUnits()?s.transform(i,o):s.applyTransform(Pi(i,o))}if(e&&i&&void 0!==i.decimals){const e=Math.pow(10,i.decimals),n=function(t){for(let i=0,n=t.length;i<n;++i)t[i]=Math.round(t[i]*e)/e;return t};s===t&&(s=t.clone()),s.applyTransform(n)}return s}const Lg={Point:Pn,LineString:_g,Polygon:Wn,MultiPoint:bg,MultiLineString:xg,MultiPolygon:Eg};function jg(t,e){const i=t.geometry;if(!i)return[];if(Array.isArray(i))return i.map(e=>jg({...t,geometry:e})).flat();const n="MultiPolygon"===i.type?"Polygon":i.type;if("GeometryCollection"===n||"Circle"===n)throw new Error("Unsupported geometry type: "+n);const r=i.layout.length;return Fg(new Ig(n,"Polygon"===n?function(t,e,i){return Array.isArray(e[0])?(zn(t,0,e,i)||$n(t=t.slice(),0,e,i),t):(Dn(t,0,e,i)||qn(t=t.slice(),0,e,i),t)}(i.flatCoordinates,i.ends,r):i.flatCoordinates,i.ends?.flat(),r,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function Ng(t,e){if(!t)return null;if(Array.isArray(t)){const i=t.map(t=>Ng(t,e));return new Gg(i)}return Fg(new(0,Lg[t.type])(t.flatCoordinates,t.layout||"XY",t.ends),!1,e)}function Dg(t,e,i){if(3===t){const t={keys:[],values:[],features:[]},n=i.readVarint()+i.pos;i.readFields(zg,t,n),t.length=t.features.length,t.length&&(e[t.name]=t)}}function zg(t,e,i){if(15===t)e.version=i.readVarint();else if(1===t)e.name=i.readString();else if(5===t)e.extent=i.readVarint();else if(2===t)e.features.push(i.pos);else if(3===t)e.keys.push(i.readString());else if(4===t){let n=null;const r=i.readVarint()+i.pos;for(;i.pos<r;)n=1==(t=i.readVarint()>>3)?i.readString():2===t?i.readFloat():3===t?i.readDouble():4===t?i.readVarint64():5===t?i.readVarint():6===t?i.readSVarint():7===t?i.readBoolean():null;e.values.push(n)}}function qg(t,e,i){if(1==t)e.id=i.readVarint();else if(2==t){const t=i.readVarint()+i.pos;for(;i.pos<t;){const t=e.layer.keys[i.readVarint()],n=e.layer.values[i.readVarint()];e.properties[t]=n}}else 3==t?e.type=i.readVarint():4==t&&(e.geometry=i.pos)}function $g(t,e,i){t.pos=e.features[i];const n=t.readVarint()+t.pos,r={layer:e,type:0,properties:{}};return t.readFields(qg,r,n),r}const Bg=class extends Og{constructor(t){super(),t=t||{},this.dataProjection=new Me({code:"",units:"tile-pixels"}),this.featureClass=t.featureClass?t.featureClass:Ig,this.geometryName_=t.geometryName,this.layerName_=t.layerName?t.layerName:"layer",this.layers_=t.layers?t.layers:null,this.idProperty_=t.idProperty,this.supportedMediaTypes=["application/vnd.mapbox-vector-tile","application/x-protobuf"]}readRawGeometry_(t,e,i,n){t.pos=e.geometry;const r=t.readVarint()+t.pos;let s=1,o=0,a=0,l=0,h=0,u=0;for(;t.pos<r;){if(!o){const e=t.readVarint();s=7&e,o=e>>3}if(o--,1===s||2===s)a+=t.readSVarint(),l+=t.readSVarint(),1===s&&h>u&&(n.push(h),u=h),i.push(a,l),h+=2;else{if(7!==s)throw new Error("Invalid command found in the PBF");h>u&&(i.push(i[u],i[u+1]),h+=2)}}h>u&&(n.push(h),u=h)}createFeature_(t,e,i){const n=e.type;if(0===n)return null;let r;const s=e.properties;let o;this.idProperty_?(o=s[this.idProperty_],delete s[this.idProperty_]):o=e.id,s[this.layerName_]=e.layer.name;const a=[],l=[];this.readRawGeometry_(t,e,a,l);const h=function(t,e){let i;return 1===t?i=1===e?"Point":"MultiPoint":2===t?i=1===e?"LineString":"MultiLineString":3===t&&(i="Polygon"),i}(n,l.length);if(this.featureClass===Ig)r=new this.featureClass(h,a,l,2,s,o),r.transform(i.dataProjection);else{let t;if("Polygon"==h){const e=Bn(a,l);t=e.length>1?new Eg(a,"XY",e):new Wn(a,"XY",l)}else t="Point"===h?new Pn(a,"XY"):"LineString"===h?new _g(a,"XY"):"MultiPoint"===h?new bg(a,"XY"):"MultiLineString"===h?new xg(a,"XY",l):null;r=new(0,this.featureClass),this.geometryName_&&r.setGeometryName(this.geometryName_);const e=Fg(t,!1,i);r.setGeometry(e),void 0!==o&&r.setId(o),r.setProperties(s,!0)}return r}getType(){return"arraybuffer"}readFeatures(t,e){const i=this.layers_,n=_i((e=this.adaptOptions(e)).dataProjection);n.setWorldExtent(e.extent),e.dataProjection=n;const r=new ng(t),s=r.readFields(Dg,{}),o=[];for(const t in s){if(i&&!i.includes(t))continue;const a=s[t],l=a?[0,0,a.extent,a.extent]:null;n.setExtent(l);for(let t=0,i=a.length;t<i;++t){const i=$g(r,a,t),n=this.createFeature_(r,i,e);null!==n&&o.push(n)}}return o}readProjection(t){return this.dataProjection}setLayers(t){this.layers_=t}};function Ug(t){if("string"==typeof t){return JSON.parse(t)||null}return null!==t?t:null}const Wg=class extends Og{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(Ug(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(Ug(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return N()}readFeaturesFromObject(t,e){return N()}readGeometry(t,e){return this.readGeometryFromObject(Ug(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return N()}readProjection(t){return this.readProjectionFromObject(Ug(t))}readProjectionFromObject(t){return N()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return N()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return N()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return N()}};function Xg(t,e){if(!t)return null;let i;switch(t.type){case"Point":i=function(t){const e=t.coordinates;return{type:"Point",flatCoordinates:e,layout:nn(e.length)}}(t);break;case"LineString":i=function(t){const e=t.coordinates,i=e.flat();return{type:"LineString",flatCoordinates:i,ends:[i.length],layout:nn(e[0]?.length||2)}}(t);break;case"Polygon":i=function(t){const e=t.coordinates,i=[],n=e[0]?.[0]?.length;return{type:"Polygon",flatCoordinates:i,ends:pn(i,0,e,n),layout:nn(n)}}(t);break;case"MultiPoint":i=function(t){const e=t.coordinates;return{type:"MultiPoint",flatCoordinates:e.flat(),layout:nn(e[0]?.length||2)}}(t);break;case"MultiLineString":i=function(t){const e=t.coordinates,i=e[0]?.[0]?.length||2,n=[];return{type:"MultiLineString",flatCoordinates:n,ends:pn(n,0,e,i),layout:nn(i)}}(t);break;case"MultiPolygon":i=function(t){const e=t.coordinates,i=[],n=e[0]?.[0]?.[0].length||2;return{type:"MultiPolygon",flatCoordinates:i,ends:gn(i,0,e,n),layout:nn(n)}}(t);break;case"GeometryCollection":i=function(t){const e=t.geometries.map(function(t){return Xg(t)});return e}(t);break;default:throw new Error("Unsupported GeoJSON type: "+t.type)}return i}function Vg(t,e){const i=(t=Fg(t,!0,e)).getType();let n;switch(i){case"Point":n=function(t){return{type:"Point",coordinates:t.getCoordinates()}}(t);break;case"LineString":n=function(t){return{type:"LineString",coordinates:t.getCoordinates()}}(t);break;case"Polygon":n=function(t,e){let i;return e&&(i=e.rightHanded),{type:"Polygon",coordinates:t.getCoordinates(i)}}(t,e);break;case"MultiPoint":n=function(t){return{type:"MultiPoint",coordinates:t.getCoordinates()}}(t);break;case"MultiLineString":n=function(t){return{type:"MultiLineString",coordinates:t.getCoordinates()}}(t);break;case"MultiPolygon":n=function(t,e){let i;return e&&(i=e.rightHanded),{type:"MultiPolygon",coordinates:t.getCoordinates(i)}}(t,e);break;case"GeometryCollection":n=function(t,e){delete(e=Object.assign({},e)).featureProjection;return{type:"GeometryCollection",geometries:t.getGeometriesArray().map(function(t){return Vg(t,e)})}}(t,e);break;case"Circle":n={type:"GeometryCollection",geometries:[]};break;default:throw new Error("Unsupported geometry type: "+i)}return n}const Kg=class extends Wg{constructor(t){t=t||{},super(),this.dataProjection=_i(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=_i(t.featureProjection)),t.featureClass&&(this.featureClass=t.featureClass),this.geometryName_=t.geometryName,this.extractGeometryName_=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,e){let i=null;i="Feature"===t.type?t:{type:"Feature",geometry:t,properties:null};const n=Xg(i.geometry);if(this.featureClass===Ig)return jg({geometry:n,id:i.id,properties:i.properties},e);const r=new Rg;return this.geometryName_?r.setGeometryName(this.geometryName_):this.extractGeometryName_&&i.geometry_name&&r.setGeometryName(i.geometry_name),r.setGeometry(Ng(n,e)),"id"in i&&r.setId(i.id),i.properties&&r.setProperties(i.properties,!0),r}readFeaturesFromObject(t,e){let i=null;if("FeatureCollection"===t.type){i=[];const n=t.features;for(let t=0,r=n.length;t<r;++t){const r=this.readFeatureFromObject(n[t],e);r&&i.push(r)}}else i=[this.readFeatureFromObject(t,e)];return i.flat()}readGeometryFromObject(t,e){return function(t,e){return Ng(Xg(t),e)}(t,e)}readProjectionFromObject(t){const e=t.crs;let i;if(e)if("name"==e.type)i=_i(e.properties.name);else{if("EPSG"!==e.type)throw new Error("Unknown SRS type");i=_i("EPSG:"+e.properties.code)}else i=this.dataProjection;return i}writeFeatureObject(t,e){e=this.adaptOptions(e);const i={type:"Feature",geometry:null,properties:null},n=t.getId();if(void 0!==n&&(i.id=n),!t.hasProperties())return i;const r=t.getProperties(),s=t.getGeometry();return s&&(i.geometry=Vg(s,e),delete r[t.getGeometryName()]),c(r)||(i.properties=r),i}writeFeaturesObject(t,e){e=this.adaptOptions(e);const i=[];for(let n=0,r=t.length;n<r;++n)i.push(this.writeFeatureObject(t[n],e));return{type:"FeatureCollection",features:i}}writeGeometryObject(t,e){return Vg(t,this.adaptOptions(e))}},Yg=class extends Nf{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=[1/0,1/0,-1/0,-1/0],this.wrappedRenderedExtent_=[1/0,1/0,-1/0,-1/0],this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,i){const n=e.extent,r=e.viewState,s=r.center,o=r.resolution,a=r.projection,l=r.rotation,h=a.getExtent(),u=this.getLayer().getSource(),c=this.getLayer().getDeclutter(),d=e.pixelRatio,f=e.viewHints,p=!(f[0]||f[1]),g=this.context,m=Math.round(se(n)/o*d),y=Math.round(ee(n)/o*d),_=u.getWrapX()&&a.canWrapX(),v=_?se(h):null,x=_?Math.ceil((n[2]-h[2])/v)+(this.extendX_?2:1):1;let w=_?Math.floor((n[0]-h[0])/v)-(this.extendX_?1:0):0;do{let n=this.getRenderTransform(s,o,0,d,m,y,w*v);e.declutter&&(n=n.slice(0)),t.execute(g,[g.canvas.width,g.canvas.height],n,l,p,void 0===i?Sp:i?Mp:Ep,i?c&&e.declutter[c]:void 0)}while(++w<x)}setDrawContext_(){1!==this.opacity_&&(this.targetContext_=this.context,this.context=ur(this.context.canvas.width,this.context.canvas.height,Lf))}resetDrawContext_(){if(1!==this.opacity_&&this.targetContext_){const t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,fr(this.context),Lf.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){this.replayGroup_&&this.getLayer().getDeclutter()&&this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,t,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex];this.opacity_=i.opacity;const n=t.viewState;this.prepareContainer(t,e);const r=this.context,s=this.replayGroup_;let o=s&&!s.isEmpty();if(!o&&!this.getLayer().hasListener(ms)&&!this.getLayer().hasListener(ys))return this.container;this.setDrawContext_(),this.preRender(r,t);n.projection;this.clipExtent_=null;let a=!1;if(o&&i.extent&&this.clipping){const e=Fi(i.extent);o=oe(e,t.extent),o&&!Ft(e,t.extent)&&(t.declutter?this.clipExtent_=e:(this.clipUnrotated(r,t,e),a=!0))}return o&&this.renderWorlds(s,t,!this.getLayer().getDeclutter()&&void 0),a&&r.restore(),this.postRender(r,t),this.renderedRotation_!==n.rotation&&(this.renderedRotation_=n.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=this.frameState.size.slice(),e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,r=this.renderedProjection_,s=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],l=t[0]*kp,h=t[1]*kp;a.push(this.getRenderTransform(e,i,n,kp,l,h,0).slice());const u=o.getSource(),c=r.getExtent();if(u.getWrapX()&&r.canWrapX()&&!Ft(c,s)){let t=s[0];const r=se(c);let o,u=0;for(;t<c[0];)--u,o=r*u,a.push(this.getRenderTransform(e,i,n,kp,l,h,o).slice()),t+=r;for(u=0,t=s[2];t>c[2];)++u,o=r*u,a.push(this.getRenderTransform(e,i,n,kp,l,h,o).slice()),t-=r}const d=ki();this.hitDetectionImageData_=Ap(t,a,this.renderedFeatures_,o.getStyleFunction(),s,i,n,Lp(i,this.renderedPixelRatio_),d?r:null)}e(Gp(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,n,r){if(!this.replayGroup_)return;const s=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),l={},h=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,s,o,i,function(t,e,i){const s=z(t),o=l[s];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return l[s]=!0,r.splice(r.lastIndexOf(o),1),n(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return l[s]=!0,n(t,a,e);r.push(l[s]={feature:t,layer:a,geometry:e,distanceSq:i,callback:n})}},h?e.declutter?.[h]?.all().map(t=>t.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[0],r=t.viewHints[1],s=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!s&&n||!o&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,l=t.viewState,h=l.projection,u=l.resolution,c=t.pixelRatio,d=e.getRevision(),f=e.getRenderBuffer();let p=e.getRenderOrder();void 0===p&&(p=Fp);const g=l.center.slice(),m=kt(a,f*u),y=m.slice(),_=[m.slice()],v=h.getExtent(),x=i.getWrapX()&&h.canWrapX();if(this.extendX_=!1,x){const t=i.getExtent();t&&!ae(t)&&(this.extendX_=t[0]<v[0]||t[2]>v[2])}if(x&&(!Ft(v,t.extent)||this.extendX_)){const t=se(v),e=Math.max(se(m)/2,t);let i=v[0],n=v[2];this.extendX_&&(i-=t,n+=t),m[0]=i-e,m[2]=n+e,de(g,h);const r=le(_[0],h);r[0]<v[0]&&r[2]<v[2]?_.push([r[0]+t,r[1],r[2]+t,r[3]]):r[0]>v[0]&&r[2]>v[2]&&_.push([r[0]-t,r[1],r[2]-t,r[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedPixelRatio_===c&&this.renderedRevision_==d&&this.renderedRenderOrder_==p&&this.renderedFrameDeclutter_===!!t.declutter&&Ft(this.wrappedRenderedExtent_,m))return I(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=g,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const w=new op(jp(u,c),m,u,c),b=ki();let S;if(b){for(let t=0,e=_.length;t<e;++t){const e=Oi(_[t]);i.loadFeatures(e,Li(u),b)}S=Ei(b,h)}else for(let t=0,e=_.length;t<e;++t)i.loadFeatures(_[t],u,h);const M=Lp(u,c);let E=!0;const C=(t,i)=>{let n;const r=t.getStyleFunction()||e.getStyleFunction();if(r&&(n=r(t,u)),n){const e=this.renderFeature(t,M,n,w,S,this.getLayer().getDeclutter(),i);E=E&&!e}},P=Oi(m),T=i.getFeaturesInExtent(P);p&&T.sort(p);for(let t=0,e=T.length;t<e;++t)C(T[t],t);this.renderedFeatures_=T,this.ready=E;const R=w.finish(),k=new Tp(m,u,c,i.getOverlaps(),R,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=u,this.renderedRevision_=d,this.renderedRenderOrder_=p,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=y,this.wrappedRenderedExtent_=m,this.renderedCenter_=g,this.renderedProjection_=h,this.renderedPixelRatio_=c,this.replayGroup_=k,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,n,r,s,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let l=0,h=i.length;l<h;++l)a=Np(n,t,i[l],e,this.boundHandleStyleImageChange_,r,s,o)||a;else a=Np(n,t,i,e,this.boundHandleStyleImageChange_,r,s,o);return a}},Zg=class extends Hl{constructor(t){super(t)}createRenderer(){return new Yg(this)}};function Hg(t,e){return[[-1/0,-1/0,1/0,1/0]]}const Jg=class{constructor(t){this.rbush_=new Es(t),this.items_={}}insert(t,e){const i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[z(e)]=i}load(t,e){const i=new Array(e.length);for(let n=0,r=e.length;n<r;n++){const r=t[n],s=e[n],o={minX:r[0],minY:r[1],maxX:r[2],maxY:r[3],value:s};i[n]=o,this.items_[z(s)]=o}this.rbush_.load(i)}remove(t){const e=z(t),i=this.items_[e];return delete this.items_[e],null!==this.rbush_.remove(i)}update(t,e){const i=this.items_[z(e)];$t([i.minX,i.minY,i.maxX,i.maxY],t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(t){return t.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let i;for(let n=0,r=t.length;n<r;n++)if(i=e(t[n]),i)return i;return i}isEmpty(){return c(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return Nt(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(const e in t.items_)this.items_[e]=t.items_[e]}},Qg="addfeature",tm="removefeature";class em extends O{constructor(t,e,i){super(t),this.feature=e,this.features=i}}const im=class extends hf{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.on,this.once,this.un,this.loader_=k,this.format_=t.format||null,this.overlaps_=void 0===t.overlaps||t.overlaps,this.url_=t.url,void 0!==t.loader?this.loader_=t.loader:void 0!==this.url_&&(ct(this.format_,"`format` must be set when `url` is set"),this.loader_=Cf(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:Hg;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,n;this.featuresRtree_=e?new Jg:null,this.loadedExtentsRtree_=new Jg,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(t.features)?n=t.features:t.features&&(i=t.features,n=i.getArray()),e||void 0!==i||(i=new W(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=z(t);if(!this.addToIndex_(e,t))return void(this.featuresCollection_&&this.featuresCollection_.remove(t));this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const e=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(e,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new em(Qg,t))}setupChangeEvents_(t,e){e instanceof Ig||(this.featureChangeKeys_[t]=[d(e,g,this.handleFeatureChange_,this),d(e,h,this.handleFeatureChange_,this)])}addToIndex_(t,e){let i=!0;if(void 0!==e.getId()){const t=String(e.getId());if(t in this.idIndex_)if(e instanceof Ig){const n=this.idIndex_[t];n instanceof Ig?Array.isArray(n)?n.push(e):this.idIndex_[t]=[n,e]:i=!1}else i=!1;else this.idIndex_[t]=e}return i&&(ct(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],n=[];for(let e=0,n=t.length;e<n;e++){const n=t[e],r=z(n);this.addToIndex_(r,n)&&i.push(n)}for(let t=0,r=i.length;t<r;t++){const r=i[t],s=z(r);this.setupChangeEvents_(s,r);const o=r.getGeometry();if(o){const t=o.getExtent();e.push(t),n.push(r)}else this.nullGeometryFeatures_[s]=r}if(this.featuresRtree_&&this.featuresRtree_.load(e,n),this.hasListener(Qg))for(let t=0,e=i.length;t<e;t++)this.dispatchEvent(new em(Qg,i[t]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(Qg,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(tm,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(a,t=>{e||(e=!0,this.addFeature(t.element),e=!1)}),t.addEventListener(l,t=>{e||(e=!0,this.removeFeature(t.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_)this.featureChangeKeys_[t].forEach(p);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(t=>{this.removeFeatureInternal(t)});for(const t in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[t])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new em("clear");this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,function(i){const n=i.getGeometry();if(n instanceof Ig||n.intersectsCoordinate(t))return e(i)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(i){const n=i.getGeometry();if(n instanceof Ig||n.intersectsExtent(t)){const t=e(i);if(t)return t}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),c(this.nullGeometryFeatures_)||P(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(t){e.push(t)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const i=he(t,e);return[].concat(...i.map(t=>this.featuresRtree_.getInExtent(t)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let r=null;const s=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||T,this.featuresRtree_.forEachInExtent(a,function(t){if(e(t)){const e=t.getGeometry(),l=o;if(o=e instanceof Ig?0:e.closestPointXY(i,n,s,o),o<l){r=t;const e=Math.sqrt(o);a[0]=i-e,a[1]=n-e,a[2]=i+e,a[3]=n+e}}}),r}getExtent(t){return this.featuresRtree_?.getExtent(t)??null}getFeatureById(t){const e=this.idIndex_[t.toString()];return void 0!==e?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return void 0!==e?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,i=z(e),n=e.getGeometry();if(n){const t=n.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(t,e)):this.featuresRtree_&&this.featuresRtree_.update(t,e)}else i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);const r=e.getId();if(void 0!==r){const t=r.toString();this.idIndex_[t]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[t]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new em("changefeature",e))}hasFeature(t){const e=t.getId();return void 0!==e?e in this.idIndex_:z(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&c(this.nullGeometryFeatures_):!this.featuresCollection_||0===this.featuresCollection_.getLength()}loadFeatures(t,e,i){const n=this.loadedExtentsRtree_,r=this.strategy_(t,e,i);for(let t=0,s=r.length;t<s;++t){const s=r[t];if(!n.forEachInExtent(s,function(t){return Ft(t.extent,s)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new em("featuresloadstart"));const t=t=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new em("featuresloadend",void 0,t))},r=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new em("featuresloaderror"))};let o=!1;const a=this.loader_.call(this,s,e,i,e=>o||t(e),()=>o||r());a instanceof Promise?(o=!0,a.then(e=>{this.addFeatures(e),t(e)}).catch(r)):this.loader_.length<4&&(this.loading=!1),n.insert(s,{extent:s.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,i=e.forEachInExtent(t,function(e){if($t(e.extent,t))return e});i&&e.remove(i)}removeFeatures(t){let e=!1;for(let i=0,n=t.length;i<n;++i)e=this.removeFeatureInternal(t[i])||e;e&&this.changed()}removeFeature(t){t&&this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=z(t);if(!(e in this.uidIndex_))return!1;e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t);const i=this.featureChangeKeys_[e];i?.forEach(p),delete this.featureChangeKeys_[e];const n=t.getId();if(void 0!==n){const e=n.toString(),i=this.idIndex_[e];i===t?delete this.idIndex_[e]:Array.isArray(i)&&(i.splice(i.indexOf(t),1),1===i.length&&(this.idIndex_[e]=i[0]))}return delete this.uidIndex_[e],this.hasListener(tm)&&this.dispatchEvent(new em(tm,t)),!0}removeFromIdIndex_(t){for(const e in this.idIndex_)if(this.idIndex_[e]===t){delete this.idIndex_[e];break}}setLoader(t){this.loader_=t}setUrl(t){ct(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(Cf(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}};var nm={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};const rm=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function sm(t,e){const i={};for(const e in t)"ref"!==e&&(i[e]=t[e]);return rm.forEach(t=>{t in e&&(i[t]=e[t])}),i}class om{constructor(t,e,i,n){this.message=(t?`${t}: `:"")+i,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)}}function am(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}class lm extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class hm{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,i]of e)this.bindings[t]=i}concat(t){return new hm(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const um={kind:"null"},cm={kind:"number"},dm={kind:"string"},fm={kind:"boolean"},pm={kind:"color"},gm={kind:"projectionDefinition"},mm={kind:"object"},ym={kind:"value"},_m={kind:"collator"},vm={kind:"formatted"},xm={kind:"padding"},wm={kind:"colorArray"},bm={kind:"numberArray"},Sm={kind:"resolvedImage"},Mm={kind:"variableAnchorOffsetCollection"};function Em(t,e){return{kind:"array",itemType:t,N:e}}function Cm(t){if("array"===t.kind){const e=Cm(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const Pm=[um,cm,dm,fm,pm,gm,vm,mm,Em(ym),xm,bm,wm,Sm,Mm];function Im(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Im(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of Pm)if(!Im(t,e))return null}return`Expected ${Cm(t)} but found ${Cm(e)} instead.`}function Tm(t,e){return e.some(e=>e.kind===t.kind)}function Rm(t,e){return e.some(e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t)}function km(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const Am=.96422,Gm=.82521,Om=4/29,Fm=6/29,Lm=3*Fm*Fm,jm=Fm*Fm*Fm,Nm=Math.PI/180,Dm=180/Math.PI;function zm(t){return(t%=360)<0&&(t+=360),t}function qm([t,e,i,n]){let r,s;const o=Bm((.2225045*(t=$m(t))+.7168786*(e=$m(e))+.0606169*(i=$m(i)))/1);t===e&&e===i?r=s=o:(r=Bm((.4360747*t+.3850649*e+.1430804*i)/Am),s=Bm((.0139322*t+.0971045*e+.7141733*i)/Gm));const a=116*o-16;return[a<0?0:a,500*(r-o),200*(o-s),n]}function $m(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Bm(t){return t>jm?Math.pow(t,1/3):t/Lm+Om}function Um([t,e,i,n]){let r=(t+16)/116,s=isNaN(e)?r:r+e/500,o=isNaN(i)?r:r-i/200;return r=1*Xm(r),s=Am*Xm(s),o=Gm*Xm(o),[Wm(3.1338561*s-1.6168667*r-.4906146*o),Wm(-.9787684*s+1.9161415*r+.033454*o),Wm(.0719453*s-.2289914*r+1.4052427*o),n]}function Wm(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function Xm(t){return t>Fm?t*t*t:Lm*(t-Om)}const Vm=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function Km(t,e){return Vm(t,e)?t[e]:void 0}function Ym(t){return parseInt(t.padEnd(2,t),16)/255}function Zm(t,e){return Hm(e?t/100:t,0,1)}function Hm(t,e,i){return Math.min(Math.max(e,t),i)}function Jm(t){return!t.some(Number.isNaN)}const Qm={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function ty(t,e,i){return t+i*(e-t)}function ey(t,e,i){return t.map((t,n)=>ty(t,e[n],i))}class iy{constructor(t,e,i,n=1,r=!0){this.r=t,this.g=e,this.b=i,this.a=n,r||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[t,e,i,n]))}static parse(t){if(t instanceof iy)return t;if("string"!=typeof t)return;const e=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];const e=Km(Qm,t);if(e){const[t,i,n]=e;return[t/255,i/255,n/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){const e=t.length<6?1:2;let i=1;return[Ym(t.slice(i,i+=e)),Ym(t.slice(i,i+=e)),Ym(t.slice(i,i+=e)),Ym(t.slice(i,i+e)||"ff")]}if(t.startsWith("rgb")){const e=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,i=t.match(e);if(i){const[t,e,n,r,s,o,a,l,h,u,c,d]=i,f=[r||" ",a||" ",u].join("");if(" "===f||" /"===f||",,"===f||",,,"===f){const t=[n,o,h].join(""),i="%%%"===t?100:""===t?255:0;if(i){const t=[Hm(+e/i,0,1),Hm(+s/i,0,1),Hm(+l/i,0,1),c?Zm(+c,d):1];if(Jm(t))return t}}return}}const i=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){const[t,e,n,r,s,o,a,l,h]=i,u=[n||" ",s||" ",a].join("");if(" "===u||" /"===u||",,"===u||",,,"===u){const t=[+e,Hm(+r,0,100),Hm(+o,0,100),l?Zm(+l,h):1];if(Jm(t))return function([t,e,i,n]){function r(n){const r=(n+t/30)%12,s=e*Math.min(i,1-i);return i-s*Math.max(-1,Math.min(r-3,9-r,1))}return t=zm(t),e/=100,i/=100,[r(0),r(8),r(4),n]}(t)}}}(t);return e?new iy(...e,!1):void 0}get rgb(){const{r:t,g:e,b:i,a:n}=this,r=n||1/0;return this.overwriteGetter("rgb",[t/r,e/r,i/r,n])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,i,n,r]=qm(t),s=Math.sqrt(i*i+n*n);return[Math.round(1e4*s)?zm(Math.atan2(n,i)*Dm):NaN,s,e,r]}(this.rgb))}get lab(){return this.overwriteGetter("lab",qm(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,i,n]=this.rgb;return`rgba(${[t,e,i].map(t=>Math.round(255*t)).join(",")},${n})`}static interpolate(t,e,i,n="rgb"){switch(n){case"rgb":{const[n,r,s,o]=ey(t.rgb,e.rgb,i);return new iy(n,r,s,o,!1)}case"hcl":{const[n,r,s,o]=t.hcl,[a,l,h,u]=e.hcl;let c,d;if(isNaN(n)||isNaN(a))isNaN(n)?isNaN(a)?c=NaN:(c=a,1!==s&&0!==s||(d=l)):(c=n,1!==h&&0!==h||(d=r));else{let t=a-n;a>n&&t>180?t-=360:a<n&&n-a>180&&(t+=360),c=n+i*t}const[f,p,g,m]=function([t,e,i,n]){return t=isNaN(t)?0:t*Nm,Um([i,Math.cos(t)*e,Math.sin(t)*e,n])}([c,null!=d?d:ty(r,l,i),ty(s,h,i),ty(o,u,i)]);return new iy(f,p,g,m,!1)}case"lab":{const[n,r,s,o]=Um(ey(t.lab,e.lab,i));return new iy(n,r,s,o,!1)}}}}iy.black=new iy(0,0,0,1),iy.white=new iy(1,1,1,1),iy.transparent=new iy(0,0,0,0),iy.red=new iy(1,0,0,1);class ny{constructor(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const ry=["bottom","center","top"];class sy{constructor(t,e,i,n,r,s){this.text=t,this.image=e,this.scale=i,this.fontStack=n,this.textColor=r,this.verticalAlign=s}}class oy{constructor(t){this.sections=t}static fromString(t){return new oy([new sy(t,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(t=>0!==t.text.length||t.image&&0!==t.image.name.length)}static factory(t){return t instanceof oy?t:oy.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map(t=>t.text).join("")}}class ay{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ay)return t;if("number"==typeof t)return new ay([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if("number"!=typeof e)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new ay(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){return new ay(ey(t.values,e.values,i))}}class ly{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ly)return t;if("number"==typeof t)return new ly([t]);if(Array.isArray(t)){for(const e of t)if("number"!=typeof e)return;return new ly(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){return new ly(ey(t.values,e.values,i))}}class hy{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof hy)return t;if("string"==typeof t){const e=iy.parse(t);if(!e)return;return new hy([e])}if(!Array.isArray(t))return;const e=[];for(const i of t){if("string"!=typeof i)return;const t=iy.parse(i);if(!t)return;e.push(t)}return new hy(e)}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i,n="rgb"){const r=[];if(t.values.length!=e.values.length)throw new Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${e.values.length}), cannot interpolate.`);for(let s=0;s<t.values.length;s++)r.push(iy.interpolate(t.values[s],e.values[s],i,n));return new hy(r)}}class uy extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}}const cy=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class dy{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof dy)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){const i=t[e],n=t[e+1];if("string"!=typeof i||!cy.has(i))return;if(!Array.isArray(n)||2!==n.length||"number"!=typeof n[0]||"number"!=typeof n[1])return}return new dy(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){const n=t.values,r=e.values;if(n.length!==r.length)throw new uy(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);const s=[];for(let t=0;t<n.length;t+=2){if(n[t]!==r[t])throw new uy(`Cannot interpolate values containing mismatched anchors. from[${t}]: ${n[t]}, to[${t}]: ${r[t]}`);s.push(n[t]);const[e,o]=n[t+1],[a,l]=r[t+1];s.push([ty(e,a,i),ty(o,l,i)])}return new dy(s)}}class fy{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new fy({name:t,available:!1}):null}}class py{constructor(t,e,i){this.from=t,this.to=e,this.transition=i}static interpolate(t,e,i){return new py(t,e,i)}static parse(t){return t instanceof py?t:Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]?new py(t[0],t[1],t[2]):"object"==typeof t&&"string"==typeof t.from&&"string"==typeof t.to&&"number"==typeof t.transition?new py(t.from,t.to,t.transition):"string"==typeof t?new py(t,t,1):void 0}}function gy(t,e,i,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[t,e,i,n]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function my(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof py||t instanceof iy||t instanceof ny||t instanceof oy||t instanceof ay||t instanceof ly||t instanceof hy||t instanceof dy||t instanceof fy)return!0;if(Array.isArray(t)){for(const e of t)if(!my(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!my(t[e]))return!1;return!0}return!1}function yy(t){if(null===t)return um;if("string"==typeof t)return dm;if("boolean"==typeof t)return fm;if("number"==typeof t)return cm;if(t instanceof iy)return pm;if(t instanceof py)return gm;if(t instanceof ny)return _m;if(t instanceof oy)return vm;if(t instanceof ay)return xm;if(t instanceof ly)return bm;if(t instanceof hy)return wm;if(t instanceof dy)return Mm;if(t instanceof fy)return Sm;if(Array.isArray(t)){const e=t.length;let i;for(const e of t){const t=yy(e);if(i){if(i===t)continue;i=ym;break}i=t}return Em(i||ym,e)}return mm}function _y(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof iy||t instanceof py||t instanceof oy||t instanceof ay||t instanceof ly||t instanceof hy||t instanceof dy||t instanceof fy?t.toString():JSON.stringify(t)}class vy{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!my(t[1]))return e.error("invalid value");const i=t[1];let n=yy(i);const r=e.expectedType;return"array"!==n.kind||0!==n.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(n=r),new vy(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const xy={string:dm,number:cm,boolean:fm,object:mm};class wy{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i,n=1;const r=t[0];if("array"===r){let r,s;if(t.length>2){const i=t[1];if("string"!=typeof i||!(i in xy)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=xy[i],n++}else r=ym;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);s=t[2],n++}i=Em(r,s)}else{if(!xy[r])throw new Error(`Types doesn't contain name = ${r}`);i=xy[r]}const s=[];for(;n<t.length;n++){const i=e.parse(t[n],n,ym);if(!i)return null;s.push(i)}return new wy(i,s)}evaluate(t){for(let e=0;e<this.args.length;e++){const i=this.args[e].evaluate(t);if(!Im(this.type,yy(i)))return i;if(e===this.args.length-1)throw new uy(`Expected value to be of type ${Cm(this.type)}, but found ${Cm(yy(i))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const by={"to-boolean":fm,"to-color":pm,"to-number":cm,"to-string":dm};class Sy{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[0];if(!by[i])throw new Error(`Can't parse ${i} as it is not part of the known types`);if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return e.error("Expected one argument.");const n=by[i],r=[];for(let i=1;i<t.length;i++){const n=e.parse(t[i],i,ym);if(!n)return null;r.push(n)}return new Sy(n,r)}evaluate(t){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(t));case"color":{let e,i;for(const n of this.args){if(e=n.evaluate(t),i=null,e instanceof iy)return e;if("string"==typeof e){const i=t.parseColor(e);if(i)return i}else if(Array.isArray(e)&&(i=e.length<3||e.length>4?`Invalid rgba value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:gy(e[0],e[1],e[2],e[3]),!i))return new iy(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new uy(i||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"padding":{let e;for(const i of this.args){e=i.evaluate(t);const n=ay.parse(e);if(n)return n}throw new uy(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"numberArray":{let e;for(const i of this.args){e=i.evaluate(t);const n=ly.parse(e);if(n)return n}throw new uy(`Could not parse numberArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"colorArray":{let e;for(const i of this.args){e=i.evaluate(t);const n=hy.parse(e);if(n)return n}throw new uy(`Could not parse colorArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"variableAnchorOffsetCollection":{let e;for(const i of this.args){e=i.evaluate(t);const n=dy.parse(e);if(n)return n}throw new uy(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"number":{let e=null;for(const i of this.args){if(e=i.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new uy(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return oy.fromString(_y(this.args[0].evaluate(t)));case"resolvedImage":return fy.fromString(_y(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return _y(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const My=["Unknown","Point","LineString","Polygon"];class Ey{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?My[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache.get(t);return e||(e=iy.parse(t),this._parseColorCache.set(t,e)),e}}class Cy{constructor(t,e,i=[],n,r=new hm,s=[]){this.registry=t,this.path=i,this.key=i.map(t=>`[${t}]`).join(""),this.scope=r,this.errors=s,this.expectedType=n,this._isConstant=e}parse(t,e,i,n,r={}){return e?this.concat(e,i,n)._parse(t,r):this._parse(t,r)}_parse(t,e){function i(t,e,i){return"assert"===i?new wy(e,[t]):"coerce"===i?new Sy(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=t[0];if("string"!=typeof n)return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const r=this.registry[n];if(r){let n=r.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,r=n.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==r.kind){if("projectionDefinition"===t.kind&&["string","array"].includes(r.kind)||["color","formatted","resolvedImage"].includes(t.kind)&&["value","string"].includes(r.kind)||["padding","numberArray"].includes(t.kind)&&["value","number","array"].includes(r.kind)||"colorArray"===t.kind&&["value","string","array"].includes(r.kind)||"variableAnchorOffsetCollection"===t.kind&&["value","array"].includes(r.kind))n=i(n,t,e.typeAnnotation||"coerce");else if(this.checkSubtype(t,r))return null}else n=i(n,t,e.typeAnnotation||"assert")}if(!(n instanceof vy)&&"resolvedImage"!==n.type.kind&&this._isConstant(n)){const t=new Ey;try{n=new vy(n.type,n.evaluate(t))}catch(t){return this.error(t.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return void 0===t?this.error("'undefined' value invalid. Use null instead."):"object"==typeof t?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof t} instead.`)}concat(t,e,i){const n="number"==typeof t?this.path.concat(t):this.path,r=i?this.scope.concat(i):this.scope;return new Cy(this.registry,this._isConstant,n,e||null,r,this.errors)}error(t,...e){const i=`${this.key}${e.map(t=>`[${t}]`).join("")}`;this.errors.push(new lm(i,t))}checkSubtype(t,e){const i=Im(t,e);return i&&this.error(i),i}}class Py{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const i=[];for(let n=1;n<t.length-1;n+=2){const r=t[n];if("string"!=typeof r)return e.error(`Expected string, but found ${typeof r} instead.`,n);if(/[^a-zA-Z0-9_]/.test(r))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);const s=e.parse(t[n+1],n+1);if(!s)return null;i.push([r,s])}const n=e.parse(t[t.length-1],t.length-1,e.expectedType,i);return n?new Py(i,n):null}outputDefined(){return this.result.outputDefined()}}class Iy{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const i=t[1];return e.scope.has(i)?new Iy(i,e.scope.get(i)):e.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class Ty{constructor(t,e,i){this.type=t,this.index=e,this.input=i}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,cm),n=e.parse(t[2],2,Em(e.expectedType||ym));if(!i||!n)return null;const r=n.type;return new Ty(r.itemType,i,n)}evaluate(t){const e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new uy(`Array index out of bounds: ${e} < 0.`);if(e>=i.length)throw new uy(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new uy(`Array index must be an integer, but found ${e} instead.`);return i[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Ry{constructor(t,e){this.type=fm,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ym),n=e.parse(t[2],2,ym);return i&&n?Tm(i.type,[fm,dm,cm,um,ym])?new Ry(i,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Cm(i.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!Rm(e,["boolean","string","number","null"]))throw new uy(`Expected first argument to be of type boolean, string, number or null, but found ${Cm(yy(e))} instead.`);if(!Rm(i,["string","array"]))throw new uy(`Expected second argument to be of type array or string, but found ${Cm(yy(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class ky{constructor(t,e,i){this.type=cm,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ym),n=e.parse(t[2],2,ym);if(!i||!n)return null;if(!Tm(i.type,[fm,dm,cm,um,ym]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Cm(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,cm);return r?new ky(i,n,r):null}return new ky(i,n)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!Rm(e,["boolean","string","number","null"]))throw new uy(`Expected first argument to be of type boolean, string, number or null, but found ${Cm(yy(e))} instead.`);let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(t)),Rm(i,["string"])){const t=i.indexOf(e,n);return-1===t?-1:[...i.slice(0,t)].length}if(Rm(i,["array"]))return i.indexOf(e,n);throw new uy(`Expected second argument to be of type array or string, but found ${Cm(yy(i))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Ay{constructor(t,e,i,n,r,s){this.inputType=t,this.type=e,this.input=i,this.cases=n,this.outputs=r,this.otherwise=s}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let i,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const r={},s=[];for(let o=2;o<t.length-1;o+=2){let a=t[o];const l=t[o+1];Array.isArray(a)||(a=[a]);const h=e.concat(o);if(0===a.length)return h.error("Expected at least one branch label.");for(const t of a){if("number"!=typeof t&&"string"!=typeof t)return h.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return h.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return h.error("Numeric branch labels must be integer values.");if(i){if(h.checkSubtype(i,yy(t)))return null}else i=yy(t);if(void 0!==r[String(t)])return h.error("Branch labels must be unique.");r[String(t)]=s.length}const u=e.parse(l,o,n);if(!u)return null;n=n||u.type,s.push(u)}const o=e.parse(t[1],1,ym);if(!o)return null;const a=e.parse(t[t.length-1],t.length-1,n);return a?"value"!==o.type.kind&&e.concat(1).checkSubtype(i,o.type)?null:new Ay(i,n,o,r,s,a):null}evaluate(t){const e=this.input.evaluate(t);return(yy(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class Gy{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const n=[];for(let r=1;r<t.length-1;r+=2){const s=e.parse(t[r],r,fm);if(!s)return null;const o=e.parse(t[r+1],r+1,i);if(!o)return null;n.push([s,o]),i=i||o.type}const r=e.parse(t[t.length-1],t.length-1,i);if(!r)return null;if(!i)throw new Error("Can't infer output type");return new Gy(i,n,r)}evaluate(t){for(const[e,i]of this.branches)if(e.evaluate(t))return i.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,i]of this.branches)t(e),t(i);t(this.otherwise)}outputDefined(){return this.branches.every(([t,e])=>e.outputDefined())&&this.otherwise.outputDefined()}}class Oy{constructor(t,e,i,n){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ym),n=e.parse(t[2],2,cm);if(!i||!n)return null;if(!Tm(i.type,[Em(ym),dm,ym]))return e.error(`Expected first argument to be of type array or string, but found ${Cm(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,cm);return r?new Oy(i.type,i,n,r):null}return new Oy(i.type,i,n)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);let n;if(this.endIndex&&(n=this.endIndex.evaluate(t)),Rm(e,["string"]))return[...e].slice(i,n).join("");if(Rm(e,["array"]))return e.slice(i,n);throw new uy(`Expected first argument to be of type array or string, but found ${Cm(yy(e))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function Fy(t,e){const i=t.length-1;let n,r,s=0,o=i,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),n=t[a],r=t[a+1],n<=e){if(a===i||e<r)return a;s=a+1}else{if(!(n>e))throw new uy("Input is not a number.");o=a-1}return 0}class Ly{constructor(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const i=e.parse(t[1],1,cm);if(!i)return null;const n=[];let r=null;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(let i=1;i<t.length;i+=2){const s=1===i?-1/0:t[i],o=t[i+1],a=i,l=i+1;if("number"!=typeof s)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(n.length&&n[n.length-1][0]>=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const h=e.parse(o,l,r);if(!h)return null;r=r||h.type,n.push([s,h])}return new Ly(r,i,n)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;return n>=e[r-1]?i[r-1].evaluate(t):i[Fy(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function jy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ny,Dy,zy=function(){if(Dy)return Ny;function t(t,e,i,n){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=i,this.p2y=n}return Dy=1,Ny=t,t.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var i=t,n=0;n<8;n++){var r=this.sampleCurveX(i)-t;if(Math.abs(r)<e)return i;var s=this.sampleCurveDerivativeX(i);if(Math.abs(s)<1e-6)break;i-=r/s}var o=0,a=1;for(i=t,n=0;n<20&&(r=this.sampleCurveX(i),!(Math.abs(r-t)<e));n++)t>r?o=i:a=i,i=.5*(a-o)+o;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},Ny}(),qy=jy(zy);class $y{constructor(t,e,i,n,r){this.type=t,this.operator=e,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,i,n){let r=0;if("exponential"===t.name)r=By(e,t.base,i,n);else if("linear"===t.name)r=By(e,1,i,n);else if("cubic-bezier"===t.name){const s=t.controlPoints;r=new qy(s[0],s[1],s[2],s[3]).solve(By(e,1,i,n))}return r}static parse(t,e){let[i,n,r,...s]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t}}else{if("cubic-bezier"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.slice(1);if(4!==t.length||t.some(t=>"number"!=typeof t||t<0||t>1))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(r=e.parse(r,2,cm),!r)return null;const o=[];let a=null;"interpolate-hcl"!==i&&"interpolate-lab"!==i||e.expectedType==wm?e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType):a=pm;for(let t=0;t<s.length;t+=2){const i=s[t],n=s[t+1],r=t+3,l=t+4;if("number"!=typeof i)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',r);if(o.length&&o[o.length-1][0]>=i)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const h=e.parse(n,l,a);if(!h)return null;a=a||h.type,o.push([i,h])}return km(a,cm)||km(a,gm)||km(a,pm)||km(a,xm)||km(a,bm)||km(a,wm)||km(a,Mm)||km(a,Em(cm))?new $y(a,i,n,r,o):e.error(`Type ${Cm(a)} is not interpolatable.`)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;if(n>=e[r-1])return i[r-1].evaluate(t);const s=Fy(e,n),o=e[s],a=e[s+1],l=$y.interpolationFactor(this.interpolation,n,o,a),h=i[s].evaluate(t),u=i[s+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return ty(h,u,l);case"color":return iy.interpolate(h,u,l);case"padding":return ay.interpolate(h,u,l);case"colorArray":return hy.interpolate(h,u,l);case"numberArray":return ly.interpolate(h,u,l);case"variableAnchorOffsetCollection":return dy.interpolate(h,u,l);case"array":return ey(h,u,l);case"projectionDefinition":return py.interpolate(h,u,l)}case"interpolate-hcl":switch(this.type.kind){case"color":return iy.interpolate(h,u,l,"hcl");case"colorArray":return hy.interpolate(h,u,l,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return iy.interpolate(h,u,l,"lab");case"colorArray":return hy.interpolate(h,u,l,"lab")}}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function By(t,e,i,n){const r=n-i,s=t-i;return 0===r?0:1===e?s/r:(Math.pow(e,s)-1)/(Math.pow(e,r)-1)}iy.interpolate,ay.interpolate,ly.interpolate,hy.interpolate,dy.interpolate;class Uy{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i=null;const n=e.expectedType;n&&"value"!==n.kind&&(i=n);const r=[];for(const n of t.slice(1)){const t=e.parse(n,1+r.length,i,void 0,{typeAnnotation:"omit"});if(!t)return null;i=i||t.type,r.push(t)}if(!i)throw new Error("No output type");const s=n&&r.some(t=>Im(n,t.type));return new Uy(s?ym:i,r)}evaluate(t){let e,i=null,n=0;for(const r of this.args)if(n++,i=r.evaluate(t),i&&i instanceof fy&&!i.available&&(e||(e=i.name),i=null,n===this.args.length&&(i=e)),null!==i)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function Wy(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function Xy(t,e,i,n){return 0===n.compare(e,i)}function Vy(t,e,i){const n="=="!==t&&"!="!==t;return class r{constructor(t,e,i){this.type=fm,this.lhs=t,this.rhs=e,this.collator=i,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const i=t[0];let s=e.parse(t[1],1,ym);if(!s)return null;if(!Wy(i,s.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${Cm(s.type)}'.`);let o=e.parse(t[2],2,ym);if(!o)return null;if(!Wy(i,o.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${Cm(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${Cm(s.type)}' and '${Cm(o.type)}'.`);n&&("value"===s.type.kind&&"value"!==o.type.kind?s=new wy(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new wy(s.type,[o])));let a=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,_m),!a)return null}return new r(s,o,a)}evaluate(r){const s=this.lhs.evaluate(r),o=this.rhs.evaluate(r);if(n&&this.hasUntypedArgument){const e=yy(s),i=yy(o);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new uy(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${i.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=yy(s),i=yy(o);if("string"!==t.kind||"string"!==i.kind)return e(r,s,o)}return this.collator?i(r,s,o,this.collator.evaluate(r)):e(r,s,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const Ky=Vy("==",function(t,e,i){return e===i},Xy),Yy=Vy("!=",function(t,e,i){return e!==i},function(t,e,i,n){return!Xy(0,e,i,n)}),Zy=Vy("<",function(t,e,i){return e<i},function(t,e,i,n){return n.compare(e,i)<0}),Hy=Vy(">",function(t,e,i){return e>i},function(t,e,i,n){return n.compare(e,i)>0}),Jy=Vy("<=",function(t,e,i){return e<=i},function(t,e,i,n){return n.compare(e,i)<=0}),Qy=Vy(">=",function(t,e,i){return e>=i},function(t,e,i,n){return n.compare(e,i)>=0});class t_{constructor(t,e,i){this.type=_m,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const i=t[1];if("object"!=typeof i||Array.isArray(i))return e.error("Collator options argument must be an object.");const n=e.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,fm);if(!n)return null;const r=e.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,fm);if(!r)return null;let s=null;return i.locale&&(s=e.parse(i.locale,1,dm),!s)?null:new t_(n,r,s)}evaluate(t){return new ny(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class e_{constructor(t,e,i,n,r,s){this.type=dm,this.number=t,this.locale=e,this.currency=i,this.unit=n,this.minFractionDigits=r,this.maxFractionDigits=s}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,cm);if(!i)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let r=null;if(n.locale&&(r=e.parse(n.locale,1,dm),!r))return null;let s=null;if(n.currency&&(s=e.parse(n.currency,1,dm),!s))return null;let o=null;if(n.unit&&(o=e.parse(n.unit,1,dm),!o))return null;if(s&&o)return e.error("NumberFormat options `currency` and `unit` are mutually exclusive");let a=null;if(n["min-fraction-digits"]&&(a=e.parse(n["min-fraction-digits"],1,cm),!a))return null;let l=null;return n["max-fraction-digits"]&&(l=e.parse(n["max-fraction-digits"],1,cm),!l)?null:new e_(i,r,s,o,a,l)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class i_{constructor(t){this.type=vm,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");const n=[];let r=!1;for(let i=1;i<=t.length-1;++i){const s=t[i];if(r&&"object"==typeof s&&!Array.isArray(s)){r=!1;let t=null;if(s["font-scale"]&&(t=e.parse(s["font-scale"],1,cm),!t))return null;let i=null;if(s["text-font"]&&(i=e.parse(s["text-font"],1,Em(dm)),!i))return null;let o=null;if(s["text-color"]&&(o=e.parse(s["text-color"],1,pm),!o))return null;let a=null;if(s["vertical-align"]){if("string"==typeof s["vertical-align"]&&!ry.includes(s["vertical-align"]))return e.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${s["vertical-align"]}' instead.`);if(a=e.parse(s["vertical-align"],1,dm),!a)return null}const l=n[n.length-1];l.scale=t,l.font=i,l.textColor=o,l.verticalAlign=a}else{const s=e.parse(t[i],1,ym);if(!s)return null;const o=s.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,n.push({content:s,scale:null,font:null,textColor:null,verticalAlign:null})}}return new i_(n)}evaluate(t){return new oy(this.sections.map(e=>{const i=e.content.evaluate(t);return yy(i)===Sm?new sy("",i,null,null,null,e.verticalAlign?e.verticalAlign.evaluate(t):null):new sy(_y(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null,e.verticalAlign?e.verticalAlign.evaluate(t):null)}))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor),e.verticalAlign&&t(e.verticalAlign)}outputDefined(){return!1}}class n_{constructor(t){this.type=Sm,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,dm);return i?new n_(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=fy.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}}class r_{constructor(t){this.type=cm,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const i=e.parse(t[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?e.error(`Expected argument of type string or array, but found ${Cm(i.type)} instead.`):new r_(i):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return[...e].length;if(Array.isArray(e))return e.length;throw new uy(`Expected value to be of type string or array, but found ${Cm(yy(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const s_=8192;function o_(t,e){const i=(180+t[0])/360,n=(r=t[1],(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360);var r;const s=Math.pow(2,e.z);return[Math.round(i*s*s_),Math.round(n*s*s_)]}function a_(t,e){const i=Math.pow(2,e.z);return[(r=(t[0]/s_+e.x)/i,360*r-180),(n=(t[1]/s_+e.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180))-90)];var n,r}function l_(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function h_(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function u_(t,e,i){return e[1]>t[1]!=i[1]>t[1]&&t[0]<(i[0]-e[0])*(t[1]-e[1])/(i[1]-e[1])+e[0]}function c_(t,e,i){const n=t[0]-e[0],r=t[1]-e[1],s=t[0]-i[0],o=t[1]-i[1];return n*o-s*r===0&&n*s<=0&&r*o<=0}function d_(t,e,i,n){const r=[e[0]-t[0],e[1]-t[1]];return 0!==(s=[n[0]-i[0],n[1]-i[1]])[0]*(o=r)[1]-s[1]*o[0]&&!(!__(t,e,i,n)||!__(i,n,t,e));var s,o}function f_(t,e,i){for(const n of i)for(let i=0;i<n.length-1;++i)if(d_(t,e,n[i],n[i+1]))return!0;return!1}function p_(t,e,i=!1){let n=!1;for(const r of e)for(let e=0;e<r.length-1;e++){if(c_(t,r[e],r[e+1]))return i;u_(t,r[e],r[e+1])&&(n=!n)}return n}function g_(t,e){for(const i of e)if(p_(t,i))return!0;return!1}function m_(t,e){for(const i of t)if(!p_(i,e))return!1;for(let i=0;i<t.length-1;++i)if(f_(t[i],t[i+1],e))return!1;return!0}function y_(t,e){for(const i of e)if(m_(t,i))return!0;return!1}function __(t,e,i,n){const r=t[0]-i[0],s=t[1]-i[1],o=e[0]-i[0],a=e[1]-i[1],l=n[0]-i[0],h=n[1]-i[1],u=r*h-l*s,c=o*h-l*a;return u>0&&c<0||u<0&&c>0}function v_(t,e,i){const n=[];for(let r=0;r<t.length;r++){const s=[];for(let n=0;n<t[r].length;n++){const o=o_(t[r][n],i);l_(e,o),s.push(o)}n.push(s)}return n}function x_(t,e,i){const n=[];for(let r=0;r<t.length;r++){const s=v_(t[r],e,i);n.push(s)}return n}function w_(t,e,i,n){if(t[0]<i[0]||t[0]>i[2]){const e=.5*n;let r=t[0]-i[0]>e?-n:i[0]-t[0]>e?n:0;0===r&&(r=t[0]-i[2]>e?-n:i[2]-t[0]>e?n:0),t[0]+=r}l_(e,t)}function b_(t,e,i,n){const r=Math.pow(2,n.z)*s_,s=[n.x*s_,n.y*s_],o=[];for(const n of t)for(const t of n){const n=[t.x+s[0],t.y+s[1]];w_(n,e,i,r),o.push(n)}return o}function S_(t,e,i,n){const r=Math.pow(2,n.z)*s_,s=[n.x*s_,n.y*s_],o=[];for(const i of t){const t=[];for(const n of i){const i=[n.x+s[0],n.y+s[1]];l_(e,i),t.push(i)}o.push(t)}if(e[2]-e[0]<=r/2){(a=e)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const t of o)for(const n of t)w_(n,e,i,r)}var a;return o}class M_{constructor(t,e){this.type=fm,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(my(t[1])){const e=t[1];if("FeatureCollection"===e.type){const t=[];for(const i of e.features){const{type:e,coordinates:n}=i.geometry;"Polygon"===e&&t.push(n),"MultiPolygon"===e&&t.push(...n)}if(t.length)return new M_(e,{type:"MultiPolygon",coordinates:t})}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new M_(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new M_(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if("Polygon"===e.type){const s=v_(e.coordinates,n,r),o=b_(t.geometry(),i,n,r);if(!h_(i,n))return!1;for(const t of o)if(!p_(t,s))return!1}if("MultiPolygon"===e.type){const s=x_(e.coordinates,n,r),o=b_(t.geometry(),i,n,r);if(!h_(i,n))return!1;for(const t of o)if(!g_(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if("Polygon"===e.type){const s=v_(e.coordinates,n,r),o=S_(t.geometry(),i,n,r);if(!h_(i,n))return!1;for(const t of o)if(!m_(t,s))return!1}if("MultiPolygon"===e.type){const s=x_(e.coordinates,n,r),o=S_(t.geometry(),i,n,r);if(!h_(i,n))return!1;for(const t of o)if(!y_(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class E_{constructor(t=[],e=(t,e)=>t<e?-1:t>e?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:i}=this,n=e[t];for(;t>0;){const r=t-1>>1,s=e[r];if(i(n,s)>=0)break;e[t]=s,t=r}e[t]=n}_down(t){const{data:e,compare:i}=this,n=this.length>>1,r=e[t];for(;t<n;){let n=1+(t<<1);const s=n+1;if(s<this.length&&i(e[s],e[n])<0&&(n=s),i(e[n],r)>=0)break;e[t]=e[n],t=n}e[t]=r}}function C_(t){let e=0;for(let i,n,r=0,s=t.length,o=s-1;r<s;o=r++)i=t[r],n=t[o],e+=(n.x-i.x)*(i.y+n.y);return e}const P_=1/298.257223563,I_=P_*(2-P_),T_=Math.PI/180;class R_{constructor(t){const e=6378.137*T_*1e3,i=Math.cos(t*T_),n=1/(1-I_*(1-i*i)),r=Math.sqrt(n);this.kx=e*r*i,this.ky=e*r*n*(1-I_)}distance(t,e){const i=this.wrap(t[0]-e[0])*this.kx,n=(t[1]-e[1])*this.ky;return Math.sqrt(i*i+n*n)}pointOnLine(t,e){let i,n,r,s,o=1/0;for(let a=0;a<t.length-1;a++){let l=t[a][0],h=t[a][1],u=this.wrap(t[a+1][0]-l)*this.kx,c=(t[a+1][1]-h)*this.ky,d=0;0===u&&0===c||(d=(this.wrap(e[0]-l)*this.kx*u+(e[1]-h)*this.ky*c)/(u*u+c*c),d>1?(l=t[a+1][0],h=t[a+1][1]):d>0&&(l+=u/this.kx*d,h+=c/this.ky*d)),u=this.wrap(e[0]-l)*this.kx,c=(e[1]-h)*this.ky;const f=u*u+c*c;f<o&&(o=f,i=l,n=h,r=a,s=d)}return{point:[i,n],index:r,t:Math.max(0,Math.min(1,s))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function k_(t,e){return e[0]-t[0]}function A_(t){return t[1]-t[0]+1}function G_(t,e){return t[1]>=t[0]&&t[1]<e}function O_(t,e){if(t[0]>t[1])return[null,null];const i=A_(t);if(e){if(2===i)return[t,null];const e=Math.floor(i/2);return[[t[0],t[0]+e],[t[0]+e,t[1]]]}if(1===i)return[t,null];const n=Math.floor(i/2)-1;return[[t[0],t[0]+n],[t[0]+n+1,t[1]]]}function F_(t,e){if(!G_(e,t.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)l_(i,t[n]);return i}function L_(t){const e=[1/0,1/0,-1/0,-1/0];for(const i of t)for(const t of i)l_(e,t);return e}function j_(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function N_(t,e,i){if(!j_(t)||!j_(e))return NaN;let n=0,r=0;return t[2]<e[0]&&(n=e[0]-t[2]),t[0]>e[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(r=t[1]-e[3]),t[3]<e[1]&&(r=e[1]-t[3]),i.distance([0,0],[n,r])}function D_(t,e,i){const n=i.pointOnLine(e,t);return i.distance(t,n.point)}function z_(t,e,i,n,r){const s=Math.min(D_(t,[i,n],r),D_(e,[i,n],r)),o=Math.min(D_(i,[t,e],r),D_(n,[t,e],r));return Math.min(s,o)}function q_(t,e,i,n,r){if(!G_(e,t.length)||!G_(n,i.length))return 1/0;let s=1/0;for(let o=e[0];o<e[1];++o){const e=t[o],a=t[o+1];for(let t=n[0];t<n[1];++t){const n=i[t],o=i[t+1];if(d_(e,a,n,o))return 0;s=Math.min(s,z_(e,a,n,o,r))}}return s}function $_(t,e,i,n,r){if(!G_(e,t.length)||!G_(n,i.length))return NaN;let s=1/0;for(let o=e[0];o<=e[1];++o)for(let e=n[0];e<=n[1];++e)if(s=Math.min(s,r.distance(t[o],i[e])),0===s)return s;return s}function B_(t,e,i){if(p_(t,e,!0))return 0;let n=1/0;for(const r of e){const e=r[0],s=r[r.length-1];if(e!==s&&(n=Math.min(n,D_(t,[s,e],i)),0===n))return n;const o=i.pointOnLine(r,t);if(n=Math.min(n,i.distance(t,o.point)),0===n)return n}return n}function U_(t,e,i,n){if(!G_(e,t.length))return NaN;for(let n=e[0];n<=e[1];++n)if(p_(t[n],i,!0))return 0;let r=1/0;for(let s=e[0];s<e[1];++s){const e=t[s],o=t[s+1];for(const t of i)for(let i=0,s=t.length,a=s-1;i<s;a=i++){const s=t[a],l=t[i];if(d_(e,o,s,l))return 0;r=Math.min(r,z_(e,o,s,l,n))}}return r}function W_(t,e){for(const i of t)for(const t of i)if(p_(t,e,!0))return!0;return!1}function X_(t,e,i,n=1/0){const r=L_(t),s=L_(e);if(n!==1/0&&N_(r,s,i)>=n)return n;if(h_(r,s)){if(W_(t,e))return 0}else if(W_(e,t))return 0;let o=1/0;for(const n of t)for(let t=0,r=n.length,s=r-1;t<r;s=t++){const r=n[s],a=n[t];for(const t of e)for(let e=0,n=t.length,s=n-1;e<n;s=e++){const n=t[s],l=t[e];if(d_(r,a,n,l))return 0;o=Math.min(o,z_(r,a,n,l,i))}}return o}function V_(t,e,i,n,r,s){if(!s)return;const o=N_(F_(n,s),r,i);o<e&&t.push([o,s,[0,0]])}function K_(t,e,i,n,r,s,o){if(!s||!o)return;const a=N_(F_(n,s),F_(r,o),i);a<e&&t.push([a,s,o])}function Y_(t,e,i,n,r=1/0){let s=Math.min(n.distance(t[0],i[0][0]),r);if(0===s)return s;const o=new E_([[0,[0,t.length-1],[0,0]]],k_),a=L_(i);for(;o.length>0;){const r=o.pop();if(r[0]>=s)continue;const l=r[1],h=e?50:100;if(A_(l)<=h){if(!G_(l,t.length))return NaN;if(e){const e=U_(t,l,i,n);if(isNaN(e)||0===e)return e;s=Math.min(s,e)}else for(let e=l[0];e<=l[1];++e){const r=B_(t[e],i,n);if(s=Math.min(s,r),0===s)return 0}}else{const i=O_(l,e);V_(o,s,n,t,a,i[0]),V_(o,s,n,t,a,i[1])}}return s}function Z_(t,e,i,n,r,s=1/0){let o=Math.min(s,r.distance(t[0],i[0]));if(0===o)return o;const a=new E_([[0,[0,t.length-1],[0,i.length-1]]],k_);for(;a.length>0;){const s=a.pop();if(s[0]>=o)continue;const l=s[1],h=s[2],u=e?50:100,c=n?50:100;if(A_(l)<=u&&A_(h)<=c){if(!G_(l,t.length)&&G_(h,i.length))return NaN;let s;if(e&&n)s=q_(t,l,i,h,r),o=Math.min(o,s);else if(e&&!n){const e=t.slice(l[0],l[1]+1);for(let t=h[0];t<=h[1];++t)if(s=D_(i[t],e,r),o=Math.min(o,s),0===o)return o}else if(!e&&n){const e=i.slice(h[0],h[1]+1);for(let i=l[0];i<=l[1];++i)if(s=D_(t[i],e,r),o=Math.min(o,s),0===o)return o}else s=$_(t,l,i,h,r),o=Math.min(o,s)}else{const s=O_(l,e),u=O_(h,n);K_(a,o,r,t,i,s[0],u[0]),K_(a,o,r,t,i,s[0],u[1]),K_(a,o,r,t,i,s[1],u[0]),K_(a,o,r,t,i,s[1],u[1])}}return o}function H_(t){return"MultiPolygon"===t.type?t.coordinates.map(t=>({type:"Polygon",coordinates:t})):"MultiLineString"===t.type?t.coordinates.map(t=>({type:"LineString",coordinates:t})):"MultiPoint"===t.type?t.coordinates.map(t=>({type:"Point",coordinates:t})):[t]}class J_{constructor(t,e){this.type=cm,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(my(t[1])){const e=t[1];if("FeatureCollection"===e.type)return new J_(e,e.features.map(t=>H_(t.geometry)).flat());if("Feature"===e.type)return new J_(e,H_(e.geometry));if("type"in e&&"coordinates"in e)return new J_(e,H_(e))}return e.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const i=t.geometry(),n=i.flat().map(e=>a_([e.x,e.y],t.canonical));if(0===i.length)return NaN;const r=new R_(n[0][1]);let s=1/0;for(const t of e){switch(t.type){case"Point":s=Math.min(s,Z_(n,!1,[t.coordinates],!1,r,s));break;case"LineString":s=Math.min(s,Z_(n,!1,t.coordinates,!0,r,s));break;case"Polygon":s=Math.min(s,Y_(n,!1,t.coordinates,r,s))}if(0===s)return s}return s}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=t.geometry(),n=i.flat().map(e=>a_([e.x,e.y],t.canonical));if(0===i.length)return NaN;const r=new R_(n[0][1]);let s=1/0;for(const t of e){switch(t.type){case"Point":s=Math.min(s,Z_(n,!0,[t.coordinates],!1,r,s));break;case"LineString":s=Math.min(s,Z_(n,!0,t.coordinates,!0,r,s));break;case"Polygon":s=Math.min(s,Y_(n,!0,t.coordinates,r,s))}if(0===s)return s}return s}(t,this.geometries);if("Polygon"===t.geometryType())return function(t,e){const i=t.geometry();if(0===i.length||0===i[0].length)return NaN;const n=function(t){if(t.length<=1)return[t];const e=[];let i,n;for(const r of t){const t=C_(r);0!==t&&(r.area=Math.abs(t),void 0===n&&(n=t<0),n===t<0?(i&&e.push(i),i=[r]):i.push(r))}return i&&e.push(i),e}(i).map(e=>e.map(e=>e.map(e=>a_([e.x,e.y],t.canonical)))),r=new R_(n[0][0][0][1]);let s=1/0;for(const t of e)for(const e of n){switch(t.type){case"Point":s=Math.min(s,Y_([t.coordinates],!1,e,r,s));break;case"LineString":s=Math.min(s,Y_(t.coordinates,!0,e,r,s));break;case"Polygon":s=Math.min(s,X_(e,t.coordinates,r,s))}if(0===s)return s}return s}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Q_{constructor(t){this.type=ym,this.key=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const i=t[1];return null==i?e.error("Global state property must be defined."):"string"!=typeof i?e.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new Q_(i)}evaluate(t){var e;const i=null===(e=t.globals)||void 0===e?void 0:e.globalState;return i&&0!==Object.keys(i).length?Km(i,this.key):null}eachChild(){}outputDefined(){return!1}}const tv={"==":Ky,"!=":Yy,">":Hy,"<":Zy,">=":Qy,"<=":Jy,array:wy,at:Ty,boolean:wy,case:Gy,coalesce:Uy,collator:t_,format:i_,image:n_,in:Ry,"index-of":ky,interpolate:$y,"interpolate-hcl":$y,"interpolate-lab":$y,length:r_,let:Py,literal:vy,match:Ay,number:wy,"number-format":e_,object:wy,slice:Oy,step:Ly,string:wy,"to-boolean":Sy,"to-color":Sy,"to-number":Sy,"to-string":Sy,var:Iy,within:M_,distance:J_,"global-state":Q_};class ev{constructor(t,e,i,n){this.name=t,this.type=e,this._evaluate=i,this.args=n}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,e){const i=t[0],n=ev.definitions[i];if(!n)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,o=s.filter(([e])=>!Array.isArray(e)||e.length===t.length-1);let a=null;for(const[n,s]of o){a=new Cy(e.registry,ov,e.path,null,e.scope);const o=[];let l=!1;for(let e=1;e<t.length;e++){const i=t[e],r=Array.isArray(n)?n[e-1]:n.type,s=a.parse(i,1+o.length,r);if(!s){l=!0;break}o.push(s)}if(!l)if(Array.isArray(n)&&n.length!==o.length)a.error(`Expected ${n.length} arguments, but found ${o.length} instead.`);else{for(let t=0;t<o.length;t++){const e=Array.isArray(n)?n[t]:n.type,i=o[t];a.concat(t+1).checkSubtype(e,i.type)}if(0===a.errors.length)return new ev(i,r,s,o)}}if(1===o.length)e.errors.push(...a.errors);else{const i=(o.length?o:s).map(([t])=>{return e=t,Array.isArray(e)?`(${e.map(Cm).join(", ")})`:`(${Cm(e.type)}...)`;var e}).join(" | "),n=[];for(let i=1;i<t.length;i++){const r=e.parse(t[i],1+n.length);if(!r)return null;n.push(Cm(r.type))}e.error(`Expected arguments of type ${i}, but found (${n.join(", ")}) instead.`)}return null}static register(t,e){ev.definitions=e;for(const i in e)t[i]=ev}}function iv(t,[e,i,n,r]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);const s=r?r.evaluate(t):1,o=gy(e,i,n,s);if(o)throw new uy(o);return new iy(e/255,i/255,n/255,s,!1)}function nv(t,e){return t in e}function rv(t,e){const i=e[t];return void 0===i?null:i}function sv(t){return{type:t}}function ov(t){if(t instanceof Iy)return ov(t.boundExpression);if(t instanceof ev&&"error"===t.name)return!1;if(t instanceof t_)return!1;if(t instanceof M_)return!1;if(t instanceof J_)return!1;if(t instanceof Q_)return!1;const e=t instanceof Sy||t instanceof wy;let i=!0;return t.eachChild(t=>{i=e?i&&ov(t):i&&t instanceof vy}),!!i&&av(t)&&hv(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function av(t){if(t instanceof ev){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof M_)return!1;if(t instanceof J_)return!1;let e=!0;return t.eachChild(t=>{e&&!av(t)&&(e=!1)}),e}function lv(t){if(t instanceof ev&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild(t=>{e&&!lv(t)&&(e=!1)}),e}function hv(t,e){if(t instanceof ev&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild(t=>{i&&!hv(t,e)&&(i=!1)}),i}function uv(t){return{result:"success",value:t}}function cv(t){return{result:"error",value:t}}function dv(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function fv(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function pv(t){return!!t.expression&&t.expression.interpolated}function gv(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function mv(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)&&yy(t)===mm}ev.register(tv,{error:[{kind:"error"},[dm],(t,[e])=>{throw new uy(e.evaluate(t))}],typeof:[dm,[ym],(t,[e])=>Cm(yy(e.evaluate(t)))],"to-rgba":[Em(cm,4),[pm],(t,[e])=>{const[i,n,r,s]=e.evaluate(t).rgb;return[255*i,255*n,255*r,s]}],rgb:[pm,[cm,cm,cm],iv],rgba:[pm,[cm,cm,cm,cm],iv],has:{type:fm,overloads:[[[dm],(t,[e])=>nv(e.evaluate(t),t.properties())],[[dm,mm],(t,[e,i])=>nv(e.evaluate(t),i.evaluate(t))]]},get:{type:ym,overloads:[[[dm],(t,[e])=>rv(e.evaluate(t),t.properties())],[[dm,mm],(t,[e,i])=>rv(e.evaluate(t),i.evaluate(t))]]},"feature-state":[ym,[dm],(t,[e])=>rv(e.evaluate(t),t.featureState||{})],properties:[mm,[],t=>t.properties()],"geometry-type":[dm,[],t=>t.geometryType()],id:[ym,[],t=>t.id()],zoom:[cm,[],t=>t.globals.zoom],"heatmap-density":[cm,[],t=>t.globals.heatmapDensity||0],elevation:[cm,[],t=>t.globals.elevation||0],"line-progress":[cm,[],t=>t.globals.lineProgress||0],accumulated:[ym,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[cm,sv(cm),(t,e)=>{let i=0;for(const n of e)i+=n.evaluate(t);return i}],"*":[cm,sv(cm),(t,e)=>{let i=1;for(const n of e)i*=n.evaluate(t);return i}],"-":{type:cm,overloads:[[[cm,cm],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[cm],(t,[e])=>-e.evaluate(t)]]},"/":[cm,[cm,cm],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[cm,[cm,cm],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[cm,[],()=>Math.LN2],pi:[cm,[],()=>Math.PI],e:[cm,[],()=>Math.E],"^":[cm,[cm,cm],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[cm,[cm],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[cm,[cm],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[cm,[cm],(t,[e])=>Math.log(e.evaluate(t))],log2:[cm,[cm],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[cm,[cm],(t,[e])=>Math.sin(e.evaluate(t))],cos:[cm,[cm],(t,[e])=>Math.cos(e.evaluate(t))],tan:[cm,[cm],(t,[e])=>Math.tan(e.evaluate(t))],asin:[cm,[cm],(t,[e])=>Math.asin(e.evaluate(t))],acos:[cm,[cm],(t,[e])=>Math.acos(e.evaluate(t))],atan:[cm,[cm],(t,[e])=>Math.atan(e.evaluate(t))],min:[cm,sv(cm),(t,e)=>Math.min(...e.map(e=>e.evaluate(t)))],max:[cm,sv(cm),(t,e)=>Math.max(...e.map(e=>e.evaluate(t)))],abs:[cm,[cm],(t,[e])=>Math.abs(e.evaluate(t))],round:[cm,[cm],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[cm,[cm],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[cm,[cm],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[fm,[dm,ym],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[fm,[ym],(t,[e])=>t.id()===e.value],"filter-type-==":[fm,[dm],(t,[e])=>t.geometryType()===e.value],"filter-<":[fm,[dm,ym],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<r}],"filter-id-<":[fm,[ym],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<n}],"filter->":[fm,[dm,ym],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>r}],"filter-id->":[fm,[ym],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[fm,[dm,ym],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<=r}],"filter-id-<=":[fm,[ym],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[fm,[dm,ym],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>=r}],"filter-id->=":[fm,[ym],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[fm,[ym],(t,[e])=>e.value in t.properties()],"filter-has-id":[fm,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[fm,[Em(dm)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[fm,[Em(ym)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[fm,[dm,Em(ym)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[fm,[dm,Em(ym)],(t,[e,i])=>function(t,e,i,n){for(;i<=n;){const r=i+n>>1;if(e[r]===t)return!0;e[r]>t?n=r-1:i=r+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:fm,overloads:[[[fm,fm],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[sv(fm),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:fm,overloads:[[[fm,fm],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[sv(fm),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[fm,[fm],(t,[e])=>!e.evaluate(t)],"is-supported-script":[fm,[dm],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[dm,[dm],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[dm,[dm],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[dm,sv(ym),(t,e)=>e.map(e=>_y(e.evaluate(t))).join("")],split:[Em(dm),[dm,dm],(t,[e,i])=>e.evaluate(t).split(i.evaluate(t))],join:[dm,[Em(dm),dm],(t,[e,i])=>e.evaluate(t).join(i.evaluate(t))],"resolved-locale":[dm,[_m],(t,[e])=>e.evaluate(t).resolvedLocale()]});class yv{constructor(t,e,i){this.expression=t,this._warningHistory={},this._evaluator=new Ey,this._defaultValue=e?function(t){if("color"===t.type&&mv(t.default))return new iy(0,0,0,0);switch(t.type){case"color":return iy.parse(t.default)||null;case"padding":return ay.parse(t.default)||null;case"numberArray":return ly.parse(t.default)||null;case"colorArray":return hy.parse(t.default)||null;case"variableAnchorOffsetCollection":return dy.parse(t.default)||null;case"projectionDefinition":return py.parse(t.default)||null;default:return void 0===t.default?null:t.default}}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null,this._globalState=i}evaluateWithoutErrorHandling(t,e,i,n,r,s){return this._globalState&&(t=Ev(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=n,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=s,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,n,r,s){this._globalState&&(t=Ev(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=s||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new uy(`Expected value to be one of ${Object.keys(this._enumValues).map(t=>JSON.stringify(t)).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function _v(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in tv}function vv(t,e,i){const n=new Cy(tv,ov,[],e?function(t){const e={color:pm,string:dm,number:cm,enum:dm,boolean:fm,formatted:vm,padding:xm,numberArray:bm,colorArray:wm,projectionDefinition:gm,resolvedImage:Sm,variableAnchorOffsetCollection:Mm};return"array"===t.type?Em(e[t.value]||ym,t.length):e[t.type]}(e):void 0),r=n.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return r?uv(new yv(r,e,i)):cv(n.errors)}class xv{constructor(t,e,i){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!lv(e.expression),this.globalStateRefs=Mv(e.expression),this._globalState=i}evaluateWithoutErrorHandling(t,e,i,n,r,s){return this._globalState&&(t=Ev(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,s)}evaluate(t,e,i,n,r,s){return this._globalState&&(t=Ev(t,this._globalState)),this._styleExpression.evaluate(t,e,i,n,r,s)}}class wv{constructor(t,e,i,n,r){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!lv(e.expression),this.globalStateRefs=Mv(e.expression),this.interpolationType=n,this._globalState=r}evaluateWithoutErrorHandling(t,e,i,n,r,s){return this._globalState&&(t=Ev(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,s)}evaluate(t,e,i,n,r,s){return this._globalState&&(t=Ev(t,this._globalState)),this._styleExpression.evaluate(t,e,i,n,r,s)}interpolationFactor(t,e,i){return this.interpolationType?$y.interpolationFactor(this.interpolationType,t,e,i):0}}function bv(t,e,i){const n=vv(t,e,i);if("error"===n.result)return n;const r=n.value.expression,s=av(r);if(!s&&!dv(e))return cv([new lm("","data expressions not supported")]);const o=hv(r,["zoom"]);if(!o&&!fv(e))return cv([new lm("","zoom expressions not supported")]);const a=Sv(r);if(!a&&!o)return cv([new lm("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof lm)return cv([a]);if(a instanceof $y&&!pv(e))return cv([new lm("",'"interpolate" expressions cannot be used with this property')]);if(!a)return uv(new xv(s?"constant":"source",n.value,i));const l=a instanceof $y?a.interpolation:void 0;return uv(new wv(s?"camera":"composite",n.value,a.labels,l,i))}function Sv(t){let e=null;if(t instanceof Py)e=Sv(t.result);else if(t instanceof Uy){for(const i of t.args)if(e=Sv(i),e)break}else(t instanceof Ly||t instanceof $y)&&t.input instanceof ev&&"zoom"===t.input.name&&(e=t);return e instanceof lm||t.eachChild(t=>{const i=Sv(t);i instanceof lm?e=i:!e&&i?e=new lm("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new lm("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Mv(t,e=new Set){return t instanceof Q_&&e.add(t.key),t.eachChild(t=>{Mv(t,e)}),e}function Ev(t,e){const{zoom:i,heatmapDensity:n,elevation:r,lineProgress:s,isSupportedScript:o,accumulated:a}=null!=t?t:{};return{zoom:i,heatmapDensity:n,elevation:r,lineProgress:s,isSupportedScript:o,accumulated:a,globalState:e}}function Cv(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!Cv(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const Pv={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Iv(t,e){return t<e?-1:t>e?1:0}function Tv(t){if(!Array.isArray(t))return!1;if("within"===t[0]||"distance"===t[0])return!0;for(let e=1;e<t.length;e++)if(Tv(t[e]))return!0;return!1}function Rv(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?kv(t[1],t[2],"=="):"!="===e?Ov(kv(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?kv(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map(Rv))):"all"===e?["all"].concat(t.slice(1).map(Rv)):"none"===e?["all"].concat(t.slice(1).map(Rv).map(Ov)):"in"===e?Av(t[1],t.slice(2)):"!in"===e?Ov(Av(t[1],t.slice(2))):"has"===e?Gv(t[1]):"!has"!==e||Ov(Gv(t[1]));var i}function kv(t,e,i){switch(t){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,t,e]}}function Av(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",t,["literal",e.sort(Iv)]]:["filter-in-small",t,["literal",e]]}}function Gv(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Ov(t){return["!",t]}function Fv(t){return"object"==typeof t?["literal",t]:t}function Lv(t,e){let i=t.stops;if(!i)return function(t,e){const i=["get",t.property];if(void 0===t.default)return"string"===e.type?["string",i]:i;if("enum"===e.type)return["match",i,Object.keys(e.values),i,t.default];{const n=["color"===e.type?"to-color":e.type,i,Fv(t.default)];return"array"===e.type&&n.splice(1,0,e.value,e.length||null),n}}(t,e);const n=i&&"object"==typeof i[0][0],r=n||void 0!==t.property,s=n||!r;return i=i.map(t=>!r&&e.tokens&&"string"==typeof t[1]?[t[0],Bv(t[1])]:[t[0],Fv(t[1])]),n?function(t,e,i){const n={},r={},s=[];for(let e=0;e<i.length;e++){const o=i[e],a=o[0].zoom;void 0===n[a]&&(n[a]={zoom:a,type:t.type,property:t.property,default:t.default},r[a]=[],s.push(a)),r[a].push([o[0].value,o[1]])}if("exponential"===$v({},e)){const i=[jv(t),["linear"],["zoom"]];for(const t of s)qv(i,t,Dv(n[t],e,r[t]),!1);return i}{const t=["step",["zoom"]];for(const i of s)qv(t,i,Dv(n[i],e,r[i]),!0);return zv(t),t}}(t,e,i):s?function(t,e,i,n=["zoom"]){const r=$v(t,e);let s,o=!1;if("interval"===r)s=["step",n],o=!0;else{if("exponential"!==r)throw new Error(`Unknown zoom function type "${r}"`);{const e=void 0!==t.base?t.base:1;s=[jv(t),1===e?["linear"]:["exponential",e],n]}}for(const t of i)qv(s,t[0],t[1],o);return zv(s),s}(t,e,i):Dv(t,e,i)}function jv(t){switch(t.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function Nv(t,e){const i=Fv((n=t.default,r=e.default,void 0!==n?n:void 0!==r?r:void 0));var n,r;return void 0===i&&"resolvedImage"===e.type?"":i}function Dv(t,e,i){const n=$v(t,e),r=["get",t.property];if("categorical"===n&&"boolean"==typeof i[0][0]){const n=["case"];for(const t of i)n.push(["==",r,t[0]],t[1]);return n.push(Nv(t,e)),n}if("categorical"===n){const n=["match",r];for(const t of i)qv(n,t[0],t[1],!1);return n.push(Nv(t,e)),n}if("interval"===n){const e=["step",["number",r]];for(const t of i)qv(e,t[0],t[1],!0);return zv(e),void 0===t.default?e:["case",["==",["typeof",r],"number"],e,Fv(t.default)]}if("exponential"===n){const e=void 0!==t.base?t.base:1,n=[jv(t),1===e?["linear"]:["exponential",e],["number",r]];for(const t of i)qv(n,t[0],t[1],!1);return void 0===t.default?n:["case",["==",["typeof",r],"number"],n,Fv(t.default)]}throw new Error(`Unknown property function type ${n}`)}function zv(t){"step"===t[0]&&3===t.length&&(t.push(0),t.push(t[3]))}function qv(t,e,i,n){t.length>3&&e===t[t.length-2]||(n&&2===t.length||t.push(e),t.push(i))}function $v(t,e){return t.type?t.type:e.expression.interpolated?"exponential":"interval"}function Bv(t){const e=["concat"],i=/{([^{}]+)}/g;let n=0;for(let r=i.exec(t);null!==r;r=i.exec(t)){const s=t.slice(n,i.lastIndex-r[0].length);n=i.lastIndex,s.length>0&&e.push(s),e.push(["get",r[1]])}if(1===e.length)return t;if(n<t.length)e.push(t.slice(n));else if(2===e.length)return["to-string",e[1]];return e}function Uv(t){const e=t.key,i=t.value;return i?[new om(e,i,"constants have been deprecated as of v8")]:[]}function Wv(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Xv(t){if(Array.isArray(t))return t.map(Xv);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=Xv(t[i]);return e}return Wv(t)}function Vv(t){const e=t.key,i=t.value,n=t.valueSpec||{},r=t.objectElementValidators||{},s=t.style,o=t.styleSpec,a=t.validateSpec;let l=[];const h=gv(i);if("object"!==h)return[new om(e,i,`object expected, ${h} found`)];for(const t in i){const h=t.split(".")[0],u=Km(n,h)||n["*"];let c;if(Km(r,h))c=r[h];else if(Km(n,h)){if(void 0===i[t])continue;c=a}else if(r["*"])c=r["*"];else{if(!n["*"]){l.push(new om(e,i[t],`unknown property "${t}"`));continue}c=a}l=l.concat(c({key:(e?`${e}.`:e)+t,value:i[t],valueSpec:u,style:s,styleSpec:o,object:i,objectKey:t,validateSpec:a},i))}for(const t in n)r[t]||n[t].required&&void 0===n[t].default&&void 0===i[t]&&l.push(new om(e,i,`missing required property "${t}"`));return l}function Kv(t){const e=t.value,i=t.valueSpec,n=t.validateSpec,r=t.style,s=t.styleSpec,o=t.key,a=t.arrayElementValidator||n;if("array"!==gv(e))return[new om(o,e,`array expected, ${gv(e)} found`)];if(i.length&&e.length!==i.length)return[new om(o,e,`array length ${i.length} expected, length ${e.length} found`)];let l={type:i.value,values:i.values};s.$version<7&&(l.function=i.function),"object"===gv(i.value)&&(l=i.value);let h=[];for(let i=0;i<e.length;i++)h=h.concat(a({array:e,arrayIndex:i,value:e[i],valueSpec:l,validateSpec:t.validateSpec,style:r,styleSpec:s,key:`${o}[${i}]`}));return h}function Yv(t){const e=t.key,i=t.value,n=t.valueSpec;let r=gv(i);return"number"===r&&i!=i&&(r="NaN"),"number"!==r?[new om(e,i,`number expected, ${r} found`)]:"minimum"in n&&i<n.minimum?[new om(e,i,`${i} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&i>n.maximum?[new om(e,i,`${i} is greater than the maximum value ${n.maximum}`)]:[]}function Zv(t){const e=t.valueSpec,i=Wv(t.value.type);let n,r,s,o={};const a="categorical"!==i&&void 0===t.value.property,l=!a,h="array"===gv(t.value.stops)&&"array"===gv(t.value.stops[0])&&"object"===gv(t.value.stops[0][0]),u=Vv({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===i)return[new om(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const n=t.value;return e=e.concat(Kv({key:t.key,value:n,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:c})),"array"===gv(n)&&0===n.length&&e.push(new om(t.key,n,"array must have at least one stop")),e},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===i&&a&&u.push(new om(t.key,t.value,'missing required property "property"')),"identity"===i||t.value.stops||u.push(new om(t.key,t.value,'missing required property "stops"')),"exponential"===i&&t.valueSpec.expression&&!pv(t.valueSpec)&&u.push(new om(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!dv(t.valueSpec)?u.push(new om(t.key,t.value,"property functions not supported")):a&&!fv(t.valueSpec)&&u.push(new om(t.key,t.value,"zoom functions not supported"))),"categorical"!==i&&!h||void 0!==t.value.property||u.push(new om(t.key,t.value,'"property" property is required')),u;function c(t){let i=[];const n=t.value,a=t.key;if("array"!==gv(n))return[new om(a,n,`array expected, ${gv(n)} found`)];if(2!==n.length)return[new om(a,n,`array length 2 expected, length ${n.length} found`)];if(h){if("object"!==gv(n[0]))return[new om(a,n,`object expected, ${gv(n[0])} found`)];if(void 0===n[0].zoom)return[new om(a,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new om(a,n,"object stop key must have value")];if(s&&s>Wv(n[0].zoom))return[new om(a,n[0].zoom,"stop zoom values must appear in ascending order")];Wv(n[0].zoom)!==s&&(s=Wv(n[0].zoom),r=void 0,o={}),i=i.concat(Vv({key:`${a}[0]`,value:n[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Yv,value:d}}))}else i=i.concat(d({key:`${a}[0]`,value:n[0],validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},n));return _v(Xv(n[1]))?i.concat([new om(`${a}[1]`,n[1],"expressions are not allowed in function stops.")]):i.concat(t.validateSpec({key:`${a}[1]`,value:n[1],valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function d(t,s){const a=gv(t.value),l=Wv(t.value),h=null!==t.value?t.value:s;if(n){if(a!==n)return[new om(t.key,h,`${a} stop domain type must match previous stop domain type ${n}`)]}else n=a;if("number"!==a&&"string"!==a&&"boolean"!==a)return[new om(t.key,h,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==i){let n=`number expected, ${a} found`;return dv(e)&&void 0===i&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new om(t.key,h,n)]}return"categorical"!==i||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===a&&void 0!==r&&l<r?[new om(t.key,h,"stop domain values must appear in ascending order")]:(r=l,"categorical"===i&&l in o?[new om(t.key,h,"stop domain values must be unique")]:(o[l]=!0,[])):[new om(t.key,h,`integer expected, found ${l}`)]}}function Hv(t){const e=("property"===t.expressionContext?bv:vv)(Xv(t.value),t.valueSpec);if("error"===e.result)return e.value.map(e=>new om(`${t.key}${e.key}`,t.value,e.message));const i=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!i.outputDefined())return[new om(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!lv(i))return[new om(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!lv(i))return[new om(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!hv(i,["zoom","feature-state"]))return[new om(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!av(i))return[new om(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Jv(t){const e=t.key,i=t.value,n=gv(i);return"string"!==n?[new om(e,i,`color expected, ${n} found`)]:iy.parse(String(i))?[]:[new om(e,i,`color expected, "${i}" found`)]}function Qv(t){const e=t.key,i=t.value,n=t.valueSpec,r=[];return Array.isArray(n.values)?-1===n.values.indexOf(Wv(i))&&r.push(new om(e,i,`expected one of [${n.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(n.values).indexOf(Wv(i))&&r.push(new om(e,i,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(i)} found`)),r}function tx(t){return Cv(Xv(t.value))?Hv(am({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):ex(t)}function ex(t){const e=t.value,i=t.key;if("array"!==gv(e))return[new om(i,e,`array expected, ${gv(e)} found`)];const n=t.styleSpec;let r,s=[];if(e.length<1)return[new om(i,e,"filter array must have at least 1 element")];switch(s=s.concat(Qv({key:`${i}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),Wv(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===Wv(e[1])&&s.push(new om(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&s.push(new om(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(r=gv(e[1]),"string"!==r&&s.push(new om(`${i}[1]`,e[1],`string expected, ${r} found`)));for(let o=2;o<e.length;o++)r=gv(e[o]),"$type"===Wv(e[1])?s=s.concat(Qv({key:`${i}[${o}]`,value:e[o],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==r&&"number"!==r&&"boolean"!==r&&s.push(new om(`${i}[${o}]`,e[o],`string, number, or boolean expected, ${r} found`));break;case"any":case"all":case"none":for(let n=1;n<e.length;n++)s=s.concat(ex({key:`${i}[${n}]`,value:e[n],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":r=gv(e[1]),2!==e.length?s.push(new om(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==r&&s.push(new om(`${i}[1]`,e[1],`string expected, ${r} found`))}return s}function ix(t,e){const i=t.key,n=t.validateSpec,r=t.style,s=t.styleSpec,o=t.value,a=t.objectKey,l=s[`${e}_${t.layerType}`];if(!l)return[];const h=a.match(/^(.*)-transition$/);if("paint"===e&&h&&l[h[1]]&&l[h[1]].transition)return n({key:i,value:o,valueSpec:s.transition,style:r,styleSpec:s});const u=t.valueSpec||l[a];if(!u)return[new om(i,o,`unknown property "${a}"`)];let c;if("string"===gv(o)&&dv(u)&&!u.tokens&&(c=/^{([^}]+)}$/.exec(o)))return[new om(i,o,`"${a}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(c[1])} }\`.`)];const d=[];return"symbol"===t.layerType&&"text-font"===a&&mv(Xv(o))&&"identity"===Wv(o.type)&&d.push(new om(i,o,'"text-font" does not support identity functions')),d.concat(n({key:t.key,value:o,valueSpec:u,style:r,styleSpec:s,expressionContext:"property",propertyType:e,propertyKey:a}))}function nx(t){return ix(t,"paint")}function rx(t){return ix(t,"layout")}function sx(t){var e,i;let n=[];const r=t.value,s=t.key,o=t.style,a=t.styleSpec;if("object"!==gv(r))return[new om(s,r,`object expected, ${gv(r)} found`)];r.type||r.ref||n.push(new om(s,r,'either "type" or "ref" is required'));let l=Wv(r.type);const h=Wv(r.ref);if(r.id){const e=Wv(r.id);for(let i=0;i<t.arrayIndex;i++){const t=o.layers[i];Wv(t.id)===e&&n.push(new om(s,r.id,`duplicate layer id "${r.id}", previously used at line ${t.id.__line__}`))}}if("ref"in r){let t;["type","source","source-layer","filter","layout"].forEach(t=>{t in r&&n.push(new om(s,r[t],`"${t}" is prohibited for ref layers`))}),o.layers.forEach(e=>{Wv(e.id)===h&&(t=e)}),t?t.ref?n.push(new om(s,r.ref,"ref cannot reference another ref layer")):l=Wv(t.type):n.push(new om(s,r.ref,`ref layer "${h}" not found`))}else if("background"!==l)if(r.source){const t=o.sources&&o.sources[r.source],e=t&&Wv(t.type);t?"vector"===e&&"raster"===l?n.push(new om(s,r.source,`layer "${r.id}" requires a raster source`)):"raster-dem"!==e&&"hillshade"===l||"raster-dem"!==e&&"color-relief"===l?n.push(new om(s,r.source,`layer "${r.id}" requires a raster-dem source`)):"raster"===e&&"raster"!==l?n.push(new om(s,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==e||r["source-layer"]?"raster-dem"===e&&"hillshade"!==l&&"color-relief"!==l?n.push(new om(s,r.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"!==l||!r.paint||!r.paint["line-gradient"]||"geojson"===e&&t.lineMetrics||n.push(new om(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):n.push(new om(s,r,`layer "${r.id}" must specify a "source-layer"`)):n.push(new om(s,r.source,`source "${r.source}" not found`))}else n.push(new om(s,r,'missing required property "source"'));return"raster"===l&&(null===(e=r.paint)||void 0===e?void 0:e.resampling)&&(null===(i=r.paint)||void 0===i?void 0:i["raster-resampling"])&&n.push(new om(s,r.paint,`layer "${r.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),n=n.concat(Vv({key:s,value:r,valueSpec:a.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${s}.type`,value:r.type,valueSpec:a.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"}),filter:tx,layout:t=>Vv({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>rx(am({layerType:l},t))}}),paint:t=>Vv({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>nx(am({layerType:l},t))}})}})),n}function ox(t){const e=t.value,i=t.key,n=gv(e);return"string"!==n?[new om(i,e,`string expected, ${n} found`)]:[]}const ax={promoteId:function({key:t,value:e}){if("string"===gv(e))return ox({key:t,value:e});{const i=[];for(const n in e)i.push(...ox({key:`${t}.${n}`,value:e[n]}));return i}}};function lx(t){const e=t.value,i=t.key,n=t.styleSpec,r=t.style,s=t.validateSpec;if(!e.type)return[new om(i,e,'"type" is required')];const o=Wv(e.type);let a;switch(o){case"vector":case"raster":return a=Vv({key:i,value:e,valueSpec:n[`source_${o.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:ax,validateSpec:s}),a;case"raster-dem":return a=function(t){var e;const i=null!==(e=t.sourceName)&&void 0!==e?e:"",n=t.value,r=t.styleSpec,s=r.source_raster_dem,o=t.style;let a=[];const l=gv(n);if(void 0===n)return a;if("object"!==l)return a.push(new om("source_raster_dem",n,`object expected, ${l} found`)),a;const h="custom"===Wv(n.encoding),u=["redFactor","greenFactor","blueFactor","baseShift"],c=t.value.encoding?`"${t.value.encoding}"`:"Default";for(const e in n)!h&&u.includes(e)?a.push(new om(e,n[e],`In "${i}": "${e}" is only valid when "encoding" is set to "custom". ${c} encoding found`)):s[e]?a=a.concat(t.validateSpec({key:e,value:n[e],valueSpec:s[e],validateSpec:t.validateSpec,style:o,styleSpec:r})):a.push(new om(e,n[e],`unknown property "${e}"`));return a}({sourceName:i,value:e,style:t.style,styleSpec:n,validateSpec:s}),a;case"geojson":if(a=Vv({key:i,value:e,valueSpec:n.source_geojson,style:r,styleSpec:n,validateSpec:s,objectElementValidators:ax}),e.cluster)for(const t in e.clusterProperties){const[n,r]=e.clusterProperties[t],s="string"==typeof n?[n,["accumulated"],["get",t]]:n;a.push(...Hv({key:`${i}.${t}.map`,value:r,expressionContext:"cluster-map"})),a.push(...Hv({key:`${i}.${t}.reduce`,value:s,expressionContext:"cluster-reduce"}))}return a;case"video":return Vv({key:i,value:e,valueSpec:n.source_video,style:r,validateSpec:s,styleSpec:n});case"image":return Vv({key:i,value:e,valueSpec:n.source_image,style:r,validateSpec:s,styleSpec:n});case"canvas":return[new om(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Qv({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function hx(t){const e=t.value,i=t.styleSpec,n=i.light,r=t.style;let s=[];const o=gv(e);if(void 0===e)return s;if("object"!==o)return s=s.concat([new om("light",e,`object expected, ${o} found`)]),s;for(const o in e){const a=o.match(/^(.*)-transition$/);s=a&&n[a[1]]&&n[a[1]].transition?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:i.transition,validateSpec:t.validateSpec,style:r,styleSpec:i})):n[o]?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:n[o],validateSpec:t.validateSpec,style:r,styleSpec:i})):s.concat([new om(o,e[o],`unknown property "${o}"`)])}return s}function ux(t){const e=t.value,i=t.styleSpec,n=i.sky,r=t.style,s=gv(e);if(void 0===e)return[];if("object"!==s)return[new om("sky",e,`object expected, ${s} found`)];let o=[];for(const s in e)o=n[s]?o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:r,styleSpec:i})):o.concat([new om(s,e[s],`unknown property "${s}"`)]);return o}function cx(t){const e=t.value,i=t.styleSpec,n=i.terrain,r=t.style;let s=[];const o=gv(e);if(void 0===e)return s;if("object"!==o)return s=s.concat([new om("terrain",e,`object expected, ${o} found`)]),s;for(const o in e)s=n[o]?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:n[o],validateSpec:t.validateSpec,style:r,styleSpec:i})):s.concat([new om(o,e[o],`unknown property "${o}"`)]);return s}function dx(t){let e=[];const i=t.value,n=t.key;if(Array.isArray(i)){const r=[],s=[];for(const o in i){i[o].id&&r.includes(i[o].id)&&e.push(new om(n,i,`all the sprites' ids must be unique, but ${i[o].id} is duplicated`)),r.push(i[o].id),i[o].url&&s.includes(i[o].url)&&e.push(new om(n,i,`all the sprites' URLs must be unique, but ${i[o].url} is duplicated`)),s.push(i[o].url);const a={id:{type:"string",required:!0},url:{type:"string",required:!0}};e=e.concat(Vv({key:`${n}[${o}]`,value:i[o],valueSpec:a,validateSpec:t.validateSpec}))}return e}return ox({key:n,value:i})}function fx(t){return Boolean(t)&&t.constructor===Object}function px(t){return fx(t.value)?[]:[new om(t.key,t.value,`object expected, ${gv(t.value)} found`)]}const gx={"*":()=>[],array:Kv,boolean:function(t){const e=t.value,i=t.key,n=gv(e);return"boolean"!==n?[new om(i,e,`boolean expected, ${n} found`)]:[]},number:Yv,color:Jv,constants:Uv,enum:Qv,filter:tx,function:Zv,layer:sx,object:Vv,source:lx,light:hx,sky:ux,terrain:cx,projection:function(t){const e=t.value,i=t.styleSpec,n=i.projection,r=t.style,s=gv(e);if(void 0===e)return[];if("object"!==s)return[new om("projection",e,`object expected, ${s} found`)];let o=[];for(const s in e)o=n[s]?o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:r,styleSpec:i})):o.concat([new om(s,e[s],`unknown property "${s}"`)]);return o},projectionDefinition:function(t){const e=t.key;let i=t.value;i=i instanceof String?i.valueOf():i;const n=gv(i);return"array"!==n||function(t){return Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]}(i)||function(t){return!!["interpolate","step","literal"].includes(t[0])}(i)?["array","string"].includes(n)?[]:[new om(e,i,`projection expected, invalid type "${n}" found`)]:[new om(e,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:ox,formatted:function(t){return 0===ox(t).length?[]:Hv(t)},resolvedImage:function(t){return 0===ox(t).length?[]:Hv(t)},padding:function(t){const e=t.key,i=t.value;if("array"===gv(i)){if(i.length<1||i.length>4)return[new om(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];const n={type:"number"};let r=[];for(let s=0;s<i.length;s++)r=r.concat(t.validateSpec({key:`${e}[${s}]`,value:i[s],validateSpec:t.validateSpec,valueSpec:n}));return r}return Yv({key:e,value:i,valueSpec:{}})},numberArray:function(t){const e=t.key,i=t.value;if("array"===gv(i)){const n={type:"number"};if(i.length<1)return[new om(e,i,"array length at least 1 expected, length 0 found")];let r=[];for(let s=0;s<i.length;s++)r=r.concat(t.validateSpec({key:`${e}[${s}]`,value:i[s],validateSpec:t.validateSpec,valueSpec:n}));return r}return Yv({key:e,value:i,valueSpec:{}})},colorArray:function(t){const e=t.key,i=t.value;if("array"===gv(i)){if(i.length<1)return[new om(e,i,"array length at least 1 expected, length 0 found")];let t=[];for(let n=0;n<i.length;n++)t=t.concat(Jv({key:`${e}[${n}]`,value:i[n]}));return t}return Jv({key:e,value:i})},variableAnchorOffsetCollection:function(t){const e=t.key,i=t.value,n=gv(i),r=t.styleSpec;if("array"!==n||i.length<1||i.length%2!=0)return[new om(e,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let s=[];for(let n=0;n<i.length;n+=2)s=s.concat(Qv({key:`${e}[${n}]`,value:i[n],valueSpec:r.layout_symbol["text-anchor"]})),s=s.concat(Kv({key:`${e}[${n+1}]`,value:i[n+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:r}));return s},sprite:dx,state:px,fontFaces:function(t){const e=t.key,i=t.value,n=t.validateSpec,r=t.styleSpec,s=t.style;if(!fx(i))return[new om(e,i,`object expected, ${gv(i)} found`)];const o=[];for(const t in i){const a=i[t],l=gv(a);if("string"===l)o.push(...ox({key:`${e}.${t}`,value:a}));else if("array"===l){const i={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(const[l,h]of a.entries())o.push(...Vv({key:`${e}.${t}[${l}]`,value:h,valueSpec:i,styleSpec:r,style:s,validateSpec:n}))}else o.push(new om(`${e}.${t}`,a,`string or array expected, ${l} found`))}return o}};function mx(t){const e=t.value,i=t.valueSpec,n=t.styleSpec;return t.validateSpec=mx,i.expression&&mv(Wv(e))?Zv(t):i.expression&&_v(Xv(e))?Hv(t):i.type&&gx[i.type]?gx[i.type](t):Vv(am({},t,{valueSpec:i.type?n[i.type]:i}))}function yx(t){const e=t.value,i=t.key,n=ox(t);return n.length||(-1===e.indexOf("{fontstack}")&&n.push(new om(i,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&n.push(new om(i,e,'"glyphs" url must include a "{range}" token'))),n}function _x(t,e=nm){let i=[];return i=i.concat(mx({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:mx,objectElementValidators:{glyphs:yx,"*":()=>[]}})),t.constants&&(i=i.concat(Uv({key:"constants",value:t.constants}))),xx(i)}function vx(t){return function(e){return t(Object.assign({},e,{validateSpec:mx}))}}function xx(t){return[].concat(t).sort((t,e)=>t.line-e.line)}function wx(t){return function(...e){return xx(t.apply(this,e))}}_x.source=wx(vx(lx)),_x.sprite=wx(vx(dx)),_x.glyphs=wx(vx(yx)),_x.light=wx(vx(hx)),_x.sky=wx(vx(ux)),_x.terrain=wx(vx(cx)),_x.state=wx(vx(px)),_x.layer=wx(vx(sx)),_x.filter=wx(vx(tx)),_x.paintProperty=wx(vx(nx)),_x.layoutProperty=wx(vx(rx));const bx=nm;function Sx(t,e){const i=e[0].evaluate(t),n=e[1].evaluate(t),r=e[2].evaluate(t),s=e[3]?e[3].evaluate(t):1;return iy.parse(`hsla(${i}, ${n}%, ${r}%, ${s})`)}function Mx(t){if(Array.isArray(t)){if(0===t.length)return t;const e=t[0];if("literal"===e)return t;if("image"===e&&3===t.length&&"object"==typeof t[2]&&null!==t[2]&&!Array.isArray(t[2]))return["image-config",Mx(t[1]),["literal",t[2]]];const i=t.length;for(let n=1;n<i;++n){const r=t[n],s=Mx(r);if(s!==r){const r=[e];for(let e=1;e<n;++e)r.push(t[e]);r.push(s);for(let e=n+1;e<i;++e)r.push(Mx(t[e]));return r}}}return t}const Ex={},Cx={zoom:0,distanceFromCenter:0};ev.register(tv,{...ev.definitions,pitch:[{kind:"number"},[],t=>Cx.pitch||0],"distance-from-center":[{kind:"number"},[],t=>Cx.distanceFromCenter||0],"to-hsla":[{kind:"array",itemType:{kind:"number"},N:4},[{kind:"string"}],(t,[e])=>function(t){const e=t[0]/255,i=t[1]/255,n=t[2]/255,r=t[3],s=Math.max(e,i,n),o=Math.min(e,i,n),a=(s+o)/2;let l,h;if(s===o)l=0,h=0;else{const t=s-o;switch(h=a>.5?t/(2-s-o):t/(s+o),s){case e:l=(i-n)/t+(i<n?6:0);break;case i:l=(n-e)/t+2;break;case n:l=(e-i)/t+4;break;default:l=0}l/=6}return[360*l,100*h,100*a,r]}(no(e.evaluate(t)))],hsl:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"}],Sx],hsla:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"},{kind:"number"}],Sx],"image-config":[{kind:"value"},[{kind:"string"},{kind:"value"}],(t,[e,i])=>e.evaluate(t)],"measure-light":[{kind:"number"},[{kind:"value"}],()=>1],config:[{kind:"value"},[{kind:"string"}],(t,[e])=>{const i=Ex[e.evaluate(t)];return void 0===i?{}:i}]});var Px={thin:100,hairline:100,"ultra-light":200,"extra-light":200,light:300,book:300,regular:400,normal:400,plain:400,roman:400,standard:400,medium:500,"semi-bold":600,"demi-bold":600,bold:700,"extra-bold":800,"ultra-bold":800,heavy:900,black:900,"heavy-black":900,fat:900,poster:900,"ultra-black":950,"extra-black":950},Ix=" ",Tx=/(italic|oblique)$/i,Rx={};function kx(t,e,i){var n=Rx[t];if(!n){Array.isArray(t)||(t=[t]);for(var r,s,o=400,a="normal",l=[],h=0,u=t.length;h<u;++h){var c=t[h].split(" "),d=c[c.length-1].toLowerCase();for(var f in"normal"==d||"italic"==d||"oblique"==d?(a=s?a:d,s=!0,c.pop(),d=c[c.length-1].toLowerCase()):Tx.test(d)&&(d=d.replace(Tx,""),a=s?a:c[c.length-1].replace(d,""),s=!0),Px){var p=c.length>1?c[c.length-2].toLowerCase():"";if(d==f||d==f.replace("-","")||p+"-"+d==f){o=r?o:Px[f],c.pop(),p&&f.startsWith(p)&&c.pop();break}}r||"number"!=typeof d||(o=d,r=!0);var g=c.join(Ix).replace("Klokantech Noto Sans","Noto Sans").replace("DIN Pro","Barlow").replace("Arial Unicode MS","Arial");-1!==g.indexOf(Ix)&&(g='"'+g+'"'),l.push(g)}n=Rx[t]=[a,o,l]}return n[0]+Ix+n[1]+Ix+e+"px"+(i?"/"+i:"")+Ix+n[2]}const Ax=Object.freeze({}),Gx={},Ox={};let Fx=0;function Lx(t){return t.id||(t.id=Fx++),t.id}function jx(t){return t*Math.PI/180}const Nx=function(){const t=[];for(let e=78271.51696402048;t.length<=24;e/=2)t.push(e);return t}();function Dx(t,e){if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(t,e);const i=document.createElement("canvas");return i.width=t,i.height=e,i}function zx(t,e,i,n){const r=[2*i*e.pixelRatio+e.width,2*i*e.pixelRatio+e.height],s=Dx(r[0],r[1]),o=s.getContext("2d");o.drawImage(t,e.x,e.y,e.width,e.height,i*e.pixelRatio,i*e.pixelRatio,e.width,e.height);const a=o.getImageData(0,0,r[0],r[1]);o.globalCompositeOperation="destination-over",o.fillStyle=`rgba(${255*n.r},${255*n.g},${255*n.b},${n.a})`;const l=a.data;for(let t=0,n=a.width;t<n;++t)for(let r=0,s=a.height;r<s;++r)l[4*(r*n+t)+3]>0&&o.arc(t,r,i*e.pixelRatio,0,2*Math.PI);return o.fill(),s}function qx(t,e,i){const n=Math.max(0,Math.min(1,(i-t)/(e-t)));return n*n*(3-2*n)}function $x(t,e,i){const n=Dx(e.width,e.height),r=n.getContext("2d");r.drawImage(t,e.x,e.y,e.width,e.height,0,0,e.width,e.height);const s=r.getImageData(0,0,e.width,e.height),o=s.data;for(let t=0,e=s.width;t<e;++t)for(let n=0,r=s.height;n<r;++n){const r=4*(n*e+t),s=.75,a=.1,l=qx(s-a,s+a,o[r+3]/255);l>0?(o[r+0]=Math.round(255*i.r*l),o[r+1]=Math.round(255*i.g*l),o[r+2]=Math.round(255*i.b*l),o[r+3]=Math.round(255*l)):o[r+3]=0}return r.putImageData(s,0,0),n}const Bx=Array(256).join(" ");function Ux(t,e){if(e>=.05){let i="";const n=t.split("\n"),r=Bx.slice(0,Math.round(e/.1));for(let t=0,e=n.length;t<e;++t)t>0&&(i+="\n"),i+=n[t].split("").join(r);return i}return t}let Wx;function Xx(){return Wx||(Wx=Dx(1,1).getContext("2d")),Wx}function Vx(t,e){return Xx().measureText(t).width+(t.length-1)*e}const Kx={};function Yx(t,e,i,n){if(-1!==t.indexOf("\n")){const r=t.split("\n"),s=[];for(let t=0,o=r.length;t<o;++t)s.push(Yx(r[t],e,i,n));return s.join("\n")}const r=i+","+e+","+t+","+n;let s=Kx[r];if(!s){const o=t.split(" ");if(o.length>1){const t=Xx();t.font=e;const r=t.measureText("M").width*i;let a="";const l=[];for(let t=0,e=o.length;t<e;++t){const e=o[t],i=a+(a?" ":"")+e;Vx(i,n)<=r?a=i:(a&&l.push(a),a=e)}a&&l.push(a);for(let t=0,e=l.length;t<e&&e>1;++t){const i=l[t];if(Vx(i,n)<.35*r){const r=t>0?Vx(l[t-1],n):1/0,s=t<e-1?Vx(l[t+1],n):1/0;l.splice(t,1),e-=1,r<s?(l[t-1]+=" "+i,t-=1):l[t]=i+" "+l[t]}}for(let t=0,e=l.length-1;t<e;++t){const i=l[t],s=l[t+1];if(Vx(i,n)>.7*r&&Vx(s,n)<.6*r){const o=i.split(" "),a=o.pop();Vx(a,n)<.2*r&&(l[t]=o.join(" "),l[t+1]=a+" "+s),e-=1}}s=l.join("\n")}else s=t;s=Ux(s,n),Kx[r]=s}return s}Ya.on("propertychange",()=>{for(const t in Kx)delete Kx[t]});const Zx={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},Hx={center:[.5,.5],left:[0,.5],right:[1,.5],top:[.5,0],bottom:[.5,1],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},Jx=function(t,e){let i=bv(t,e);if("error"===i.result){const n=Mx(t);n!==t&&(i=bv(n,e))}if("error"===i.result){const n=i.value[0];return console.error("Error parsing expression:",t,n.key,n.message),{evaluate:()=>e.default}}return i.value};let Qx,tw;function ew(t,e,i,n,r,s){const o=t.id;r||(r={},console.warn("No functionCache provided to getValue()")),r[o]||(r[o]={});const a=r[o];if(!a[i]){let n=(t[e]||Ax)[i];const r=bx[`${e}_${t.type}`]&&bx[`${e}_${t.type}`][i];void 0===n&&r&&(n=r.default);let s=_v(n);if(!s&&mv(n)&&(n=Lv(n,r),s=!0),s){const t=Jx(n,r);a[i]=t.evaluate.bind(t)}else{const t=r?r.type:typeof n;"color"!==t&&"colorArray"!==t||(n=iy.parse(n));let e=!1;if("array"===t)for(let t=0;t<n.length;++t){const i=n[t];if(_v(i)||mv(i)){e=!0;break}}if(e){const t=Object.assign({},r,{type:r.value}),e=[];for(let i=0;i<n.length;++i){let r=n[i];if(!_v(r)&&mv(r)&&(r=Lv(r,t)),_v(r)){const i=Jx(r,t);e.push(i.evaluate.bind(i))}else e.push(function(){return r})}a[i]=function(t,i,n){const r=[];for(let s=0;s<e.length;++s)r[s]=e[s](t,i,n);return r}}else a[i]=function(){return n}}}return a[i](Cx,n,s)}function iw(t,e,i,n){return ew(t,"layout",`${i}-allow-overlap`,e,n)?ew(t,"layout",`${i}-ignore-placement`,e,n)?"none":"obstacle":"declutter"}function nw(t,e,i,n){if(n||console.warn("No filterCache provided to evaluateFilter()"),!(t in n))try{n[t]=function(t,e){if(null==t)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Cv(t)||(t=Rv(t));const i=vv(t,Pv,e);if("error"===i.result)throw new Error(i.value.map(t=>`${t.key}: ${t.message}`).join(", "));return{filter:(t,e,n)=>i.value.evaluate(t,e,{},n),needGeometry:Tv(t),getGlobalStateRefs:()=>Mv(i.value.expression)}}(e).filter}catch(e){console.warn("Filter will evaluate to false: "+e.message),n[t]=function(){return!1}}return n[t](Cx,i)}function rw(t,e){if(t){if(0===t.a||0===e)return;const i=t.a;return e=void 0===e?1:e,0===i?"transparent":"rgba("+Math.round(255*t.r/i)+","+Math.round(255*t.g/i)+","+Math.round(255*t.b/i)+","+i*e+")"}return t}const sw=/\{[^{}}]*\}/g;function ow(t,e){return t.replace(sw,function(t){return e[t.slice(1,-1)]||""})}function aw(t,e){let i=t.split(":")[0];return i===t&&(i="default"),e[i]}let lw=!1;const hw={};function uw(t,e,i,n=Nx,r=void 0,s=void 0,o=void 0,a=void 0){if("string"==typeof e&&(e=JSON.parse(e)),e.schema)for(const t in e.schema){const i=e.schema[t];"default"in i&&(Ex[t]=i.default)}if(8!=e.version)throw new Error("glStyle version 8 required.");hw[function(t,e){return Lx(t)+"."+z(e)}(e,t)]=Array.from(arguments);const l={};("string"==typeof s||s instanceof Request||s instanceof Response||s instanceof Promise)&&(s={default:s});for(const e in s){const i=s[e];G(()=>i).then(async i=>{let n;if("undefined"!=typeof Image){const r=new Image;if("string"==typeof i)r.crossOrigin="anonymous",r.src=i;else{let t;i instanceof Request?t=await fetch(i):i instanceof Response&&(t=i);const e=await t.blob();n=URL.createObjectURL(e),r.src=n}r.addEventListener("load",function i(){r.removeEventListener("load",i),l[e]={image:r,size:[r.width,r.height]},t.changed(),n&&URL.revokeObjectURL(n)}),r.addEventListener("error",function t(){URL.revokeObjectURL(n),r.removeEventListener("error",t)})}else if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope){const t=self;t.postMessage({action:"loadImage",src:i}),t.addEventListener("message",function(t){"imageLoaded"===t.data.action&&t.data.src===i&&(l[e]={image:t.data.image,size:[t.data.image.width,t.data.image.height]})})}})}const h=function(t){t=t.slice();const e=Object.create(null);for(let i=0;i<t.length;i++)e[t[i].id]=t[i];for(let i=0;i<t.length;i++)"ref"in t[i]&&(t[i]=sm(t[i],e[t[i].ref]));return t}(e.layers),u={},c=[],d={},f={},p=function(t){let e=Gx[t.id];return e||(e={},Gx[Lx(t)]=e),e}(e),g=function(t){let e=Ox[t.id];return e||(e={},Ox[Lx(t)]=e),e}(e);let m;for(let t=0,n=h.length;t<n;++t){const n=h[t],r=n.id;if("string"==typeof i&&n.source==i||Array.isArray(i)&&-1!==i.indexOf(r)){const i=n["source-layer"];if(m){if(n.source!==m)throw new Error(`Layer "${r}" does not use source "${m}`)}else{m=n.source;const t=e.sources[m];if(!t)throw new Error(`Source "${m}" is not defined`);const i=t.type;if("vector"!==i&&"geojson"!==i)throw new Error(`Source "${m}" is not of type "vector" or "geojson", but "${i}"`)}let s=u[i];s||(s=[],u[i]=s),s.push({layer:n,index:t}),c.push(r)}}const y=[],_=function(i,s,h){const c=t.getSource?.()?.format_?.layerName_??"mvt:layer",m=i.getProperties(),_=u[m[c]];if(!_)return;let v=n.indexOf(s);-1==v&&(v=function(t,e){let i=0;const n=e.length;for(;i<n;++i)if(e[i]<t&&i+1<n){const n=e[i]/e[i+1];return i+Math.log(e[i]/t)/Math.log(n)}return n-1}(s,n)),Cx.zoom=v,Cx.distanceFromCenter=0;const x=i.getGeometry(),w=Zx[x.getType()],b=t.get("map");if(b&&b instanceof rh&&1===w){const t=b.getSize();if(t){const e=b.getView().getCenter(),i=Ht(x.getExtent());Cx.distanceFromCenter=(S=e,M=i,Math.sqrt(function(t,e){const i=t[0]-e[0],n=t[1]-e[1];return i*i+n*n}(S,M))/s/t[1])}}var S,M;const E={id:i.getId(),properties:m,type:w},C=t.get("mapbox-featurestate")[i.getId()];let P,I=-1;for(let n=0,u=_.length;n<u;++n){const u=_[n],c=u.layer,x=c.id;if(void 0!==h&&h!==x)continue;const b=c.layout||Ax,S=c.paint||Ax;if("none"===ew(c,"layout","visibility",E,p,C)||"minzoom"in c&&v<c.minzoom||"maxzoom"in c&&v>=c.maxzoom)continue;const M=c.filter;if(!M||nw(x,M,E,g)){let n,h,g,_,v,x;P=c;const M=u.index;if(3==w&&("fill"==c.type||"fill-extrusion"==c.type))if(h=ew(c,"paint",c.type+"-opacity",E,p,C),c.type+"-pattern"in S){const t=ew(c,"paint",c.type+"-pattern",E,p,C);if(t){const e="string"==typeof t?ow(t,m):t.toString(),i=aw(e,l);if(r&&r[e]&&i){++I,x=y[I],x&&x.getFill()&&!x.getStroke()&&!x.getText()||(x=new Sl({fill:new fl}),y[I]=x),g=x.getFill(),x.setZIndex(M);const t=e+"."+h;let n=f[t];if(!n){const s=r[e],o=Dx(s.width,s.height),a=o.getContext("2d");a.globalAlpha=h,a.drawImage(i.image,s.x,s.y,s.width,s.height,0,0,s.width,s.height),n=a.createPattern(o,"repeat"),f[t]=n}g.setColor(n)}}}else if(n=rw(ew(c,"paint",c.type+"-color",E,p,C),h),c.type+"-outline-color"in S&&(v=rw(ew(c,"paint",c.type+"-outline-color",E,p,C),h)),v||(v=n),n||v){if(++I,x=y[I],(!x||n&&!x.getFill()||!n&&x.getFill()||v&&!x.getStroke()||!v&&x.getStroke()||x.getText())&&(x=new Sl({fill:n?new fl:void 0,stroke:v?new _l:void 0}),y[I]=x),n&&(g=x.getFill(),g.setColor(n)),"fill-extrusion"===c.type){const t=ew(c,"paint","fill-extrusion-height",E,p,C);if(t>0){const e=Math.max(.1,.9-Math.min(t,225)/280);if(v&&"transparent"!==v){const t=iy.parse(v);v=`rgba(${Math.round(255*t.r*e)},${Math.round(255*t.g*e)},${Math.round(255*t.b*e)},${t.a})`}}}v&&(_=x.getStroke(),_.setColor(v),_.setWidth(.5)),x.setZIndex(M)}if(1!=w&&"line"==c.type){n="line-pattern"in S?void 0:rw(ew(c,"paint","line-color",E,p,C),ew(c,"paint","line-opacity",E,p,C));const t=ew(c,"paint","line-width",E,p,C);n&&t>0&&(++I,x=y[I],x&&x.getStroke()&&!x.getFill()&&!x.getText()||(x=new Sl({stroke:new _l}),y[I]=x),_=x.getStroke(),_.setLineCap(ew(c,"layout","line-cap",E,p,C)),_.setLineJoin(ew(c,"layout","line-join",E,p,C)),_.setMiterLimit(ew(c,"layout","line-miter-limit",E,p,C)),_.setColor(n),_.setWidth(t),_.setLineDash(S["line-dasharray"]?ew(c,"paint","line-dasharray",E,p,C).map(function(e){return e*t}):null),"function"==typeof _.setOffset&&_.setOffset(ew(c,"paint","line-offset",E,p,C)),x.setZIndex(M))}let T,R,k,A,G,O,F,L,j,N=!1,D=null,z=0;if((1==w||2==w)&&"icon-image"in b){const e=ew(c,"layout","icon-image",E,p,C);if(e){let n;T="string"==typeof e?ow(e,m):e.toString();const o=a?a(t,T):void 0,h=aw(T,l);if(r&&r[T]&&h||o){const t=ew(c,"layout","icon-rotation-alignment",E,p,C);if(2==w){const e=i.getGeometry();if(e.getFlatMidpoint||e.getFlatMidpoints){const i=e.getExtent();if(Math.sqrt(Math.max(Math.pow((i[2]-i[0])/s,2),Math.pow((i[3]-i[1])/s,2)))>150){const i="MultiLineString"===e.getType()?e.getFlatMidpoints():e.getFlatMidpoint();if(tw||(Qx=[NaN,NaN],tw=new Ig("Point",Qx,[],2,{},void 0)),n=tw,Qx[0]=i[0],Qx[1]=i[1],"line"===ew(c,"layout","symbol-placement",E,p,C)&&"map"===t){const t=e.getStride(),n=e.getFlatCoordinates();for(let e=0,r=n.length-t;e<r;e+=t){const r=n[e],s=n[e+1],o=n[e+t],a=n[e+t+1],l=Math.min(r,o),h=Math.max(r,o),u=i[0],c=(a-s)*(u-r)-(o-r)*(i[1]-s);if(Math.abs(c)<.001&&u<=h&&u>=l){z=Math.atan2(s-a,o-r);break}}}}}}if(2!==w||n){const e=ew(c,"layout","icon-size",E,p,C),i=void 0!==S["icon-color"]?ew(c,"paint","icon-color",E,p,C):null;if(!i||0!==i.a){const n=ew(c,"paint","icon-halo-color",E,p,C),s=ew(c,"paint","icon-halo-width",E,p,C);let a=`${T}.${e}.${s}.${n}`;if(null!==i&&(a+=`.${i}`),R=d[a],!R){const l=iw(c,E,"icon",p);let u;"icon-offset"in b&&(u=ew(c,"layout","icon-offset",E,p,C).slice(0),u[0]*=e,u[1]*=-e);let f=i?[255*i.r,255*i.g,255*i.b,i.a]:void 0;if(o){const i={color:f,rotateWithView:"map"===t,displacement:u,declutterMode:l,scale:e};"string"==typeof o?i.src=o:(i.img=o,i.imgSize=[o.width,o.height]),R=new ml(i)}else{const o=r[T];let a,c,d;if(s)o.sdf?(a=zx($x(h.image,o,i||[0,0,0,1]),{x:0,y:0,width:o.width,height:o.height,pixelRatio:o.pixelRatio},s,n),f=void 0):a=zx(h.image,o,s,n);else{if(o.sdf&&!h.unSDFed){const t=$x(h.image,{x:0,y:0,width:h.size[0],height:h.size[1]},{r:1,g:1,b:1,a:1});h.image=t,h.unSDFed=!0}a=h.image,c=[o.width,o.height],d=[o.x,o.y]}R=new ml({color:f,img:a,imgSize:h.size,size:c,offset:d,rotateWithView:"map"===t,scale:e/o.pixelRatio,displacement:u,declutterMode:l})}d[a]=R}}R&&(++I,x=y[I],x&&x.getImage()&&!x.getFill()&&!x.getStroke()||(x=new Sl,y[I]=x),x.setGeometry(n),R.setRotation(z+jx(ew(c,"layout","icon-rotate",E,p,C))),R.setOpacity(ew(c,"paint","icon-opacity",E,p,C)),R.setAnchor(Hx[ew(c,"layout","icon-anchor",E,p,C)]),x.setImage(R),D=x.getText(),x.setText(void 0),x.setZIndex(M),N=!0,k=!1)}else k=!0}}}if(1==w&&"circle"===c.type){++I,x=y[I],x&&x.getImage()&&!x.getFill()&&!x.getStroke()||(x=new Sl,y[I]=x);const t="circle-radius"in S?ew(c,"paint","circle-radius",E,p,C):5,e=rw(ew(c,"paint","circle-stroke-color",E,p,C),ew(c,"paint","circle-stroke-opacity",E,p,C)),i=ew(c,"paint","circle-translate",E,p,C),n=rw(ew(c,"paint","circle-color",E,p,C),ew(c,"paint","circle-opacity",E,p,C)),r=ew(c,"paint","circle-stroke-width",E,p,C),s=t+"."+e+"."+n+"."+r+"."+i[0]+"."+i[1];R=d[s],R||(R=new cl({radius:t,displacement:[i[0],-i[1]],stroke:e&&r>0?new _l({width:r,color:e}):void 0,fill:n?new fl({color:n}):void 0,declutterMode:"none"}),d[s]=R),x.setImage(R),D=x.getText(),x.setText(void 0),x.setGeometry(void 0),x.setZIndex(M),N=!0}if("text-field"in b){F=Math.round(ew(c,"layout","text-size",E,p,C));const t=ew(c,"layout","text-font",E,p,C);O=ew(c,"layout","text-line-height",E,p,C),G=kx(o?o(t,e.metadata?e.metadata["ol:webfonts"]:void 0):t,F,O),G.includes("sans-serif")||(G+=",sans-serif"),L=ew(c,"layout","text-letter-spacing",E,p,C),j=ew(c,"layout","text-max-width",E,p,C);const i=ew(c,"layout","text-field",E,p,C);A="object"==typeof i&&i.sections?1===i.sections.length?i.toString():i.sections.reduce((e,i,n)=>{const r=i.fontStack?i.fontStack.split(","):t,s=kx(o?o(r):r,F*(i.scale||1),O);let a=i.text;if("\n"===a)return e.push("\n",""),e;if(2==w)return e.push(Ux(a,L),s),e;a=Yx(a,s,j,L).split("\n");for(let t=0,i=a.length;t<i;++t)t>0&&e.push("\n",""),e.push(a[t],s);return e},[]):ow(i,m).trim(),h=ew(c,"paint","text-opacity",E,p,C)}if(A&&h&&!k){N||(++I,x=y[I],x&&x.getText()&&!x.getFill()&&!x.getStroke()||(x=new Sl,y[I]=x),x.setImage(void 0),x.setGeometry(void 0));const t=iw(c,E,"text",p);x.getText()||x.setText(D),D=x.getText(),(!D||"getDeclutterMode"in D&&D.getDeclutterMode()!==t)&&(D=new El({padding:[2,2,2,2],declutterMode:t}),x.setText(D));const e=ew(c,"layout","text-transform",E,p,C);"uppercase"==e?A=Array.isArray(A)?A.map((t,e)=>e%2?t:t.toUpperCase()):A.toUpperCase():"lowercase"==e&&(A=Array.isArray(A)?A.map((t,e)=>e%2?t:t.toLowerCase()):A.toLowerCase());const i=Array.isArray(A)?A:2==w?Ux(A,L):Yx(A,G,j,L);if(D.setText(i),D.setFont(G),D.setRotation(jx(ew(c,"layout","text-rotate",E,p,C))),"function"==typeof D.setKeepUpright){const t=ew(c,"layout","text-keep-upright",E,p,C);D.setKeepUpright(t)}const n=ew(c,"layout","text-anchor",E,p,C),r=N||1==w?"point":ew(c,"layout","symbol-placement",E,p,C);let s;if("line-center"===r?(D.setPlacement("line"),s="center"):D.setPlacement(r),"line"===r&&"function"==typeof D.setRepeat){const t=ew(c,"layout","symbol-spacing",E,p,C);D.setRepeat(2*t)}D.setOverflow("point"===r);let o=ew(c,"paint","text-halo-width",E,p,C);const a=ew(c,"layout","text-offset",E,p,C),l=ew(c,"paint","text-translate",E,p,C);let u=0,d=0;if("point"==r){s="center",-1!==n.indexOf("left")?(s="left",d=o):-1!==n.indexOf("right")&&(s="right",d=-o);const t=ew(c,"layout","text-rotation-alignment",E,p,C);D.setRotateWithView("map"==t)}else D.setMaxAngle(jx(ew(c,"layout","text-max-angle",E,p,C))*A.length/i.length),D.setRotateWithView(!1);D.setTextAlign(s);let f="middle";0==n.indexOf("bottom")?(f="bottom",u=-o-.5*(O-1)*F):0==n.indexOf("top")&&(f="top",u=o+.5*(O-1)*F),D.setTextBaseline(f);const g=ew(c,"layout","text-justify",E,p,C);D.setJustify("auto"===g?void 0:g),D.setOffsetX(a[0]*F+d+l[0]),D.setOffsetY(a[1]*F+u+l[1]);const m=D.getFill()||new fl;m.setColor(rw(ew(c,"paint","text-color",E,p,C),h)),D.setFill(m);const _=rw(ew(c,"paint","text-halo-color",E,p,C),h);if(_&&o>0){const t=D.getStroke()||new _l;t.setColor(_),o*=2;const e=.5*F;t.setWidth(o<=e?o:e),D.setStroke(t)}else D.setStroke(void 0);const v=ew(c,"layout","text-padding",E,p,C),b=D.getPadding();v!==b[0]&&(b[0]=v,b[1]=v,b[2]=v,b[3]=v),x.setZIndex(M)}}}return I>-1?(y.length=I+1,lw&&("set"in i?i.set("mapbox-layer",P):i.getProperties()["mapbox-layer"]=P),y):void 0};return t.setStyle(_),t.set("mapbox-layers",c),t.set("mapbox-source",m),t.set("mapbox-featurestate",t.get("mapbox-featurestate")||{}),_}function cw(t){return cw="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},cw(t)}function dw(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function fw(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?dw(Object(i),!0).forEach(function(e){pw(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):dw(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function pw(t,e,i){return(e=function(t){var e=function(t){if("object"!=cw(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=cw(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==cw(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function gw(){var t,e,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",r=i.toStringTag||"@@toStringTag";function s(i,n,r,s){var l=n&&n.prototype instanceof a?n:a,h=Object.create(l.prototype);return mw(h,"_invoke",function(i,n,r){var s,a,l,h=0,u=r||[],c=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return s=e,a=0,l=t,d.n=i,o}};function f(i,n){for(a=i,l=n,e=0;!c&&h&&!r&&e<u.length;e++){var r,s=u[e],f=d.p,p=s[2];i>3?(r=p===n)&&(l=s[(a=s[4])?5:(a=3,3)],s[4]=s[5]=t):s[0]<=f&&((r=i<2&&f<s[1])?(a=0,d.v=n,d.n=s[1]):f<p&&(r=i<3||s[0]>n||n>p)&&(s[4]=i,s[5]=n,d.n=p,a=0))}if(r||i>1)return o;throw c=!0,n}return function(r,u,p){if(h>1)throw TypeError("Generator is already running");for(c&&1===u&&f(u,p),a=u,l=p;(e=a<2?t:l)||!c;){s||(a?a<3?(a>1&&(d.n=-1),f(a,l)):d.n=l:d.v=l);try{if(h=2,s){if(a||(r="next"),e=s[r]){if(!(e=e.call(s,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,a<2&&(a=0)}else 1===a&&(e=s.return)&&e.call(s),a<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),a=1);s=t}else if((e=(c=d.n<0)?l:i.call(n,d))!==o)break}catch(e){s=t,a=1,l=e}finally{h=1}}return{value:e,done:c}}}(i,r,s),!0),h}var o={};function a(){}function l(){}function h(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(mw(e={},n,function(){return this}),e),c=h.prototype=a.prototype=Object.create(u);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,mw(t,r,"GeneratorFunction")),t.prototype=Object.create(c),t}return l.prototype=h,mw(c,"constructor",h),mw(h,"constructor",l),l.displayName="GeneratorFunction",mw(h,r,"GeneratorFunction"),mw(c),mw(c,r,"Generator"),mw(c,n,function(){return this}),mw(c,"toString",function(){return"[object Generator]"}),(gw=function(){return{w:s,m:d}})()}function mw(t,e,i,n){var r=Object.defineProperty;try{r({},"",{})}catch(t){r=0}mw=function(t,e,i,n){function s(e,i){mw(t,e,function(t){return this._invoke(e,i,t)})}e?r?r(t,e,{value:i,enumerable:!n,configurable:!n,writable:!n}):t[e]=i:(s("next",0),s("throw",1),s("return",2))},mw(t,e,i,n)}function yw(t,e,i,n,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,r)}function _w(t){return function(){var e=this,i=arguments;return new Promise(function(n,r){var s=t.apply(e,i);function o(t){yw(s,n,r,o,a,"next",t)}function a(t){yw(s,n,r,o,a,"throw",t)}o(void 0)})}}function vw(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return xw(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)?xw(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xw(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}iy.parse("#000000"),iy.parse("#FFFFFF"),iy.parse("#000000"),function(t=!1){lw=t}(!0);var ww="EPSG:27700",bw=["vector","raster","wms","ogc-vt"];function Sw(t,e,i){var n=i&&i(t,e)||{};return fetch(n.url||t,{headers:n.headers||{}})}var Mw=function(t){return function(e,i){var n=t(i,"Tile")||{},r=n.url||i,s=n.headers||{};fetch(r,{headers:s}).then(function(t){return t.blob()}).then(function(t){e.getImage().src=URL.createObjectURL(t)}).catch(function(){return e.setState(3)})}};function Ew(){return new qd({resolutions:Md,origin:Cd,tileSize:256})}function Cw(t,e,i){var n=Ew();return new wf({url:t,params:e,projection:ww,tileGrid:n,tileLoadFunction:i?Mw(i):void 0})}function Pw(t,e){var i=Ew();return new mf({projection:ww,tileGrid:i,tileUrlFunction:function(e){var i=vw(e,3),n=i[0],r=i[1],s=i[2];return t.replace("{z}",n).replace("{x}",r).replace("{y}",s)},tileLoadFunction:e?Mw(e):void 0})}function Iw(t,e){return Tw.apply(this,arguments)}function Tw(){return(Tw=_w(gw().m(function t(e,i){var n,r;return gw().w(function(t){for(;;)switch(t.n){case 0:if(!e.type||bw.includes(e.type)){t.n=1;break}throw new Error("Unsupported map style type: '".concat(e.type,"'"));case 1:if("wms"!==e.type){t.n=2;break}return n=Cw(e.url,e.params||{},i),t.a(2,{layer:new Xf({source:n}),source:n});case 2:if("raster"!==e.type){t.n=3;break}return r=Pw(e.url,i),t.a(2,{layer:new Xf({source:r}),source:r});case 3:if("ogc-vt"!==e.type){t.n=4;break}return t.a(2,Ow(e.url,i,e));case 4:return t.a(2,Aw(e.url,i,e))}},t)}))).apply(this,arguments)}function Rw(t,e){var i=t.indexOf("?"),n=vw(i>=0?[t.slice(0,i),t.slice(i)]:[t,""],2),r=n[0],s=n[1],o="".concat(r,".json").concat(s),a="".concat(r,".png").concat(s);return{jsonUrl:o,pngUrl:a,fetch:function(){return Sw(o,"SpriteJSON",e).then(function(t){return t.json()})}}}function kw(t){t.layers.forEach(function(t){var e;null!==(e=t.paint)&&void 0!==e&&e["icon-color"]&&(t.paint["icon-color"]=t.paint["icon-color"].replace(",0)",",1)"))})}function Aw(t,e){return Gw.apply(this,arguments)}function Gw(){return Gw=_w(gw().m(function t(e,i){var n,r,s,o,a,l,h,u,c,d,f,p,g,m,y,_=arguments;return gw().w(function(t){for(;;)switch(t.n){case 0:return n=(_.length>2&&void 0!==_[2]?_[2]:{}).renderMode,t.n=1,Sw(e,"Style",i).then(function(t){return t.json()});case 1:return r=t.v,s=Object.keys(r.sources)[0],o=r.sources[s].url,t.n=2,Sw(o,"Source",i).then(function(t){return t.json()});case 2:return a=t.v,l=[a.fullExtent.xmin,a.fullExtent.ymin,a.fullExtent.xmax,a.fullExtent.ymax],h=[a.tileInfo.origin.x,a.tileInfo.origin.y],u=a.tileInfo.lods.map(function(t){return t.resolution}).slice(0,16),c=a.tileInfo.rows,d=a.tiles[0],f=Rw(r.sprite,i),t.n=3,f.fetch();case 3:return p=t.v,kw(r),g=new qd({extent:l,origin:h,resolutions:u,tileSize:c}),m=new Pf({format:new Bg,url:d,projection:ww,tileGrid:g}),uw(y=new Bp(fw({source:m,declutter:!0},n&&{renderMode:n})),r,s,u,p,f.pngUrl),t.a(2,{layer:y,source:m})}},t)})),Gw.apply(this,arguments)}function Ow(t,e){return Fw.apply(this,arguments)}function Fw(){return Fw=_w(gw().m(function t(e,i){var n,r,s,o,a,l,h,u,c,d,f,p,g,m,y,_,v,x,w,b=arguments;return gw().w(function(t){for(;;)switch(t.n){case 0:return r=(b.length>2&&void 0!==b[2]?b[2]:{}).renderMode,t.n=1,Sw(e,"Style",i).then(function(t){return t.json()});case 1:return s=t.v,o=Object.keys(s.sources)[0],a=s.sources[o].url,l=Rw(s.sprite,i),t.n=2,Sw(a,"Source",i).then(function(t){return t.json()});case 2:return h=t.v,u=null===(n=h.links)||void 0===n?void 0:n.find(function(t){return"http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme"===t.rel}),t.n=3,Promise.all([Sw(u.href,"Source",i).then(function(t){return t.json()}),l.fetch()]);case 3:return c=t.v,d=vw(c,2),f=d[0],p=d[1],g=f.tileMatrices.map(function(t){return t.cellSize}),m=f.tileMatrices[0].pointOfOrigin,y=[f.tileMatrices[0].tileHeight,f.tileMatrices[0].tileWidth],(_=new Bg).supportedMediaTypes.push("application/octet-stream"),v=new qd({resolutions:g,origin:m,tileSize:y}),x=new Qp({url:a,format:_,tileGrid:v,projection:ww}),uw(w=new Bp(fw({source:x,declutter:!0},r&&{renderMode:r})),s,o,g,p,l.pngUrl),t.a(2,{layer:w,source:x})}},t)})),Fw.apply(this,arguments)}function Lw(){var t,e,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",r=i.toStringTag||"@@toStringTag";function s(i,n,r,s){var l=n&&n.prototype instanceof a?n:a,h=Object.create(l.prototype);return jw(h,"_invoke",function(i,n,r){var s,a,l,h=0,u=r||[],c=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return s=e,a=0,l=t,d.n=i,o}};function f(i,n){for(a=i,l=n,e=0;!c&&h&&!r&&e<u.length;e++){var r,s=u[e],f=d.p,p=s[2];i>3?(r=p===n)&&(l=s[(a=s[4])?5:(a=3,3)],s[4]=s[5]=t):s[0]<=f&&((r=i<2&&f<s[1])?(a=0,d.v=n,d.n=s[1]):f<p&&(r=i<3||s[0]>n||n>p)&&(s[4]=i,s[5]=n,d.n=p,a=0))}if(r||i>1)return o;throw c=!0,n}return function(r,u,p){if(h>1)throw TypeError("Generator is already running");for(c&&1===u&&f(u,p),a=u,l=p;(e=a<2?t:l)||!c;){s||(a?a<3?(a>1&&(d.n=-1),f(a,l)):d.n=l:d.v=l);try{if(h=2,s){if(a||(r="next"),e=s[r]){if(!(e=e.call(s,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,a<2&&(a=0)}else 1===a&&(e=s.return)&&e.call(s),a<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),a=1);s=t}else if((e=(c=d.n<0)?l:i.call(n,d))!==o)break}catch(e){s=t,a=1,l=e}finally{h=1}}return{value:e,done:c}}}(i,r,s),!0),h}var o={};function a(){}function l(){}function h(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(jw(e={},n,function(){return this}),e),c=h.prototype=a.prototype=Object.create(u);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,jw(t,r,"GeneratorFunction")),t.prototype=Object.create(c),t}return l.prototype=h,jw(c,"constructor",h),jw(h,"constructor",l),l.displayName="GeneratorFunction",jw(h,r,"GeneratorFunction"),jw(c),jw(c,r,"Generator"),jw(c,n,function(){return this}),jw(c,"toString",function(){return"[object Generator]"}),(Lw=function(){return{w:s,m:d}})()}function jw(t,e,i,n){var r=Object.defineProperty;try{r({},"",{})}catch(t){r=0}jw=function(t,e,i,n){function s(e,i){jw(t,e,function(t){return this._invoke(e,i,t)})}e?r?r(t,e,{value:i,enumerable:!n,configurable:!n,writable:!n}):t[e]=i:(s("next",0),s("throw",1),s("return",2))},jw(t,e,i,n)}function Nw(t,e,i,n,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,r)}function Dw(t){var e=t.mapProvider,i=t.transformRequest,n=t.events,r=t.eventBus,s=t.map,o=t.onBaseSourceChange,a=function(){var t,a=(t=Lw().m(function t(a){var l,h,u;return Lw().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,Iw(a,i);case 1:l=t.v,h=l.layer,u=l.source,s.getLayers().setAt(0,h),o(u),r.emit(n.MAP_STYLE_CHANGE,{mapStyleId:a.id}),e.reapplyHighlights();case 2:return t.a(2)}},t)}),function(){var e=this,i=arguments;return new Promise(function(n,r){var s=t.apply(e,i);function o(t){Nw(s,n,r,o,a,"next",t)}function a(t){Nw(s,n,r,o,a,"throw",t)}o(void 0)})});return function(t){return a.apply(this,arguments)}}(),l=function(t){s.setPixelRatio(t)},h=function(t){var i=t.mapSize;e.mapSize=i};return r.on(n.MAP_SET_STYLE,a),r.on(n.MAP_SET_PIXEL_RATIO,l),r.on(n.MAP_SIZE_CHANGE,h),{remove:function(){r.off(n.MAP_SET_STYLE,a),r.off(n.MAP_SET_PIXEL_RATIO,l),r.off(n.MAP_SIZE_CHANGE,h)}}}function zw(t,e,i){if(null!==t)for(var n,r,s,o,a,l,h,u,c=0,d=0,f=t.type,p="FeatureCollection"===f,g="Feature"===f,m=p?t.features.length:1,y=0;y<m;y++){a=(u=!!(h=p?t.features[y].geometry:g?t.geometry:t)&&"GeometryCollection"===h.type)?h.geometries.length:1;for(var _=0;_<a;_++){var v=0,x=0;if(null!==(o=u?h.geometries[_]:h)){l=o.coordinates;var w=o.type;switch(c=!i||"Polygon"!==w&&"MultiPolygon"!==w?0:1,w){case null:break;case"Point":if(!1===e(l,d,y,v,x))return!1;d++,v++;break;case"LineString":case"MultiPoint":for(n=0;n<l.length;n++){if(!1===e(l[n],d,y,v,x))return!1;d++,"MultiPoint"===w&&v++}"LineString"===w&&v++;break;case"Polygon":case"MultiLineString":for(n=0;n<l.length;n++){for(r=0;r<l[n].length-c;r++){if(!1===e(l[n][r],d,y,v,x))return!1;d++}"MultiLineString"===w&&v++,"Polygon"===w&&x++}"Polygon"===w&&v++;break;case"MultiPolygon":for(n=0;n<l.length;n++){for(x=0,r=0;r<l[n].length;r++){for(s=0;s<l[n][r].length-c;s++){if(!1===e(l[n][r][s],d,y,v,x))return!1;d++}x++}v++}break;case"GeometryCollection":for(n=0;n<o.geometries.length;n++)if(!1===zw(o.geometries[n],e,i))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}var qw=function(t,e={}){if(null!=t.bbox&&!0!==e.recompute)return t.bbox;const i=[1/0,1/0,-1/0,-1/0];return zw(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 $w(t){return function(t){if(Array.isArray(t))return Ww(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Uw(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 Bw(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(t,e)||Uw(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 Uw(t,e){if(t){if("string"==typeof t)return Ww(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)?Ww(t,e):void 0}}function Ww(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}var Xw=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)),n=1===i?"mile":"miles";return"".concat(i," ").concat(n)}var r=Math.round(e);return"".concat(r," miles")},Vw=function(t,e,i){for(var n=[],r=e;r<i;r+=2)n.push([t[r],t[r+1]]);return n},Kw=function(t){var e=t.getType(),i=t.getFlatCoordinates();if("Point"===e)return{type:"Point",coordinates:[i[0],i[1]]};if("LineString"===e)return{type:"LineString",coordinates:Vw(i,0,i.length)};if("Polygon"===e){var n=t.getEnds(),r=0;return{type:"Polygon",coordinates:n.map(function(t){var e=Vw(i,r,t);return r=t,e})}}if("MultiPolygon"===e){var s=t.getEndss(),o=0,a=s.map(function(t){var e=o,n=t.map(function(t){var n=Vw(i,e,t);return e=t,n});return o=t[t.length-1],n});return{type:"MultiPolygon",coordinates:a}}return{type:e,coordinates:Vw(i,0,i.length)}},Yw=function(t,e,i,n){var r=[];return t.getLayers().forEach(function(t){if(t instanceof Bp){var s=t.getSource(),o=null==s?void 0:s.sourceTiles_;o&&Object.values(o).forEach(function(t){2===t.getState()&&t.getFeatures().forEach(function(t){var s;if((null===(s=t.get("mapbox-layer"))||void 0===s?void 0:s.id)===e){var o=n?t.get(n):t.getId();String(o)===String(i)&&r.push(Kw(t))}})})}}),r};function Zw(t){return Zw="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},Zw(t)}function Hw(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function Jw(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Hw(Object(i),!0).forEach(function(e){Qw(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Hw(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function Qw(t,e,i){return(e=function(t){var e=function(t){if("object"!=Zw(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=Zw(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Zw(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function tb(t){return function(t){if(Array.isArray(t))return nb(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ib(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 eb(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=ib(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function ib(t,e){if(t){if("string"==typeof t)return nb(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)?nb(t,e):void 0}}function nb(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}var rb="EPSG:27700",sb=new Kg({dataProjection:rb,featureProjection:rb}),ob="_highlight",ab=function(t,e){if(!t)return[];var i=t.stroke,n=t.selectionStroke,r=t.fill,s=t.strokeWidth,o=t.activeStrokeWidth;if(e)return[new Sl({stroke:new _l({color:i,width:o}),zIndex:999}),new Sl({stroke:new _l({color:n,width:s}),zIndex:1e3})];var a=[new Sl({stroke:new _l({color:n,width:s}),zIndex:999})];return r&&"transparent"!==r&&a.push(new Sl({fill:new fl({color:r}),zIndex:999})),a},lb=function(t){var e,i=new Set,n={},r=eb(null!=t?t:[]);try{for(r.s();!(e=r.n()).done;){var s=e.value,o=s.layerId,a=s.featureId,l=s.idProperty;i.add("".concat(o,":").concat(a)),l&&(n[o]=l)}}catch(t){r.e(t)}finally{r.f()}return{keys:i,idProps:n}},hb=function(t,e,i,n){var r,s=eb(null!=e?e:[]);try{for(s.s();!(r=s.n()).done;){var o=r.value,a=o.layerId,l=o.geometry;if(l){var h=ab(null==n?void 0:n[a],i);if(h.length){var u=new Rg({geometry:sb.readGeometry(l)});u.setStyle(h),t.addFeature(u)}}}}catch(t){s.e(t)}finally{s.f()}},ub=function(t,e){var i=t.type,n=t.coordinates,r=function(t){var i,n,r=(n=2,function(t){if(Array.isArray(t))return t}(i=t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(i,n)||ib(i,n)||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.")}()),s=r[0],o=r[1];return e(s,o)},s=function(t){return t.forEach(r)};"Point"===i?r(n):"MultiPoint"===i||"LineString"===i?n.forEach(r):"MultiLineString"===i||"Polygon"===i?n.forEach(s):"MultiPolygon"===i&&n.forEach(function(t){return t.forEach(s)})},cb=function(t,e,i,n){if(!t)return null;var r=new Set;t.getLayers().forEach(function(t){if(t instanceof Zg&&!t.get(ob)){var e=t.get("layerId");e&&r.add(e)}});var s=lb(e),o=s.keys,a=s.idProps,l=lb(i),h=l.keys,u=l.idProps,c=Jw(Jw({},a),u);!function(t,e,i,n,r){t.getLayers().forEach(function(t){if(t instanceof Bp)if(e.size>0||i.size>0){t._highlightOriginalStyle||(t._highlightOriginalStyle=t.getStyleFunction());var s=t._highlightOriginalStyle;t.setStyle(function(t,o){var a,l=s(t,o),h=null===(a=t.get("mapbox-layer"))||void 0===a?void 0:a.id;if(!h)return l;var u=n[h],c=u?t.get(u):t.getId(),d="".concat(h,":").concat(c),f=i.has(d),p=!f&&e.has(d);if(!f&&!p)return l;var g=ab(null==r?void 0:r[h],f);if(!g.length)return l;var m=l?Array.isArray(l)?l:[l]:[];return[].concat(tb(m),tb(g))})}else t._highlightOriginalStyle&&(t.setStyle(t._highlightOriginalStyle),delete t._highlightOriginalStyle)})}(t,o,h,c,n);var d=function(t){var e=null;return t.getLayers().forEach(function(t){t.get(ob)&&(e=t)}),e||((e=new Zg({source:new im,zIndex:1001})).set(ob,!0),t.addLayer(e)),e}(t),f=d.getSource();f.clear();var p=(null!=e?e:[]).filter(function(t){return r.has(t.layerId)}),g=(null!=i?i:[]).filter(function(t){return r.has(t.layerId)});hb(f,g,!0,n),hb(f,p,!1,n);var m=(null!=e?e:[]).flatMap(function(e){return function(t,e){var i=e.layerId,n=e.featureId,r=e.idProperty,s=e.geometry;if(null!=n){var o=Yw(t,i,n,r);if(o.length>0)return o}return s?[s]:[]}(t,e)});return function(t){if(!t.length)return null;var e,i=1/0,n=1/0,r=-1/0,s=-1/0,o=eb(t);try{for(o.s();!(e=o.n()).done;){var a=e.value;ub(a,function(t,e){t<i&&(i=t),e<n&&(n=e),t>r&&(r=t),e>s&&(s=e)})}}catch(t){o.e(t)}finally{o.f()}return i===1/0?null:[i,n,r,s]}(m)};function db(t){return db="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},db(t)}function fb(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function pb(t,e,i){return(e=function(t){var e=function(t){if("object"!=db(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=db(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==db(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var gb="EPSG:27700",mb=new Kg({dataProjection:gb,featureProjection:gb});function yb(t){return yb="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},yb(t)}function _b(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function vb(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?_b(Object(i),!0).forEach(function(e){xb(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):_b(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function xb(t,e,i){return(e=function(t){var e=function(t){if("object"!=yb(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=yb(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==yb(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function wb(t){return wb="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},wb(t)}function bb(){var t,e,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",r=i.toStringTag||"@@toStringTag";function s(i,n,r,s){var l=n&&n.prototype instanceof a?n:a,h=Object.create(l.prototype);return Sb(h,"_invoke",function(i,n,r){var s,a,l,h=0,u=r||[],c=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return s=e,a=0,l=t,d.n=i,o}};function f(i,n){for(a=i,l=n,e=0;!c&&h&&!r&&e<u.length;e++){var r,s=u[e],f=d.p,p=s[2];i>3?(r=p===n)&&(l=s[(a=s[4])?5:(a=3,3)],s[4]=s[5]=t):s[0]<=f&&((r=i<2&&f<s[1])?(a=0,d.v=n,d.n=s[1]):f<p&&(r=i<3||s[0]>n||n>p)&&(s[4]=i,s[5]=n,d.n=p,a=0))}if(r||i>1)return o;throw c=!0,n}return function(r,u,p){if(h>1)throw TypeError("Generator is already running");for(c&&1===u&&f(u,p),a=u,l=p;(e=a<2?t:l)||!c;){s||(a?a<3?(a>1&&(d.n=-1),f(a,l)):d.n=l:d.v=l);try{if(h=2,s){if(a||(r="next"),e=s[r]){if(!(e=e.call(s,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,a<2&&(a=0)}else 1===a&&(e=s.return)&&e.call(s),a<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),a=1);s=t}else if((e=(c=d.n<0)?l:i.call(n,d))!==o)break}catch(e){s=t,a=1,l=e}finally{h=1}}return{value:e,done:c}}}(i,r,s),!0),h}var o={};function a(){}function l(){}function h(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(Sb(e={},n,function(){return this}),e),c=h.prototype=a.prototype=Object.create(u);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,Sb(t,r,"GeneratorFunction")),t.prototype=Object.create(c),t}return l.prototype=h,Sb(c,"constructor",h),Sb(h,"constructor",l),l.displayName="GeneratorFunction",Sb(h,r,"GeneratorFunction"),Sb(c),Sb(c,r,"Generator"),Sb(c,n,function(){return this}),Sb(c,"toString",function(){return"[object Generator]"}),(bb=function(){return{w:s,m:d}})()}function Sb(t,e,i,n){var r=Object.defineProperty;try{r({},"",{})}catch(t){r=0}Sb=function(t,e,i,n){function s(e,i){Sb(t,e,function(t){return this._invoke(e,i,t)})}e?r?r(t,e,{value:i,enumerable:!n,configurable:!n,writable:!n}):t[e]=i:(s("next",0),s("throw",1),s("return",2))},Sb(t,e,i,n)}function Mb(t,e,i,n,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,r)}function Eb(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Cb(n.key),n)}}function Cb(t){var e=function(t){if("object"!=wb(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=wb(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==wb(e)?e:e+""}function Pb(t,e,i){return e=Tb(e),function(t,e){if(e&&("object"==wb(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ib()?Reflect.construct(e,i||[],Tb(t).constructor):e.apply(t,i))}function Ib(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ib=function(){return!!t})()}function Tb(t){return Tb=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Tb(t)}function Rb(t,e){return Rb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Rb(t,e)}!function(){if("undefined"!=typeof HTMLCanvasElement){var t=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(e,i){for(var n=arguments.length,r=new Array(n>2?n-2:0),s=2;s<n;s++)r[s-2]=arguments[s];return t.call.apply(t,[this,e,"2d"===e?vb(vb({},i),{},{willReadFrequently:!0}):i].concat(r))}}}();var kb="EPSG:27700",Ab=function(t){if(t){var e=t.top,i=void 0===e?0:e,n=t.right,r=void 0===n?0:n,s=t.bottom,o=void 0===s?0:s,a=t.left;return[i,r,o,void 0===a?0:a]}};bd.defs(kb,"+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){Sd=t;const e=Object.keys(t.defs),i=e.length;let n,r;for(n=0;n<i;++n){const i=e[n];if(!je(i)){const e=t.defs(i);let n=e.units;n||"longlat"!==e.projName||(n="degrees"),yi(new Me({code:i,axisOrientation:e.axis,metersPerUnit:e.to_meter,units:n}))}}for(n=0;n<i;++n){const s=e[n],o=je(s);for(r=0;r<i;++r){const i=e[r],n=je(i);if(!ze(s,i))if(t.defs[s]===t.defs[i])xi([o,n]);else{const e=t(s,i);Si(o,n,ji(o,n,e.forward),ji(n,o,e.inverse))}}}}(bd);var Gb=function(t){function e(t){var i,n=t.mapProviderConfig,r=void 0===n?{}:n,s=t.events,o=t.eventBus;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(i=Pb(this,e)).events=s,i.eventBus=o,i.capabilities={supportedShortcuts:Id,supportsMapSizes:!0},Object.assign(i,r),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Rb(t,e)}(e,t),i=e,n=[{key:"name",get:function(){return"OpenLayersProvider"}},{key:"initMap",value:(r=bb().m(function t(e){var i,n,r,s,o,a,l,h,u,c,d,f,p,g,m,y,_,v,x,w;return bb().w(function(t){for(;;)switch(t.n){case 0:return n=e.container,r=e.padding,s=e.mapStyle,o=e.mapSize,a=e.center,l=e.zoom,h=e.bounds,u=e.minZoom,c=e.maxZoom,d=e.transformRequest,f=e.pixelRatio,this.mapStyleId=null==s?void 0:s.id,this.mapSize=o,p=this.events,g=this.eventBus,t.n=1,Iw(s,d);case 1:m=t.v,y=m.layer,_=m.source,v=Td(null!==(i=this.zoomAlignment)&&void 0!==i?i:"uk"),x=new er({projection:kb,center:a,zoom:null!=l?l:v.defaultMinZoom,minZoom:Math.max(null!=u?u:v.defaultMinZoom,v.defaultMinZoom),maxZoom:null!=c?c:v.maxZoom,resolutions:v.resolutions,constrainResolution:!1,padding:Ab(r)}),w=new rh({target:n,layers:[y],view:x,controls:[],interactions:Qr({doubleClickZoom:!1}),pixelRatio:f}),h&&w.once("rendercomplete",function(){x.fit(h,{size:w.getSize(),duration:0})}),this.mapEventHandles=Gd({map:w,source:_,events:p,eventBus:g,getZoom:this.getZoom.bind(this),getCenter:this.getCenter.bind(this),getBounds:this.getBounds.bind(this),getResolution:this.getResolution.bind(this)}),this.appEventHandles=Dw({mapProvider:this,transformRequest:d,events:p,eventBus:g,map:w,onBaseSourceChange:this.mapEventHandles.setSource})||[],this.map=w,this.view=x,g.emit(p.MAP_READY,{map:this.map,mapStyleId:this.mapStyleId,mapSize:this.mapSize,crs:this.crs});case 2:return t.a(2)}},t,this)}),s=function(){var t=this,e=arguments;return new Promise(function(i,n){var s=r.apply(t,e);function o(t){Mb(s,i,n,o,a,"next",t)}function a(t){Mb(s,i,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._onHoverMove&&(this.map.un("pointermove",this._onHoverMove),this._onHoverMove=null),this.map.setTarget(null),this.map=null),this.view=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:Pd})}},{key:"zoomIn",value:function(t){this.view.animate({zoom:this.view.getZoom()+t,duration:Pd})}},{key:"zoomOut",value:function(t){this.view.animate({zoom:this.view.getZoom()-t,duration:Pd})}},{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:Pd})}},{key:"fitToBounds",value:function(t){var e=Array.isArray(t)?t:Ti(qw(t),"EPSG:4326","EPSG:27700");this.view.fit(e,{duration:Pd})}},{key:"setPadding",value:function(t){this.view.padding=Ab(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 function(t,e){if(!e)return[];var i=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).radius,n=void 0===i?10:i,r=[e.x,e.y],s=[],o=new Set;return t.forEachFeatureAtPixel(r,function(t,e){if(e instanceof Bp){var i=t.get("mapbox-layer"),n=null==i?void 0:i.id;if(!n||"background"===(null==i?void 0:i.type))return;var r="".concat(n,":").concat(function(t){var e=t.getId();if(null!=e)return e;var i=function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?fb(Object(i),!0).forEach(function(e){pb(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):fb(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}({},t.getProperties());return delete i["mapbox-layer"],JSON.stringify(i)}(t));if(o.has(r))return;o.add(r),s.push({id:t.getId(),layer:{id:n},geometry:Kw(t),properties:t.getProperties()})}else if(e instanceof Zg){var a=e.get("layerId");if(!a||e.get("_highlight"))return;var l=t.getId(),h="".concat(a,":").concat(l);if(o.has(h))return;o.add(h),s.push({id:l,layer:{id:a},geometry:mb.writeGeometryObject(t.getGeometry()),properties:t.getProperties()})}},{hitTolerance:n}),s}(this.map,t,e)}},{key:"getFeatureGeometry",value:function(t,e,i){var n=Yw(this.map,t,e,i);return 0===n.length?null:1===n.length?n[0]:{type:"MultiPolygon",coordinates:n.flatMap(function(t){return"MultiPolygon"===t.type?t.coordinates:[t.coordinates]})}}},{key:"setHoverCursor",value:function(t){this.map&&(this._onHoverMove=function(t,e,i){var n=t.getViewport();if(i&&t.un("pointermove",i),null==e||!e.length)return n.style.cursor="",null;var r=new Set(e),s=null,o=function(e){var i;if("mouse"===(null===(i=e.originalEvent)||void 0===i?void 0:i.pointerType)){var o=e.pixel;null!==s&&cancelAnimationFrame(s),s=requestAnimationFrame(function(){s=null;var e=t.forEachFeatureAtPixel(o,function(t,e){return function(t,e,i){if(e instanceof Bp){var n,r=null===(n=t.get("mapbox-layer"))||void 0===n?void 0:n.id;return Boolean(r&&i.has(r))}if(e instanceof Zg&&!e.get("_highlight")){var s=e.get("layerId");return Boolean(s&&i.has(s))}return!1}(t,e,r)},{hitTolerance:8});n.style.cursor=e?"pointer":""})}};return t.on("pointermove",o),o}(this.map,t,this._onHoverMove))}},{key:"getVisibleFeatures",value:function(t){return[]}},{key:"updateHighlightedFeatures",value:function(t,e,i){return this._lastHighlightArgs={selectedFeatures:t,activeFeatures:e,stylesMap:i},cb(this.map,t,e,i)}},{key:"reapplyHighlights",value:function(){if(this._lastHighlightArgs){var t=this._lastHighlightArgs,e=t.selectedFeatures,i=t.activeFeatures,n=t.stylesMap;cb(this.map,e,i,n)}}},{key:"getAreaDimensions",value:function(){return function(t){if(!t)return"";var e=Bw(t,4),i=e[0],n=e[1],r=e[2],s=e[3],o=r-i;return"".concat(Xw(s-n)," by ").concat(Xw(o))}((e=(t=this.map).getSize(),n=(i=Bw(t.getView().padding||[0,0,0,0],4))[0],r=i[1],s=i[2],o=[i[3],e[1]-s],a=[e[0]-r,n],l=t.getCoordinateFromPixel(o),h=t.getCoordinateFromPixel(a),l&&h?[l[0],l[1],h[0],h[1]]:null));var t,e,i,n,r,s,o,a,l,h}},{key:"getCardinalMove",value:function(t,e){return function(t,e){var i=e[0]-t[0],n=e[1]-t[1],r=[];return Math.abs(n)>1&&r.push("".concat(n>0?"north":"south"," ").concat(Xw(Math.abs(n)))),Math.abs(i)>1&&r.push("".concat(i>0?"east":"west"," ").concat(Xw(Math.abs(i)))),r.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 n=i.getTargetElement().getBoundingClientRect();if(!n.width||!n.height)return!1;var r=i.getViewport().getBoundingClientRect(),s=r.width/n.width,o=r.height/n.height,a=function(t){return qw(t)}(t),l=Bw(a,4),h=l[0],u=l[1],c=l[2],d=l[3],f=[[h,u],[h,d],[c,u],[c,d]].map(function(t){return i.getPixelFromCoordinate(t)}).filter(Boolean);if(!f.length)return!1;var p=n.left+Math.min.apply(Math,$w(f.map(function(t){return t[0]})))*s,g=n.left+Math.max.apply(Math,$w(f.map(function(t){return t[0]})))*s,m=n.top+Math.min.apply(Math,$w(f.map(function(t){return t[1]})))*o,y=n.top+Math.max.apply(Math,$w(f.map(function(t){return t[1]})))*o;return p<e.right&&g>e.left&&m<e.bottom&&y>e.top}(t,e,this.map)}}],n&&Eb(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,n,r,s}(o)}}]);
|
|
2
|
+
"use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[142],{501(t,e,i){function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function r(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,s(n.key),n)}}function s(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}i.r(e),i.d(e,{default:()=>fS});var o=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},(e=[{key:"isBaseMapReady",value:function(){throw new Error(this.name+" must implement isBaseMapReady()")}}])&&r(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();const a="add",l="remove",h="propertychange";function u(t){for(const e in t)delete t[e]}function c(t){let e;for(e in t)return!1;return!e}function d(t,e,i,n,r){if(r){const r=i;i=function(s){return t.removeEventListener(e,i),r.call(n??this,s)}}else n&&n!==t&&(i=i.bind(n));const s={target:t,type:e,listener:i};return t.addEventListener(e,i),s}function f(t,e,i,n){return d(t,e,i,n,!0)}function p(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),u(t))}const g="change",m="contextmenu",y="click",_="keydown",v="keypress",x="touchmove",w="wheel",b=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function S(t,e){return t>e?1:t<e?-1:0}function M(t,e){return t<e?1:t>e?-1:0}function E(t,e,i){if(t[0]<=e)return 0;const n=t.length;if(e<=t[n-1])return n-1;if("function"==typeof i){for(let r=1;r<n;++r){const n=t[r];if(n===e)return r;if(n<e)return i(e,t[r-1],n)>0?r-1:r}return n-1}if(i>0){for(let i=1;i<n;++i)if(t[i]<e)return i-1;return n-1}if(i<0){for(let i=1;i<n;++i)if(t[i]<=e)return i;return n-1}for(let i=1;i<n;++i){if(t[i]==e)return i;if(t[i]<e)return t[i-1]-e<e-t[i]?i-1:i}return n-1}function C(t,e,i){for(;e<i;){const n=t[e];t[e]=t[i],t[i]=n,++e,--i}}function P(t,e){const i=Array.isArray(e)?e:[e],n=i.length;for(let e=0;e<n;e++)t[t.length]=i[e]}function I(t,e){const i=t.length;if(i!==e.length)return!1;for(let n=0;n<i;n++)if(t[n]!==e[n])return!1;return!0}function T(){return!0}function k(){return!1}function R(){}function A(t){let e,i,n;return function(){const r=Array.prototype.slice.call(arguments);return i&&this===n&&I(r,i)||(n=this,i=r,e=t.apply(this,arguments)),e}}function O(t){return function(){let e;try{e=t()}catch(t){return Promise.reject(t)}return e instanceof Promise?e:Promise.resolve(e)}()}const G=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},F=class extends b{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e="string"==typeof t,i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const r=e?new G(t):t;r.target||(r.target=this.eventTarget_||this);const s=this.dispatching_||(this.dispatching_={}),o=this.pendingRemovals_||(this.pendingRemovals_={});let a;i in s||(s[i]=0,o[i]=0),++s[i];for(let t=0,e=n.length;t<e;++t)if(a="handleEvent"in n[t]?n[t].handleEvent(r):n[t].call(this,r),!1===a||r.propagationStopped){a=!1;break}if(0===--s[i]){let t=o[i];for(delete o[i];t--;)this.removeEventListener(i,R);delete s[i]}return a}disposeInternal(){this.listeners_&&u(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return!!this.listeners_&&(t?t in this.listeners_:Object.keys(this.listeners_).length>0)}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=R,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}};class L extends F{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(g)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=d(this,t[r],e);return n}return d(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const n=t.length;i=new Array(n);for(let r=0;r<n;++r)i[r]=f(this,t[r],e)}else i=f(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)p(t[e]);else p(t)}(i);else if(Array.isArray(t))for(let i=0,n=t.length;i<n;++i)this.removeEventListener(t[i],e);else this.removeEventListener(t,e)}}L.prototype.on,L.prototype.once,L.prototype.un;const j=L;function N(){throw new Error("Unimplemented abstract method.")}let D=0;function z(t){return t.ol_uid||(t.ol_uid=String(++D))}class q extends G{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}const B=class extends j{constructor(t){super(),this.on,this.once,this.un,z(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 q(i,t,e)),i=h,this.hasListener(i)&&this.dispatchEvent(new q(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const n=this.values_||(this.values_={});if(i)n[t]=e;else{const i=n[t];n[t]=e,i!==e&&this.notify(t,i)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],c(this.values_)&&(this.values_=null),e||this.notify(t,i)}}},$="length";class U extends G{constructor(t,e,i){super(t),this.element=e,this.index=i}}const W=class extends B{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t??[],this.unique_)for(let t=1,e=this.array_.length;t<e;++t)this.assertUnique_(this.array_[t],t);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get($)}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 U(a,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new U(l,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 U(l,i,t)),this.dispatchEvent(new U(a,e,t))}updateLength_(){this.set($,this.array_.length)}assertUnique_(t,e){const i=this.array_;for(let n=0,r=i.length;n<r;++n)if(i[n]===t&&n!==e)throw new Error("Duplicate item added to a unique collection")}},X=class extends G{constructor(t,e,i){super(t),this.map=e,this.frameState=void 0!==i?i:null}},V=class extends X{constructor(t,e,i,n,r,s){super(t,e,r),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=void 0!==n&&n,this.activePointers=s}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()}},K={SINGLECLICK:"singleclick",CLICK:y,DBLCLICK:"dblclick",POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Z="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",Y=(Z.includes("safari")&&!Z.includes("chrom")&&(Z.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(Z)),Z.includes("webkit")&&!Z.includes("edge")),H=Z.includes("macintosh"),J="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,Q="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,tt="undefined"!=typeof Image&&Image.prototype.decode,et=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}(),it="pointerdown",nt=class extends F{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_=d(i,it,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=d(i,"pointermove",this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(x,this.boundHandleTouchMove_,!!et&&{passive:!1})}emulateClick_(t){let e=new V(K.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new V(K.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const e=new V(K.SINGLECLICK,this.map_,t);this.dispatchEvent(e)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==K.POINTERUP||e.type==K.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!=K.POINTERDOWN&&e.type!=K.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new V(K.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(p),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 V(K.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(d(t,K.POINTERMOVE,this.handlePointerMove_,this),d(t,K.POINTERUP,this.handlePointerUp_,this),d(this.element_,K.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==t&&this.dragListenerKeys_.push(d(this.element_.getRootNode(),K.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new V(K.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 V(K.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_&&(p(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(x,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(p(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(p),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},rt="postrender",st="loadstart",ot="loadend",at="layergroup",lt="size",ht="target",ut="view";function ct(t,e){if(!t)throw new Error(e)}const dt=1/0,ft=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,u(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 n=this.keyFunction_(i);return delete this.queuedElements_[n],i}enqueue(t){ct(!(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!=dt&&(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_,n=e.length,r=e[t],s=i[t],o=t;for(;t<n>>1;){const r=this.getLeftChildIndex_(t),s=this.getRightChildIndex_(t),o=s<n&&i[s]<i[r]?s:r;e[t]=e[o],i[t]=i[o],t=o}e[t]=r,i[t]=s,this.siftDown_(o,t)}siftDown_(t,e){const i=this.elements_,n=this.priorities_,r=i[e],s=n[e];for(;e>t;){const t=this.getParentIndex_(e);if(!(n[t]>s))break;i[e]=i[t],n[e]=n[t],e=t}i[e]=r,n[e]=s}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const r=e.length;let s,o,a;for(o=0;o<r;++o)s=e[o],a=t(s),a==dt?delete this.queuedElements_[this.keyFunction_(s)]:(i[n]=a,e[n++]=s);e.length=n,i.length=n,this.heapify_()}},pt=class extends ft{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(g,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(g,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())}}},gt={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function mt(t,e,i){return Math.min(Math.max(t,e),i)}function yt(t,e,i,n,r,s){const o=r-i,a=s-n;if(0!==o||0!==a){const l=((t-i)*o+(e-n)*a)/(o*o+a*a);l>1?(i=r,n=s):l>0&&(i+=o*l,n+=a*l)}return _t(t,e,i,n)}function _t(t,e,i,n){const r=i-t,s=n-e;return r*r+s*s}function vt(t){return 180*t/Math.PI}function xt(t){return t*Math.PI/180}function wt(t,e){const i=t%e;return i*e<0?i+e:i}function bt(t,e,i){return t+i*(e-t)}function St(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function Mt(t,e){return Math.round(St(t,e))}function Et(t,e){return Math.floor(St(t,e))}function Ct(t,e){return Math.ceil(St(t,e))}function Pt(t,e,i){if(t>=e&&t<i)return t;const n=i-e;return((t-e)%n+n)%n+e}function It(t,e,i){return function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;const l=e?0:s[0]*r,h=e?0:s[1]*r,u=a?a[0]:0,c=a?a[1]:0;let d=t[0]+l/2+u,f=t[2]-l/2+u,p=t[1]+h/2+c,g=t[3]-h/2+c;d>f&&(d=(f+d)/2,f=d),p>g&&(p=(g+p)/2,g=p);let m=mt(n[0],d,f),y=mt(n[1],p,g);if(o&&i&&r){const t=30*r;m+=-t*Math.log(1+Math.max(0,d-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-f)/t),y+=-t*Math.log(1+Math.max(0,p-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-g)/t)}return[m,y]}}function Tt(t){return t}function kt(t){const e=[1/0,1/0,-1/0,-1/0];for(let i=0,n=t.length;i<n;++i)Ut(e,t[i]);return e}function Rt(t,e,i){return i?(i[0]=t[0]-e,i[1]=t[1]-e,i[2]=t[2]+e,i[3]=t[3]+e,i):[t[0]-e,t[1]-e,t[2]+e,t[3]+e]}function At(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t.slice()}function Ot(t,e,i){let n,r;return n=e<t[0]?t[0]-e:t[2]<e?e-t[2]:0,r=i<t[1]?t[1]-i:t[3]<i?i-t[3]:0,n*n+r*r}function Gt(t,e){return Lt(t,e[0],e[1])}function Ft(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function Lt(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function jt(t,e){const i=t[0],n=t[1],r=t[2],s=t[3],o=e[0],a=e[1];let l=0;return o<i?l|=16:o>r&&(l|=4),a<n?l|=8:a>s&&(l|=2),0===l&&(l=1),l}function Nt(t,e,i,n,r){return r?(r[0]=t,r[1]=e,r[2]=i,r[3]=n,r):[t,e,i,n]}function Dt(t){return Nt(1/0,1/0,-1/0,-1/0,t)}function zt(t,e){const i=t[0],n=t[1];return Nt(i,n,i,n,e)}function qt(t,e,i,n,r){return Wt(Dt(r),t,e,i,n)}function Bt(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function $t(t,e){return e[0]<t[0]&&(t[0]=e[0]),e[2]>t[2]&&(t[2]=e[2]),e[1]<t[1]&&(t[1]=e[1]),e[3]>t[3]&&(t[3]=e[3]),t}function Ut(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 Wt(t,e,i,n,r){for(;i<n;i+=r)Xt(t,e[i],e[i+1]);return t}function Xt(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 Vt(t,e){let i;return i=e(Zt(t)),i||(i=e(Yt(t)),i||(i=e(re(t)),i||(i=e(ne(t)),i||!1)))}function Kt(t){let e=0;return ae(t)||(e=se(t)*ee(t)),e}function Zt(t){return[t[0],t[1]]}function Yt(t){return[t[2],t[1]]}function Ht(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function Jt(t,e){let i;if("bottom-left"===e)i=Zt(t);else if("bottom-right"===e)i=Yt(t);else if("top-left"===e)i=ne(t);else{if("top-right"!==e)throw new Error("Invalid corner");i=re(t)}return i}function Qt(t,e,i,n,r){const[s,o,a,l,h,u,c,d]=te(t,e,i,n);return Nt(Math.min(s,a,h,c),Math.min(o,l,u,d),Math.max(s,a,h,c),Math.max(o,l,u,d),r)}function te(t,e,i,n){const r=e*n[0]/2,s=e*n[1]/2,o=Math.cos(i),a=Math.sin(i),l=r*o,h=r*a,u=s*o,c=s*a,d=t[0],f=t[1];return[d-l+c,f-h-u,d-l-c,f-h+u,d+l-c,f+h+u,d+l+c,f+h-u,d-l+c,f-h-u]}function ee(t){return t[3]-t[1]}function ie(t,e,i){const n=i||[1/0,1/0,-1/0,-1/0];return oe(t,e)?(t[0]>e[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]<e[2]?n[2]=t[2]:n[2]=e[2],t[3]<e[3]?n[3]=t[3]:n[3]=e[3]):Dt(n),n}function ne(t){return[t[0],t[3]]}function re(t){return[t[2],t[3]]}function se(t){return t[2]-t[0]}function oe(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function ae(t){return t[2]<t[0]||t[3]<t[1]}function le(t,e){const i=e.getExtent(),n=Ht(t);if(e.canWrapX()&&(n[0]<i[0]||n[0]>=i[2])){const e=se(i),r=Math.floor((n[0]-i[0])/e)*e;t[0]-=r,t[2]-=r}return t}function he(t,e,i){if(e.canWrapX()){const n=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[n[0],t[1],n[2],t[3]]];le(t,e);const r=se(n);if(se(t)>r&&!i)return[[n[0],t[1],n[2],t[3]]];if(t[0]<n[0])return[[t[0]+r,t[1],n[2],t[3]],[n[0],t[1],t[2],t[3]]];if(t[2]>n[2])return[[t[0],t[1],n[2],t[3]],[n[0],t[1],t[2]-r,t[3]]]}return[t]}function ue(t,e){let i=!0;for(let n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function ce(t,e){const i=Math.cos(e),n=Math.sin(e),r=t[0]*i-t[1]*n,s=t[1]*i+t[0]*n;return t[0]=r,t[1]=s,t}function de(t,e){if(e.canWrapX()){const i=se(e.getExtent()),n=fe(t,e,i);n&&(t[0]-=n*i)}return t}function fe(t,e,i){const n=e.getExtent();let r=0;return e.canWrapX()&&(t[0]<n[0]||t[0]>n[2])&&(i=i||se(n),r=Math.floor((t[0]-n[0])/i)),r}function pe(t){return Math.pow(t,3)}function ge(t){return 1-pe(1-t)}function me(t){return 3*t*t-2*t*t*t}function ye(t){return t}const _e=2,ve=3;let xe=1;function we(...t){xe>_e||console.warn(...t)}function be(...t){xe>ve||console.error(...t)}const Se={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937},Me=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||Se[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_}},Ee=6378137,Ce=Math.PI*Ee,Pe=[-Ce,-Ce,Ce,Ce],Ie=[-180,-85,180,85],Te=Ee*Math.log(Math.tan(Math.PI/2));class ke extends Me{constructor(t){super({code:t,units:"m",extent:Pe,global:!0,worldExtent:Ie,getPointResolution:function(t,e){return t/Math.cosh(e[1]/Ee)}})}}const Re=[new ke("EPSG:3857"),new ke("EPSG:102100"),new ke("EPSG:102113"),new ke("EPSG:900913"),new ke("http://www.opengis.net/def/crs/EPSG/0/3857"),new ke("http://www.opengis.net/gml/srs/epsg.xml#3857")];const Ae=[-180,-90,180,90],Oe=6378137*Math.PI/180;class Ge extends Me{constructor(t,e){super({code:t,units:"degrees",extent:Ae,axisOrientation:e,global:!0,metersPerUnit:Oe,worldExtent:Ae})}}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 Le={};function je(t){return Le[t]||Le[t.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}let Ne={};function De(t,e,i){const n=t.getCode(),r=e.getCode();n in Ne||(Ne[n]={}),Ne[n][r]=i}function ze(t,e){return t in Ne&&e in Ne[t]?Ne[t][e]:null}const qe=.9996,Be=.00669438,$e=Be*Be,Ue=$e*Be,We=Be/(1-Be),Xe=Math.sqrt(1-Be),Ve=(1-Xe)/(1+Xe),Ke=Ve*Ve,Ze=Ke*Ve,Ye=Ze*Ve,He=Ye*Ve,Je=.9983242984503243,Qe=15*$e/256+45*Ue/1024,ti=35*Ue/3072,ei=1.5*Ve-27/32*Ze+269/512*He,ii=21/16*Ke-55/32*Ye,ni=151/96*Ze-417/128*He,ri=1097/512*Ye,si=6378137;function oi(t,e,i){const n=t-5e5,r=(i.north?e:e-1e7)/qe/(si*Je),s=r+ei*Math.sin(2*r)+ii*Math.sin(4*r)+ni*Math.sin(6*r)+ri*Math.sin(8*r),o=Math.sin(s),a=o*o,l=Math.cos(s),h=o/l,u=h*h,c=u*u,d=1-Be*a,f=Math.sqrt(1-Be*a),p=We*l**2,g=p*p,m=n/(si/f*qe),y=m*m,_=y*m,v=_*m,x=v*m,w=s-h/((1-Be)/d)*(y/2-v/24*(5+3*u+10*p-4*g-9*We))+x*m/720*(61+90*u+298*p+45*c-252*We-3*g);let b=(m-_/6*(1+2*u+p)+x/120*(5-2*p+28*u-3*g+8*We+24*c))/l;return b=Pt(b+xt(li(i.number)),-Math.PI,Math.PI),[vt(b),vt(w)]}function ai(t,e,i){t=Pt(t,-180,180),e<-80?e=-80:e>84&&(e=84);const n=xt(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,h=xt(t),u=xt(li(i.number)),c=si/Math.sqrt(1-Be*r**2),d=We*s**2,f=s*Pt(h-u,-Math.PI,Math.PI),p=f*f,g=p*f,m=g*f,y=m*f,_=y*f,v=si*(Je*n-.002514607064228144*Math.sin(2*n)+Qe*Math.sin(4*n)-ti*Math.sin(6*n)),x=qe*c*(f+g/6*(1-a+d)+y/120*(5-18*a+l+72*d-58*We))+5e5;let w=qe*(v+c*o*(p/2+m/24*(5-a+9*d+4*d**2)+_/720*(61-58*a+l+600*d-330*We)));return i.north||(w+=1e7),[x,w]}function li(t){return 6*(t-1)-180+3}const hi=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function ui(t){let e=0;for(const i of hi){const n=t.match(i);if(n){e=parseInt(n[1]);break}}if(!e)return null;let i=0,n=!1;return e>32700&&e<32761?i=e-32700:e>32600&&e<32661&&(n=!0,i=e-32600),i?{number:i,north:n}:null}function ci(t,e){return function(i,n,r,s){const o=i.length;r=r>1?r:2,s=s??r,n||(n=r>2?i.slice():new Array(o));for(let r=0;r<o;r+=s){const s=i[r],o=i[r+1],a=t(s,o,e);n[r]=a[0],n[r+1]=a[1]}return n}}function di(t,e,i){i=i||6371008.8;const n=xt(t[1]),r=xt(e[1]),s=(r-n)/2,o=xt(e[0]-t[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(r);return 2*i*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}const fi=[function(t){const e=ui(t.getCode());return e?{forward:ci(ai,e),inverse:ci(oi,e)}:null}],pi=[function(t){return ui(t)?new Me({code:t,units:"m"}):null}];let gi=!0;function mi(t,e){if(void 0!==e)for(let i=0,n=t.length;i<n;++i)e[i]=t[i];else e=t.slice();return e}function yi(t){!function(t,e){Le[t]=e}(t.getCode(),t),De(t,t,mi)}function _i(t){if("string"!=typeof t)return t;const e=je(t);if(e)return e;for(const e of pi){const i=e(t);if(i)return i}return null}function vi(t,e,i,n){let r;const s=(t=_i(t)).getPointResolutionFunc();if(s){if(r=s(e,i),n&&n!==t.getUnits()){const e=t.getMetersPerUnit();e&&(r=r*e/Se[n])}}else{const s=t.getUnits();if("degrees"==s&&!n||"degrees"==n)r=e;else{const o=Ei(t,_i("EPSG:4326"));if(o||"degrees"===s){let t=[i[0]-e/2,i[1],i[0]+e/2,i[1],i[0],i[1]-e/2,i[0],i[1]+e/2];t=o(t,t,2),r=(di(t.slice(0,2),t.slice(2,4))+di(t.slice(4,6),t.slice(6,8)))/2}else r=e*t.getMetersPerUnit();const a=n?Se[n]:t.getMetersPerUnit();void 0!==a&&(r/=a)}}return r}function xi(t){!function(t){t.forEach(yi)}(t),t.forEach(function(e){t.forEach(function(t){e!==t&&De(e,t,mi)})})}function wi(t,e){return t?"string"==typeof t?_i(t):t:_i(e)}function bi(t){return function(e,i,n,r){const s=e.length;n=void 0!==n?n:2,r=r??n,i=void 0!==i?i:new Array(s);for(let o=0;o<s;o+=r){const s=t(e.slice(o,o+n)),a=s.length;for(let t=0,n=r;t<n;++t)i[o+t]=t>=a?e[o+t]:s[t]}return i}}function Si(t,e,i,n){const r=_i(t),s=_i(e);De(r,s,bi(i)),De(s,r,bi(n))}function Mi(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();return(t.getCode()===e.getCode()||Ei(t,e)===mi)&&i}function Ei(t,e){const i=t.getCode(),n=e.getCode();let r=ze(i,n);if(r)return r;let s=null,o=null;for(const i of fi)s||(s=i(t)),o||(o=i(e));if(!s&&!o)return null;const a="EPSG:4326";if(o)if(s)r=Ci(s.inverse,o.forward);else{const t=ze(i,a);t&&(r=Ci(t,o.forward))}else{const t=ze(a,n);t&&(r=Ci(s.inverse,t))}return r&&(yi(t),yi(e),De(t,e,r)),r}function Ci(t,e){return function(i,n,r,s){return n=t(i,n,r,s),e(n,n,r,s)}}function Pi(t,e){return Ei(_i(t),_i(e))}function Ii(t,e,i){const n=Pi(e,i);if(!n){const t=_i(e).getCode(),n=_i(i).getCode();throw new Error(`No transform available between ${t} and ${n}`)}return n(t,void 0,t.length)}function Ti(t,e,i,n){return function(t,e,i,n){if(ae(t))return Dt(i);let r=[];if(n>1){const e=t[2]-t[0],i=t[3]-t[1];for(let s=0;s<n;++s)r.push(t[0]+e*s/n,t[1],t[2],t[1]+i*s/n,t[2]-e*s/n,t[3],t[0],t[3]-i*s/n)}else r=[t[0],t[1],t[2],t[1],t[2],t[3],t[0],t[3]];e(r,r,2);const s=[],o=[];for(let t=0,e=r.length;t<e;t+=2)s.push(r[t]),o.push(r[t+1]);return function(t,e,i){return Nt(Math.min.apply(null,t),Math.min.apply(null,e),Math.max.apply(null,t),Math.max.apply(null,e),i)}(s,o,i)}(t,Pi(e,i),void 0,n)}let ki=null;function Ri(){return ki}function Ai(t,e){return t}function Oi(t,e){return gi&&!ue(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(gi=!1,we("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t}function Gi(t,e){return t}function Fi(t,e){return t}function Li(t,e){return t}function ji(t,e,i){return function(n){let r,s;if(t.canWrapX()){const e=t.getExtent(),o=se(e);s=fe(n=n.slice(0),t,o),s&&(n[0]=n[0]-s*o),n[0]=mt(n[0],e[0],e[2]),n[1]=mt(n[1],e[1],e[3]),r=i(n)}else r=i(n);return s&&e.canWrapX()&&(r[0]+=s*se(e.getExtent())),r}}var Ni,Di,zi;xi(Re),xi(Fe),Ni=Re,Di=function(t,e,i,n){const r=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(r));for(let i=0;i<r;i+=n){e[i]=Ce*t[i]/180;let n=Ee*Math.log(Math.tan(Math.PI*(+t[i+1]+90)/360));n>Te?n=Te:n<-Te&&(n=-Te),e[i+1]=n}return e},zi=function(t,e,i,n){const r=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(r));for(let i=0;i<r;i+=n)e[i]=180*t[i]/Ce,e[i+1]=360*Math.atan(Math.exp(t[i+1]/Ee))/Math.PI-90;return e},Fe.forEach(function(t){Ni.forEach(function(e){De(t,e,Di),De(e,t,zi)})});const qi=new Array(6);function Bi(t){return Ui(t,1,0,0,1,0,0)}function $i(t,e){const i=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=e[0],h=e[1],u=e[2],c=e[3],d=e[4],f=e[5];return t[0]=i*l+r*h,t[1]=n*l+s*h,t[2]=i*u+r*c,t[3]=n*u+s*c,t[4]=i*d+r*f+o,t[5]=n*d+s*f+a,t}function Ui(t,e,i,n,r,s,o){return t[0]=e,t[1]=i,t[2]=n,t[3]=r,t[4]=s,t[5]=o,t}function Wi(t,e){const i=e[0],n=e[1];return e[0]=t[0]*i+t[2]*n+t[4],e[1]=t[1]*i+t[3]*n+t[5],e}function Xi(t,e,i){return $i(t,Ui(qi,e,0,0,i,0,0))}function Vi(t,e,i,n,r,s,o,a){const l=Math.sin(s),h=Math.cos(s);return t[0]=n*h,t[1]=r*l,t[2]=-n*l,t[3]=r*h,t[4]=o*n*h-a*n*l+e,t[5]=o*r*l+a*r*h+i,t}function Ki(t,e){const i=(n=e)[0]*n[3]-n[1]*n[2];var n;ct(0!==i,"Transformation matrix cannot be inverted");const r=e[0],s=e[1],o=e[2],a=e[3],l=e[4],h=e[5];return t[0]=a/i,t[1]=-s/i,t[2]=-o/i,t[3]=r/i,t[4]=(o*h-a*l)/i,t[5]=-(r*h-s*l)/i,t}const Zi=[1e5,1e5,1e5,1e5,2,2];function Yi(t){return t.substring(7,t.length-1).split(",").map(parseFloat)}function Hi(t,e,i,n,r,s,o){s=s||[],o=o||2;let a=0;for(let l=e;l<i;l+=n){const e=t[l],i=t[l+1];s[a++]=r[0]*e+r[2]*i+r[4],s[a++]=r[1]*e+r[3]*i+r[5];for(let e=2;e<o;e++)s[a++]=t[l+e]}return s&&s.length!=a&&(s.length=a),s}function Ji(t,e,i,n,r,s,o){o=o||[];const a=Math.cos(r),l=Math.sin(r),h=s[0],u=s[1];let c=0;for(let r=e;r<i;r+=n){const e=t[r]-h,i=t[r+1]-u;o[c++]=h+e*a-i*l,o[c++]=u+e*l+i*a;for(let e=r+2;e<r+n;++e)o[c++]=t[e]}return o&&o.length!=c&&(o.length=c),o}const Qi=[1,0,0,1,0,0],tn=[NaN,NaN],en=class extends B{constructor(){super(),this.extent_=[1/0,1/0,-1/0,-1/0],this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=A((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return N()}closestPointXY(t,e,i,n){return N()}containsXY(t,e){return 0===this.closestPointXY(t,e,tn,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 N()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&Dt(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){N()}scale(t,e,i){N()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return N()}getType(){return N()}applyTransform(t){N()}intersectsExtent(t){return N()}translate(t,e){N()}transform(t,e){const i=_i(t),n="tile-pixels"==i.getUnits()?function(t,n,r){const s=i.getExtent(),o=i.getWorldExtent(),a=ee(o)/ee(s);Vi(Qi,o[0],o[3],a,-a,0,0,0);const l=Hi(t,0,t.length,r,Qi,n),h=Pi(i,e);return h?h(l,l,r):l}:Pi(i,e);return this.applyTransform(n),this}};function nn(t){let e;return 2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM"),e}function rn(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}const sn=class extends en{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return qt(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return N()}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=rn(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){N()}setLayout(t,e,i){let n;if(t)n=rn(t);else{for(let t=0;t<i;++t){if(0===e.length)return this.layout="XY",void(this.stride=2);e=e[0]}n=e.length,t=nn(n)}this.layout=t,this.stride=n}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();Ji(i,0,i.length,n,t,e,i),this.changed()}}scale(t,e,i){void 0===e&&(e=t),i||(i=Ht(this.getExtent()));const n=this.getFlatCoordinates();if(n){const r=this.getStride();!function(t,e,i,n,r,s,o,a){a=a||[];const l=o[0],h=o[1];let u=0;for(let e=0;e<i;e+=n){const i=t[e]-l,o=t[e+1]-h;a[u++]=l+r*i,a[u++]=h+s*o;for(let i=e+2;i<e+n;++i)a[u++]=t[i]}a&&a.length!=u&&(a.length=u)}(n,0,n.length,r,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();!function(t,e,i,n,r,s,o){o=o||[];let a=0;for(let e=0;e<i;e+=n){o[a++]=t[e]+r,o[a++]=t[e+1]+s;for(let i=e+2;i<e+n;++i)o[a++]=t[i]}o&&o.length!=a&&(o.length=a)}(i,0,i.length,n,t,e,i),this.changed()}}};function on(t,e,i,n){let r=0;const s=t[i-n],o=t[i-n+1];let a=0,l=0;for(;e<i;e+=n){const i=t[e]-s,n=t[e+1]-o;r+=l*i-a*n,a=i,l=n}return r/2}function an(t,e,i,n){let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s];r+=on(t,e,o,n),e=o}return r}function ln(t,e,i,n,r,s,o){const a=t[e],l=t[e+1],h=t[i]-a,u=t[i+1]-l;let c;if(0===h&&0===u)c=e;else{const d=((r-a)*h+(s-l)*u)/(h*h+u*u);if(d>1)c=i;else{if(d>0){for(let r=0;r<n;++r)o[r]=bt(t[e+r],t[i+r],d);return void(o.length=n)}c=e}}for(let e=0;e<n;++e)o[e]=t[c+e];o.length=n}function hn(t,e,i,n,r){let s=t[e],o=t[e+1];for(e+=n;e<i;e+=n){const i=t[e],n=t[e+1],a=_t(s,o,i,n);a>r&&(r=a),s=i,o=n}return r}function un(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];r=hn(t,e,o,n,r),e=o}return r}function cn(t,e,i,n,r,s,o,a,l,h,u){if(e==i)return h;let c,d;if(0===r){if(d=_t(o,a,t[e],t[e+1]),d<h){for(c=0;c<n;++c)l[c]=t[e+c];return l.length=n,d}return h}u=u||[NaN,NaN];let f=e+n;for(;f<i;)if(ln(t,f-n,f,n,o,a,u),d=_t(o,a,u[0],u[1]),d<h){for(h=d,c=0;c<n;++c)l[c]=u[c];l.length=n,f+=n}else f+=n*Math.max((Math.sqrt(d)-Math.sqrt(h))/r|0,1);if(s&&(ln(t,i-n,e,n,o,a,u),d=_t(o,a,u[0],u[1]),d<h)){for(h=d,c=0;c<n;++c)l[c]=u[c];l.length=n}return h}function dn(t,e,i,n,r,s,o,a,l,h,u){u=u||[NaN,NaN];for(let c=0,d=i.length;c<d;++c){const d=i[c];h=cn(t,e,d,n,r,s,o,a,l,h,u),e=d}return h}function fn(t,e,i,n){for(let r=0,s=i.length;r<s;++r){const s=i[r];for(let i=0;i<n;++i)t[e++]=s[i]}return e}function pn(t,e,i,n,r){r=r||[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=fn(t,e,i[o],n);r[s++]=a,e=a}return r.length=s,r}function gn(t,e,i,n,r){r=r||[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=pn(t,e,i[o],n,r[s]);0===a.length&&(a[0]=e),r[s++]=a,e=a[a.length-1]}return r.length=s,r}function mn(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=e;o<i;o+=n)r[s++]=t.slice(o,o+n);return r.length=s,r}function yn(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];r[s++]=mn(t,e,a,n,r[s]),e=a}return r.length=s,r}function _n(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];r[s++]=1===a.length&&a[0]===e?[]:yn(t,e,a,n,r[s]),e=a[a.length-1]}return r.length=s,r}function vn(t,e,i,n,r,s,o){const a=(i-e)/n;if(a<3){for(;e<i;e+=n)s[o++]=t[e],s[o++]=t[e+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[e,i-n];let u=0;for(;h.length>0;){const i=h.pop(),s=h.pop();let o=0;const a=t[s],c=t[s+1],d=t[i],f=t[i+1];for(let e=s+n;e<i;e+=n){const i=yt(t[e],t[e+1],a,c,d,f);i>o&&(u=e,o=i)}o>r&&(l[(u-e)/n]=1,s+n<u&&h.push(s,u),u+n<i&&h.push(u,i))}for(let i=0;i<a;++i)l[i]&&(s[o++]=t[e+i*n],s[o++]=t[e+i*n+1]);return o}function xn(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=vn(t,e,h,n,r,s,o),a.push(o),e=h}return o}function wn(t,e){return e*Math.round(t/e)}function bn(t,e,i,n,r,s,o){if(e==i)return o;let a,l,h=wn(t[e],r),u=wn(t[e+1],r);e+=n,s[o++]=h,s[o++]=u;do{if(a=wn(t[e],r),l=wn(t[e+1],r),(e+=n)==i)return s[o++]=a,s[o++]=l,o}while(a==h&&l==u);for(;e<i;){const i=wn(t[e],r),c=wn(t[e+1],r);if(e+=n,i==a&&c==l)continue;const d=a-h,f=l-u,p=i-h,g=c-u;d*g==f*p&&(d<0&&p<d||d==p||d>0&&p>d)&&(f<0&&g<f||f==g||f>0&&g>f)?(a=i,l=c):(s[o++]=a,s[o++]=l,h=a,u=l,a=i,l=c)}return s[o++]=a,s[o++]=l,o}function Sn(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=bn(t,e,h,n,r,s,o),a.push(o),e=h}return o}class Mn extends sn{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 Mn(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<Ot(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(hn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),cn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return on(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return mn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=vn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Mn(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=fn(this.flatCoordinates,0,t,this.stride),this.changed()}}const En=Mn;class Cn extends sn{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Cn(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const r=this.flatCoordinates,s=_t(t,e,r[0],r[1]);if(s<n){const t=this.stride;for(let e=0;e<t;++e)i[e]=r[e];return i.length=t,s}return n}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return zt(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Lt(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=function(t,e,i){for(let n=0,r=i.length;n<r;++n)t[e++]=i[n];return e}(this.flatCoordinates,0,t,this.stride),this.changed()}}const Pn=Cn;function In(t,e,i,n,r){return!Vt(r,function(r){return!Tn(t,e,i,n,r[0],r[1])})}function Tn(t,e,i,n,r,s){let o=0,a=t[i-n],l=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];l<=s?n>s&&(i-a)*(s-l)-(r-a)*(n-l)>0&&o++:n<=s&&(i-a)*(s-l)-(r-a)*(n-l)<0&&o--,a=i,l=n}return 0!==o}function kn(t,e,i,n,r,s){if(0===i.length)return!1;if(!Tn(t,e,i[0],n,r,s))return!1;for(let e=1,o=i.length;e<o;++e)if(Tn(t,i[e-1],i[e],n,r,s))return!1;return!0}function Rn(t,e,i,n,r,s,o){let a,l,h,u,c,d,f;const p=r[s+1],g=[];for(let r=0,s=i.length;r<s;++r){const s=i[r];for(u=t[s-n],d=t[s-n+1],a=e;a<s;a+=n)c=t[a],f=t[a+1],(p<=d&&f<=p||d<=p&&p<=f)&&(h=(p-d)/(f-d)*(c-u)+u,g.push(h)),u=c,d=f}let m=NaN,y=-1/0;for(g.sort(S),u=g[0],a=1,l=g.length;a<l;++a){c=g[a];const r=Math.abs(c-u);r>y&&(h=(u+c)/2,kn(t,e,i,n,h,p)&&(m=h,y=r)),u=c}return isNaN(m)&&(m=r[s]),o?(o.push(m,p,y),o):[m,p,y]}function An(t,e,i,n,r){let s=[];for(let o=0,a=i.length;o<a;++o){const a=i[o];s=Rn(t,e,a,n,r,2*o,s),e=a[a.length-1]}return s}function On(t,e,i,n,r){let s;for(e+=n;e<i;e+=n)if(s=r(t.slice(e-n,e),t.slice(e,e+n)),s)return s;return!1}function Gn(t,e,i,n,r,s){return s=s??Wt([1/0,1/0,-1/0,-1/0],t,e,i,n),!!oe(r,s)&&(s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]||On(t,e,i,n,function(t,e){return function(t,e,i){let n=!1;const r=jt(t,e),s=jt(t,i);if(1===r||1===s)n=!0;else{const o=t[0],a=t[1],l=t[2],h=t[3],u=e[0],c=e[1],d=i[0],f=i[1],p=(f-c)/(d-u);let g,m;2&s&&!(2&r)&&(g=d-(f-h)/p,n=g>=o&&g<=l),n||!(4&s)||4&r||(m=f-(d-l)*p,n=m>=a&&m<=h),n||!(8&s)||8&r||(g=d-(f-a)/p,n=g>=o&&g<=l),n||!(16&s)||16&r||(m=f-(d-o)*p,n=m>=a&&m<=h)}return n}(r,t,e)}))}function Fn(t,e,i,n,r){return!!(Gn(t,e,i,n,r)||Tn(t,e,i,n,r[0],r[1])||Tn(t,e,i,n,r[0],r[3])||Tn(t,e,i,n,r[2],r[1])||Tn(t,e,i,n,r[2],r[3]))}function Ln(t,e,i,n,r){if(!Fn(t,e,i[0],n,r))return!1;if(1===i.length)return!0;for(let e=1,s=i.length;e<s;++e)if(In(t,i[e-1],i[e],n,r)&&!Gn(t,i[e-1],i[e],n,r))return!1;return!0}function jn(t,e,i,n){for(;e<i-n;){for(let r=0;r<n;++r){const s=t[e+r];t[e+r]=t[i-n+r],t[i-n+r]=s}e+=n,i-=n}}function Nn(t,e,i,n){let r=0,s=t[i-n],o=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];r+=(i-s)*(n+o),s=i,o=n}return 0===r?void 0:r>0}function Dn(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=Nn(t,e,o,n);if(0===s){if(r&&a||!r&&!a)return!1}else if(r&&!a||!r&&a)return!1;e=o}return!0}function zn(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];if(!Dn(t,e,o,n,r))return!1;o.length&&(e=o[o.length-1])}return!0}function qn(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=Nn(t,e,o,n);(0===s?r&&a||!r&&!a:r&&!a||!r&&a)&&jn(t,e,o,n),e=o}return e}function Bn(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s)e=qn(t,e,i[s],n,r);return e}function $n(t,e){const i=[];let n,r=0,s=0;for(let o=0,a=e.length;o<a;++o){const a=e[o],l=Nn(t,r,a,2);if(void 0===n&&(n=l),l===n)i.push(e.slice(s,o+1));else{if(0===i.length)continue;i[i.length-1].push(e[s])}s=o+1,r=a}return i}class Un extends sn{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?P(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Un(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Ot(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(un(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),dn(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return kn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return an(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),qn(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,yn(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=Ht(this.getExtent());this.flatInteriorPoint_=Rn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Pn(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new En(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,n=[];let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=new En(e.slice(r,o),t);n.push(a),r=o}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Dn(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=qn(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Sn(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new Un(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return Ln(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=pn(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}const Wn=Un;function Xn(t){if(ae(t))throw new Error("Cannot create polygon from empty extent");const e=t[0],i=t[1],n=t[2],r=t[3],s=[e,i,e,r,n,r,n,i,e,i];return new Un(s,"XY",[s.length])}function Vn(t,e,i,n){const r=se(e)/i[0],s=ee(e)/i[1];return n?Math.min(t,Math.max(r,s)):Math.min(t,Math.min(r,s))}function Kn(t,e,i){let n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(n=Math.max(n,i),n/=Math.log(1+50*Math.max(0,i/t-1))/50+1),mt(n,i/2,2*e)}function Zn(t,e,i,n,r){return i=void 0===i||i,function(s,o,a,l){if(void 0!==s){const o=n?Vn(t,n,a,r):t;return i&&l?Kn(s,o,e):mt(s,e,o)}}}function Yn(t){if(void 0!==t)return 0}function Hn(t){if(void 0!==t)return t}function Jn(t,e){setTimeout(function(){t(e)},0)}function Qn(t){return!(t.sourceCenter&&t.targetCenter&&!ue(t.sourceCenter,t.targetCenter))&&t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation}function tr(t,e,i,n,r){const s=Math.cos(-r);let o=Math.sin(-r),a=t[0]*s-t[1]*o,l=t[1]*s+t[0]*o;return a+=(e[0]/2-i[0])*n,l+=(i[1]-e[1]/2)*n,o=-o,[a*s-l*o,l*s+a*o]}const er=class extends B{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=wi(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){gi=!(void 0===t||t)}(),t.center&&(t.center=Oi(t.center,this.projection_)),t.extent&&(t.extent=Fi(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const t in gt)delete e[t];this.setProperties(e,!0);const i=function(t){let e,i,n;let r=void 0!==t.minZoom?t.minZoom:0,s=void 0!==t.maxZoom?t.maxZoom:28;const o=void 0!==t.zoomFactor?t.zoomFactor:2,a=void 0!==t.multiWorld&&t.multiWorld,l=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,h=void 0!==t.showFullExtent&&t.showFullExtent,u=wi(t.projection,"EPSG:3857"),c=u.getExtent();let d=t.constrainOnlyCenter,f=t.extent;if(a||f||!u.isGlobal()||(d=!1,f=c),void 0!==t.resolutions){const o=t.resolutions;i=o[r],n=void 0!==o[s]?o[s]:o[o.length-1],e=t.constrainResolution?function(t,e,i,n){return e=void 0===e||e,function(r,s,o,a){if(void 0!==r){const l=t[0],h=t[t.length-1],u=i?Vn(l,i,o,n):l;if(a)return e?Kn(r,u,h):mt(r,h,u);const c=Math.min(u,r),d=Math.floor(E(t,c,s));return t[d]>u&&d<t.length-1?t[d+1]:t[d]}}}(o,l,!d&&f,h):Zn(i,n,l,!d&&f,h)}else{const a=(c?Math.max(se(c),ee(c)):360*Se.degrees/u.getMetersPerUnit())/256/Math.pow(2,0),p=a/Math.pow(2,28);i=t.maxResolution,void 0!==i?r=0:i=a/Math.pow(o,r),n=t.minResolution,void 0===n&&(n=void 0!==t.maxZoom?void 0!==t.maxResolution?i/Math.pow(o,s):a/Math.pow(o,s):p),s=r+Math.floor(Math.log(i/n)/Math.log(o)),n=i/Math.pow(o,s-r),e=t.constrainResolution?function(t,e,i,n,r,s){return n=void 0===n||n,i=void 0!==i?i:0,function(o,a,l,h){if(void 0!==o){const u=r?Vn(e,r,l,s):e;if(h)return n?Kn(o,u,i):mt(o,i,u);const c=1e-9,d=Math.ceil(Math.log(e/u)/Math.log(t)-c),f=-a*(.5-c)+.5,p=Math.min(u,o),g=Math.floor(Math.log(e/p)/Math.log(t)+f),m=Math.max(d,g);return mt(e/Math.pow(t,m),i,u)}}}(o,i,n,l,!d&&f,h):Zn(i,n,l,!d&&f,h)}return{constraint:e,maxResolution:i,minResolution:n,minZoom:r,zoomFactor:o}}(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const n=function(t){if(void 0!==t.extent){const e=void 0===t.smoothExtentConstraint||t.smoothExtentConstraint;return It(t.extent,t.constrainOnlyCenter,e)}const e=wi(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,It(t,!1,!1)}return Tt}(t),r=i.constraint,s=function(t){if(void 0===t.enableRotation||t.enableRotation){const e=t.constrainRotation;return void 0===e||!0===e?function(){const t=xt(5);return function(e,i){return i||void 0===e?e:Math.abs(e)<=t?0:e}}():!1===e?Hn:"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):Hn}return Yn}(t);this.constraints_={center:n,resolution:r,rotation:s},this.setRotation(void 0!==t.rotation?t.rotation:0),this.setCenterInternal(void 0!==t.center?t.center:null),void 0!==t.resolution?this.setResolution(t.resolution):void 0!==t.zoom&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const n=t||[0,0,0,0];e=e||[0,0,0,0];const r=this.getResolution(),s=r/2*(n[3]-e[3]+e[1]-n[1]),o=r/2*(n[0]-e[0]+e[2]-n[2]);this.setCenterInternal([i[0]+s,i[1]-o])}}getUpdatedOptions_(t){const e=this.getProperties();return void 0!==e.resolution?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let t=0;t<e.length;++t){let i=arguments[t];i.center&&(i=Object.assign({},i),i.center=Oi(i.center,this.getProjection())),i.anchor&&(i=Object.assign({},i),i.anchor=Oi(i.anchor,this.getProjection())),e[t]=i}this.animateInternal.apply(this,e)}animateInternal(t){let e,i=arguments.length;i>1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n<i&&!this.isDef();++n){const t=arguments[n];t.center&&this.setCenterInternal(t.center),void 0!==t.zoom?this.setZoom(t.zoom):t.resolution&&this.setResolution(t.resolution),void 0!==t.rotation&&this.setRotation(t.rotation)}if(n===i)return void(e&&Jn(e,!0));let r=Date.now(),s=this.targetCenter_.slice(),o=this.targetResolution_,a=this.targetRotation_;const l=[];for(;n<i;++n){const t=arguments[n],i={start:r,complete:!1,anchor:t.anchor,duration:void 0!==t.duration?t.duration:1e3,easing:t.easing||me,callback:e};if(t.center&&(i.sourceCenter=s,i.targetCenter=t.center.slice(),s=i.targetCenter),void 0!==t.zoom?(i.sourceResolution=o,i.targetResolution=this.getResolutionForZoom(t.zoom),o=i.targetResolution):t.resolution&&(i.sourceResolution=o,i.targetResolution=t.resolution,o=i.targetResolution),void 0!==t.rotation){i.sourceRotation=a;const e=wt(t.rotation-a+Math.PI,2*Math.PI)-Math.PI;i.targetRotation=a+e,a=i.targetRotation}Qn(i)?i.complete=!0:r+=i.duration,l.push(i)}this.animations_.push(l),this.setHint(0,1),this.updateAnimations_()}getAnimating(){return this.hints_[0]>0}getInteracting(){return this.hints_[1]>0}cancelAnimations(){let t;this.setHint(0,-this.hints_[0]);for(let e=0,i=this.animations_.length;e<i;++e){const i=this.animations_[e];if(i[0].callback&&Jn(i[0].callback,!1),!t)for(let e=0,n=i.length;e<n;++e){const n=i[e];if(!n.complete){t=n.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(void 0!==this.updateAnimationKey_&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const n=this.animations_[i];let r=!0;for(let i=0,s=n.length;i<s;++i){const s=n[i];if(s.complete)continue;const o=t-s.start;let a=s.duration>0?o/s.duration:1;a>=1?(s.complete=!0,a=1):r=!1;const l=s.easing(a);if(s.sourceCenter){const t=s.sourceCenter[0],e=s.sourceCenter[1],i=s.targetCenter[0],n=s.targetCenter[1];this.nextCenter_=s.targetCenter;const r=t+l*(i-t),o=e+l*(n-e);this.targetCenter_=[r,o]}if(s.sourceResolution&&s.targetResolution){const t=1===l?s.targetResolution:s.sourceResolution+l*(s.targetResolution-s.sourceResolution);if(s.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,s.anchor)}this.nextResolution_=s.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==s.sourceRotation&&void 0!==s.targetRotation){const t=1===l?wt(s.targetRotation+Math.PI,2*Math.PI)-Math.PI:s.sourceRotation+l*(s.targetRotation-s.sourceRotation);if(s.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,s.anchor)}this.nextRotation_=s.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!s.complete)break}if(r){this.animations_[i]=null,this.setHint(0,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&Jn(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();var r,s;return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],ce(i,t-this.getRotation()),s=e,(r=i)[0]+=+s[0],r[1]+=+s[1]),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),r=this.getResolution();return void 0!==n&&void 0!==r&&(i=[e[0]-t*(e[0]-n[0])/r,e[1]-t*(e[1]-n[1])/r]),i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?Ai(t,this.getProjection()):t}getCenterInternal(){return this.get(gt.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 Gi(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();ct(e,"The view center is not defined");const i=this.getResolution();ct(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return ct(void 0!==n,"The view rotation is not defined"),Qt(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(gt.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(Fi(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=se(t)/e[0],n=ee(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return function(i){return e/Math.pow(t,i*n)}}getRotation(){return this.get(gt.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/r}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const r=this.padding_;if(r){const t=this.getViewportSizeMinusPadding_();n=tr(n,this.getViewportSize_(),[t[0]/2+r[3],t[1]/2+r[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const r=E(this.resolutions_,t,1);n=r,e=this.resolutions_[r],i=r==this.resolutions_.length-1?2:e/this.resolutions_[r+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=mt(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,mt(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(ct(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t))ct(!ae(t),"Cannot fit empty extent provided as `geometry`"),i=Xn(Fi(t,this.getProjection()));else if("Circle"===t.getType()){const e=Fi(t.getExtent(),this.getProjection());i=Xn(e),i.rotate(this.getRotation(),Ht(e))}else{const e=Ri();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),r=t.getFlatCoordinates(),s=t.getStride();let o=1/0,a=1/0,l=-1/0,h=-1/0;for(let t=0,e=r.length;t<e;t+=s){const e=r[t]*i-r[t+1]*n,s=r[t]*n+r[t+1]*i;o=Math.min(o,e),a=Math.min(a,s),l=Math.max(l,e),h=Math.max(h,s)}return[o,a,l,h]}fitInternal(t,e){let i=(e=e||{}).size;i||(i=this.getViewportSizeMinusPadding_());const n=void 0!==e.padding?e.padding:[0,0,0,0],r=void 0!==e.nearest&&e.nearest;let s;s=void 0!==e.minResolution?e.minResolution:void 0!==e.maxZoom?this.getResolutionForZoom(e.maxZoom):0;const o=this.rotatedExtentForGeometry(t);let a=this.getResolutionForExtentInternal(o,[i[0]-n[1]-n[3],i[1]-n[0]-n[2]]);a=isNaN(a)?s:Math.max(a,s),a=this.getConstrainedResolution(a,r?0:1);const l=this.getRotation(),h=Math.sin(l),u=Math.cos(l),c=Ht(o);c[0]+=(n[1]-n[3])/2*a,c[1]+=(n[0]-n[2])/2*a;const d=c[0]*u-c[1]*h,f=c[1]*u+c[0]*h,p=this.getConstrainedCenter([d,f],a),g=e.callback?e.callback:R;void 0!==e.duration?this.animateInternal({resolution:a,center:p,duration:e.duration,easing:e.easing},g):(this.targetResolution_=a,this.targetCenter_=p,this.applyTargetState_(!1,!0),Jn(g,!0))}centerOn(t,e,i){this.centerOnInternal(Oi(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(tr(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,n){let r;const s=this.padding_;if(s&&t){const o=this.getViewportSizeMinusPadding_(-i),a=tr(t,n,[o[0]/2+s[3],o[1]/2+s[0]],e,i);r=[t[0]-a[0],t[1]-a[1]]}return r}isDef(){return!!this.getCenterInternal()&&void 0!==this.getResolution()}adjustCenter(t){const e=Ai(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&&Oi(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.getViewportSize_(this.getRotation()),r=this.constraints_.resolution(this.targetResolution_*t,0,n,i);e&&(this.targetCenter_=this.calculateCenterZoom(r,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=Oi(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(n,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t?Oi(t,this.getProjection()):t)}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,n=this.constraints_.rotation(this.targetRotation_,i),r=this.getViewportSize_(n),s=this.constraints_.resolution(this.targetResolution_,0,r,i),o=this.constraints_.center(this.targetCenter_,s,r,i,this.calculateCenterShift(this.targetCenter_,s,n,r));this.get(gt.ROTATION)!==n&&this.set(gt.ROTATION,n),this.get(gt.RESOLUTION)!==s&&(this.set(gt.RESOLUTION,s),this.set("zoom",this.getZoom(),!0)),o&&this.get(gt.CENTER)&&ue(this.get(gt.CENTER),o)||this.set(gt.CENTER,o),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=void 0!==t?t:200;const n=e||0,r=this.constraints_.rotation(this.targetRotation_),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,n,s),a=this.constraints_.center(this.targetCenter_,o,s,!1,this.calculateCenterShift(this.targetCenter_,o,r,s));if(0===t&&!this.cancelAnchor_)return this.targetResolution_=o,this.targetRotation_=r,this.targetCenter_=a,void this.applyTargetState_();i=i||(0===t?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,this.getResolution()===o&&this.getRotation()===r&&this.getCenterInternal()&&ue(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:a,resolution:o,duration:t,easing:ge,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(1,1)}endInteraction(t,e,i){i=i&&Oi(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)}},ir="ol-hidden",nr="ol-unselectable",rr="ol-control",sr="ol-collapsed",or=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"),ar=["style","variant","weight","size","lineHeight","family"],lr={normal:400,bold:700},hr=function(t){const e=t.match(or);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let t=0,n=ar.length;t<n;++t){const n=e[t+1];void 0!==n&&(i[ar[t]]="string"==typeof n?n.trim():n)}return isNaN(Number(i.weight))&&i.weight in lr&&(i.weight=lr[i.weight]),i.families=i.family.split(/,\s?/).map(t=>t.trim().replace(/^['"]|['"]$/g,"")),i};function ur(t,e,i,n){let r;return r=i&&i.length?i.shift():Q?new class extends OffscreenCanvas{style={}}(t??300,e??150):document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e),r.getContext("2d",n)}let cr;function dr(){return cr||(cr=ur(1,1)),cr}function fr(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function pr(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}function gr(){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 mr(t){return"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas}const yr=class extends B{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)p(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!==R&&this.listenerKeys.push(d(t,rt,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_="string"==typeof t?document.getElementById(t):t}},_r=class extends yr{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",n=void 0!==t.expandClassName?t.expandClassName:e+"-expand",r=void 0!==t.collapseLabel?t.collapseLabel:"›",s=void 0!==t.collapseClassName?t.collapseClassName:e+"-collapse";"string"==typeof r?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=r,this.collapseLabel_.className=s):this.collapseLabel_=r;const o=void 0!==t.label?t.label:"i";"string"==typeof o?(this.label_=document.createElement("span"),this.label_.textContent=o,this.label_.className=n):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(y,this.handleClick_.bind(this),!1);const l=e+" "+nr+" "+rr+(this.collapsed_&&this.collapsible_?" "+sr:"")+(this.collapsible_?"":" ol-uncollapsible"),h=this.element;h.className=l,h.appendChild(this.toggleButton_),h.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=>O(()=>t))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!I(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(sr),this.collapsed_?pr(this.collapseLabel_,this.label_):pr(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)}},vr=class extends yr{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:"⇧",n=void 0!==t.compassClassName?t.compassClassName:"ol-compass";this.label_=null,"string"==typeof i?(this.label_=document.createElement("span"),this.label_.className=n,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(n));const r=t.tipLabel?t.tipLabel:"Reset rotation",s=document.createElement("button");s.className=e+"-reset",s.setAttribute("type","button"),s.title=r,s.appendChild(this.label_),s.addEventListener(y,this.handleClick_.bind(this),!1);const o=e+" "+nr+" "+rr,a=this.element;a.className=o,a.appendChild(s),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(ir)}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:ge}):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(ir);t||0!==i?t&&0!==i&&this.element.classList.remove(ir):this.element.classList.add(ir)}this.label_.style.transform=t}this.rotation_=i}},xr=class extends yr{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,n=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",r=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",s=void 0!==t.zoomInLabel?t.zoomInLabel:"+",o=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",a=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",l=void 0!==t.zoomOutTipLabel?t.zoomOutTipLabel:"Zoom out",h=document.createElement("button");h.className=n,h.setAttribute("type","button"),h.title=a,h.appendChild("string"==typeof s?document.createTextNode(s):s),h.addEventListener(y,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=l,u.appendChild("string"==typeof o?document.createTextNode(o):o),u.addEventListener(y,this.handleClick_.bind(this,-i),!1);const c=e+" "+nr+" "+rr,d=this.element;d.className=c,d.appendChild(h),d.appendChild(u),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 n=e.getConstrainedZoom(i+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:ge})):e.setZoom(n)}}},wr=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 n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;const r=this.points_[e]-this.points_[i],s=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(s,r),this.initialVelocity_=Math.sqrt(r*r+s*s)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},br="active";function Sr(t,e,i,n){const r=t.getZoom();if(void 0===r)return;const s=t.getConstrainedZoom(r+e),o=t.getResolutionForZoom(s);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:i,duration:void 0!==n?n:250,easing:ge})}const Mr=class extends B{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(br)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(br,t)}setMap(t){this.map_=t}},Er=class extends Mr{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==K.DBLCLICK){const i=t.originalEvent,n=t.map,r=t.coordinate,s=i.shiftKey?-this.delta_:this.delta_;Sr(n.getView(),s,r,this.duration_),i.preventDefault(),e=!0}return!e}};function Cr(t){const e=arguments;return function(t){let i=!0;for(let n=0,r=e.length;n<r&&(i=i&&e[n](t),i);++n);return i}}const Pr=function(t){const e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Ir=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(),n=t.map.getOwnerDocument().activeElement;return i instanceof ShadowRoot?i.host.contains(n):e.contains(n)}(t)},Tr=T,kr=function(t){const e=t.originalEvent;return"pointerId"in e&&0==e.button&&!(Y&&H&&e.ctrlKey)},Rr=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},Ar=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Or=function(t){const e=t.originalEvent,i=e.target.tagName;return"INPUT"!==i&&"SELECT"!==i&&"TEXTAREA"!==i&&!e.target.isContentEditable},Gr=function(t){const e=t.originalEvent;return"pointerId"in e&&"mouse"==e.pointerType},Fr=function(t){const e=t.originalEvent;return"pointerId"in e&&e.isPrimary&&0===e.button};function Lr(t){const e=t.length;let i=0,n=0;for(let r=0;r<e;r++)i+=t[r].clientX,n+=t[r].clientY;return{clientX:i/e,clientY:n/e}}const jr=class extends Mr{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==K.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==K.POINTERUP){const e=this.handleUpEvent(t);this.handlingDownUpSequence=e&&this.targetPointers.length>0}}else if(t.type==K.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==K.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}},Nr=class extends jr{constructor(t){super({stopDown:k}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:Cr(Rr,Fr);this.condition_=t.onFocusOnly?Cr(Ir,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const i=this.targetPointers,n=e.getEventPixel(Lr(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(n[0],n[1]),this.lastCentroid){const e=[this.lastCentroid[0]-n[0],n[1]-this.lastCentroid[1]],i=t.map.getView();r=e,s=i.getResolution(),r[0]*=s,r[1]*=s,ce(e,i.getRotation()),i.adjustCenterInternal(e)}}else this.kinetic_&&this.kinetic_.begin();var r,s;this.lastCentroid=n,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(),n=this.kinetic_.getAngle(),r=i.getCenterInternal(),s=e.getPixelFromCoordinateInternal(r),o=e.getCoordinateFromPixelInternal([s[0]-t*Math.cos(n),s[1]-t*Math.sin(n)]);i.animateInternal({center:i.getConstrainedCenter(o),duration:500,easing:ge})}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}},Dr=class extends jr{constructor(t){t=t||{},super({stopDown:k}),this.condition_=t.condition?t.condition:Pr,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!Gr(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===Yn)return;const n=e.getSize(),r=t.pixel,s=Math.atan2(n[1]/2-r[1],r[0]-n[0]/2);if(void 0!==this.lastAngle_){const t=s-this.lastAngle_;i.adjustRotationInternal(-t)}this.lastAngle_=s}handleUpEvent(t){return!Gr(t)||(t.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(t){return!!Gr(t)&&(!(!kr(t)||!this.condition_(t))&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0))}},zr=class extends b{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",n=this.element_.style;n.left=Math.min(t[0],e[0])+i,n.top=Math.min(t[1],e[1])+i,n.width=Math.abs(e[0]-t[0])+i,n.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 Wn([i])}getGeometry(){return this.geometry_}},qr="boxcancel";class Br extends G{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}const $r=class extends jr{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new zr(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??kr,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const n=i[0]-e[0],r=i[1]-e[1];return n*n+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new Br("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 Br(e?"boxend":qr,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 Br("boxstart",t.coordinate,t)),!0)}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Br(qr,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Br(qr,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}},Ur=class extends $r{constructor(t){super({condition:(t=t||{}).condition?t.condition:Ar,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),n=e.getResolutionForExtentInternal(t),r=e.getResolution()/n;i=i.clone(),i.scale(r*r)}e.fitInternal(i,{duration:this.duration_,easing:ge})}},Wr="ArrowLeft",Xr="ArrowRight",Vr="ArrowDown",Kr=class extends Mr{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return Rr(t)&&Or(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==_){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==Vr||n==Wr||n==Xr||"ArrowUp"==n)){const r=t.map.getView(),s=r.getResolution()*this.pixelDelta_;let o=0,a=0;n==Vr?a=-s:n==Wr?o=-s:n==Xr?o=s:a=s;const l=[o,a];ce(l,r.getRotation()),function(t,e,i){const n=t.getCenterInternal();if(n){const r=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:ye,center:t.getConstrainedCenter(r)})}}(r,l,this.duration_),i.preventDefault(),e=!0}}return!e}},Zr=class extends Mr{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!function(t){const e=t.originalEvent;return H?e.metaKey:e.ctrlKey}(t)&&Or(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==_||t.type==v){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&("+"===n||"-"===n)){const r=t.map,s="+"===n?this.delta_:-this.delta_;Sr(r.getView(),s,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}},Yr=class extends Mr{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:Tr;this.condition_=t.onFocusOnly?Cr(Ir,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(p),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(t),t){const e=t.getOwnerDocument();this.ctrlKeyListenerKeys_.push(d(e,"keydown",t=>{"Control"===t.key&&(this.ctrlKeyPressed_=!0)}),d(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!==w)return!0;const e=t.map,i=t.originalEvent;i.preventDefault();const n=i.ctrlKey&&!this.ctrlKeyPressed_;i.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=t.pixel);let r=i.deltaY;switch(i.deltaMode){case WheelEvent.DOM_DELTA_LINE:r*=40;break;case WheelEvent.DOM_DELTA_PAGE:r*=300}if(0===r)return!1;this.lastDelta_=r;const s=Date.now();void 0===this.startTime_&&(this.startTime_=s),(!this.mode_||s-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(r)<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_),n&&(r*=3),o.adjustZoom(-r/this.deltaPerZoom_,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=s,!1;this.totalDelta_+=r;const a=Math.max(this.timeout_-(s-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=-mt(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),Sr(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)}},Hr=class extends jr{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=k),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],n=this.targetPointers[1],r=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(void 0!==this.lastAngle_){const t=r-this.lastAngle_;this.rotationDelta_+=t,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=t}this.lastAngle_=r;const s=t.map,o=s.getView();o.getConstraints().rotation!==Yn&&(this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel(Lr(this.targetPointers))),this.rotating_&&(s.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}},Jr=class extends jr{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=k),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],n=this.targetPointers[1],r=i.clientX-n.clientX,s=i.clientY-n.clientY,o=Math.sqrt(r*r+s*s);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;const a=t.map,l=a.getView();1!=e&&(this.lastScaleDelta_=e),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(Lr(this.targetPointers))),a.render(),l.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 Qr(t){t=t||{};const e=new W,i=new wr(-.005,.05,100);return(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new Dr),(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new Er({delta:t.zoomDelta,duration:t.zoomDuration})),(void 0===t.dragPan||t.dragPan)&&e.push(new Nr({onFocusOnly:t.onFocusOnly,kinetic:i})),(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new Hr),(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new Jr({duration:t.zoomDuration})),(void 0===t.keyboard||t.keyboard)&&(e.push(new Kr),e.push(new Zr({delta:t.zoomDelta,duration:t.zoomDuration}))),(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new Yr({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration})),(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new Ur({duration:t.zoomDuration})),e}const ts="opacity",es="visible",is="extent",ns="zIndex",rs="maxResolution",ss="minResolution",os="maxZoom",as="minZoom",ls="source",hs=class extends B{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[ts]=void 0!==t.opacity?t.opacity:1,ct("number"==typeof e[ts],"Layer opacity must be a number"),e[es]=void 0===t.visible||t.visible,e[ns]=t.zIndex,e[rs]=void 0!==t.maxResolution?t.maxResolution:1/0,e[ss]=void 0!==t.minResolution?t.minResolution:0,e[as]=void 0!==t.minZoom?t.minZoom:-1/0,e[os]=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=mt(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 N()}getLayerStatesArray(t){return N()}getExtent(){return this.get(is)}getMaxResolution(){return this.get(rs)}getMinResolution(){return this.get(ss)}getMinZoom(){return this.get(as)}getMaxZoom(){return this.get(os)}getOpacity(){return this.get(ts)}getSourceState(){return N()}getVisible(){return this.get(es)}getZIndex(){return this.get(ns)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(is,t)}setMaxResolution(t){this.set(rs,t)}setMinResolution(t){this.set(ss,t)}setMaxZoom(t){this.set(os,t)}setMinZoom(t){this.set(as,t)}setOpacity(t){ct("number"==typeof t,"Layer opacity must be a number"),this.set(ts,t)}setVisible(t){this.set(es,t)}setZIndex(t){this.set(ns,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},us="addlayer",cs="removelayer";class ds extends G{constructor(t,e){super(t),this.layer=e}}const fs="layers";class ps extends hs{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(fs,this.handleLayersChanged_),i?Array.isArray(i)?i=new W(i.slice(),{unique:!0}):ct("function"==typeof i.getArray,"Expected `layers` to be an array or a `Collection`"):i=new W(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(p),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(d(t,a,this.handleLayersAdd_,this),d(t,l,this.handleLayersRemove_,this));for(const t in this.listenerKeys_)this.listenerKeys_[t].forEach(p);u(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 ds(us,i))}this.changed()}registerLayerListeners_(t){const e=[d(t,h,this.handleLayerChange_,this),d(t,g,this.handleLayerChange_,this)];t instanceof ps&&e.push(d(t,us,this.handleLayerGroupAdd_,this),d(t,cs,this.handleLayerGroupRemove_,this)),this.listenerKeys_[z(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new ds(us,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new ds(cs,t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new ds(us,e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=z(e);this.listenerKeys_[i].forEach(p),delete this.listenerKeys_[i],this.dispatchEvent(new ds(cs,e)),this.changed()}getLayers(){return this.get(fs)}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 ds(cs,t[e]))}this.set(fs,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 n=this.getLayerState();let r=n.zIndex;t||void 0!==n.zIndex||(r=0);for(let t=i,s=e.length;t<s;t++){const i=e[t];i.opacity*=n.opacity,i.visible=i.visible&&n.visible,i.maxResolution=Math.min(i.maxResolution,n.maxResolution),i.minResolution=Math.max(i.minResolution,n.minResolution),i.minZoom=Math.max(i.minZoom,n.minZoom),i.maxZoom=Math.min(i.maxZoom,n.maxZoom),void 0!==n.extent&&(void 0!==i.extent?i.extent=ie(i.extent,n.extent):i.extent=n.extent),void 0===i.zIndex&&(i.zIndex=r)}return e}getSourceState(){return"ready"}}const gs=ps,ms="prerender",ys="postrender",_s="precompose",vs="rendercomplete";function xs(t,e){if(!t.visible)return!1;const i=e.resolution;if(i<t.minResolution||i>=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}const ws=class extends hs{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(ls,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(ls)||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_&&(p(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=d(t,g,this.handleSourceChange_,this),"ready"===t.getState()&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const i=this.getMapInternal();let n;if(!t&&i&&(t=i.getView()),e=t instanceof er?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),e.layerStatesArray){if(n=e.layerStatesArray.find(t=>t.layer===this),!n)return!1}else n=this.getLayerState();const r=this.getExtent();return xs(n,e.viewState)&&(!r||oe(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];let i=e(t instanceof er?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_&&(p(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(p(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=d(t,_s,this.handlePrecompose_,this),this.mapRenderKey_=d(this,g,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);ct(!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(ls,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 bs(t,e,i=0,n=t.length-1,r=Ms){for(;n>i;){if(n-i>600){const s=n-i+1,o=e-i+1,a=Math.log(s),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);bs(t,e,Math.max(i,Math.floor(e-o*l/s+h)),Math.min(n,Math.floor(e+(s-o)*l/s+h)),r)}const s=t[e];let o=i,a=n;for(Ss(t,i,e),r(t[n],s)>0&&Ss(t,i,n);o<a;){for(Ss(t,o,a),o++,a--;r(t[o],s)<0;)o++;for(;r(t[a],s)>0;)a--}0===r(t[i],s)?Ss(t,i,a):(a++,Ss(t,a,n)),a<=e&&(i=a+1),e<=a&&(n=a-1)}}function Ss(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function Ms(t,e){return t<e?-1:t>e?1:0}class Es{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(!js(t,e))return i;const n=this.toBBox,r=[];for(;e;){for(let s=0;s<e.children.length;s++){const o=e.children[s],a=e.leaf?n(o):o;js(t,a)&&(e.leaf?i.push(o):Ls(t,a)?this._all(o,i):r.push(o))}e=r.pop()}return i}collides(t){let e=this.data;if(!js(t,e))return!1;const i=[];for(;e;){for(let n=0;n<e.children.length;n++){const r=e.children[n],s=e.leaf?this.toBBox(r):r;if(js(t,s)){if(e.leaf||Ls(t,s))return!0;i.push(r)}}e=i.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(let e=0;e<t.length;e++)this.insert(t[e]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Ns([]),this}remove(t,e){if(!t)return this;let i=this.data;const n=this.toBBox(t),r=[],s=[];let o,a,l;for(;i||r.length;){if(i||(i=r.pop(),a=r[r.length-1],o=s.pop(),l=!0),i.leaf){const n=Cs(t,i.children,e);if(-1!==n)return i.children.splice(n,1),r.push(i),this._condense(r),this}l||i.leaf||!Ls(i,n)?a?(o++,i=a.children[o],l=!1):i=null:(r.push(i),s.push(o),o=0,a=i,i=i.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,n){const r=i-e+1;let s,o=this._maxEntries;if(r<=o)return s=Ns(t.slice(e,i+1)),Ps(s,this.toBBox),s;n||(n=Math.ceil(Math.log(r)/Math.log(o)),o=Math.ceil(r/Math.pow(o,n-1))),s=Ns([]),s.leaf=!1,s.height=n;const a=Math.ceil(r/o),l=a*Math.ceil(Math.sqrt(o));Ds(t,e,i,l,this.compareMinX);for(let r=e;r<=i;r+=l){const e=Math.min(r+l-1,i);Ds(t,r,e,a,this.compareMinY);for(let i=r;i<=e;i+=a){const r=Math.min(i+a-1,e);s.children.push(this._build(t,i,r,n-1))}}return Ps(s,this.toBBox),s}_chooseSubtree(t,e,i,n){for(;n.push(e),!e.leaf&&n.length-1!==i;){let i,n=1/0,r=1/0;for(let s=0;s<e.children.length;s++){const o=e.children[s],a=As(o),l=Gs(t,o)-a;l<r?(r=l,n=a<n?a:n,i=o):l===r&&a<n&&(n=a,i=o)}e=i||e.children[0]}return e}_insert(t,e,i){const n=i?t:this.toBBox(t),r=[],s=this._chooseSubtree(n,this.data,e,r);for(s.children.push(t),Ts(s,n);e>=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)}_split(t,e){const i=t[e],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);const s=this._chooseSplitIndex(i,r,n),o=Ns(i.children.splice(s,i.children.length-s));o.height=i.height,o.leaf=i.leaf,Ps(i,this.toBBox),Ps(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=Ns([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Ps(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let n,r=1/0,s=1/0;for(let o=e;o<=i-e;o++){const e=Is(t,0,o,this.toBBox),a=Is(t,o,i,this.toBBox),l=Fs(e,a),h=As(e)+As(a);l<r?(r=l,n=o,s=h<s?h:s):l===r&&h<s&&(s=h,n=o)}return n||i-e}_chooseSplitAxis(t,e,i){const n=t.leaf?this.compareMinX:ks,r=t.leaf?this.compareMinY:Rs;this._allDistMargin(t,e,i,n)<this._allDistMargin(t,e,i,r)&&t.children.sort(n)}_allDistMargin(t,e,i,n){t.children.sort(n);const r=this.toBBox,s=Is(t,0,e,r),o=Is(t,i-e,i,r);let a=Os(s)+Os(o);for(let n=e;n<i-e;n++){const e=t.children[n];Ts(s,t.leaf?r(e):e),a+=Os(s)}for(let n=i-e-1;n>=e;n--){const e=t.children[n];Ts(o,t.leaf?r(e):e),a+=Os(o)}return a}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)Ts(e[n],t)}_condense(t){for(let e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children,e.splice(e.indexOf(t[i]),1)):this.clear():Ps(t[i],this.toBBox)}}function Cs(t,e,i){if(!i)return e.indexOf(t);for(let n=0;n<e.length;n++)if(i(t,e[n]))return n;return-1}function Ps(t,e){Is(t,0,t.children.length,e,t)}function Is(t,e,i,n,r){r||(r=Ns(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=e;s<i;s++){const e=t.children[s];Ts(r,t.leaf?n(e):e)}return r}function Ts(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 ks(t,e){return t.minX-e.minX}function Rs(t,e){return t.minY-e.minY}function As(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Os(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Gs(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 Fs(t,e){const i=Math.max(t.minX,e.minX),n=Math.max(t.minY,e.minY),r=Math.min(t.maxX,e.maxX),s=Math.min(t.maxY,e.maxY);return Math.max(0,r-i)*Math.max(0,s-n)}function Ls(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function js(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function Ns(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Ds(t,e,i,n,r){const s=[e,i];for(;s.length;){if((i=s.pop())-(e=s.pop())<=n)continue;const o=e+Math.ceil((i-e)/n/2)*n;bs(t,o,e,i,r),s.push(e,o,o,i)}}const zs=[NaN,NaN,NaN,0];let qs;const Bs=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,$s=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Us=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Ws=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Xs(t,e){return t.endsWith("%")?Number(t.substring(0,t.length-1))/e:Number(t)}function Vs(t){throw new Error('failed to parse "'+t+'" as color')}function Ks(t){if(t.toLowerCase().startsWith("rgb")){const e=t.match($s)||t.match(Bs)||t.match(Us);if(e){const t=e[4],i=100/255;return[mt(Xs(e[1],i)+.5|0,0,255),mt(Xs(e[2],i)+.5|0,0,255),mt(Xs(e[3],i)+.5|0,0,255),void 0!==t?mt(Xs(t,100),0,1):1]}Vs(t)}if(t.startsWith("#")){if(Ws.test(t)){const e=t.substring(1),i=e.length<=4?1:2,n=[0,0,0,255];for(let t=0,r=e.length;t<r;t+=i){let r=parseInt(e.substring(t,t+i),16);1===i&&(r+=r<<4),n[t/i]=r}return n[3]=n[3]/255,n}Vs(t)}const e=(qs||(qs=ur(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),qs);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&&Vs(t));const n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return Ks(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);const r=Array.from(e.getImageData(0,0,1,1).data);return r[3]=St(r[3]/255,3),r}const Zs={};let Ys=0;function Hs(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function Js(t){return t>.0031308?269.025*Math.pow(t,1/2.4)-14.025:3294.6*t}function Qs(t){return t>.2068965?Math.pow(t,3):108/841*(t-4/29)}function to(t){return t>10.314724?Math.pow((t+14.025)/269.025,2.4):t/3294.6}function eo(t){return t>.0088564?Math.pow(t,1/3):t/(108/841)+4/29}function io(t){const e=to(t[0]),i=to(t[1]),n=to(t[2]),r=eo(.222488403*e+.716873169*i+.06060791*n),s=500*(eo(.452247074*e+.399439023*i+.148375274*n)-r),o=200*(r-eo(.016863605*e+.117638439*i+.865350722*n)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,t[3]]}function no(t){if("none"===t)return zs;if(Zs.hasOwnProperty(t))return Zs[t];if(Ys>=1024){let t=0;for(const e in Zs)3&t++||(delete Zs[e],--Ys)}const e=Ks(t);4!==e.length&&Vs(t);for(const i of e)isNaN(i)&&Vs(t);return Zs[t]=e,++Ys,e}function ro(t){return Array.isArray(t)?t:no(t)}function so(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];return n!=(0|n)&&(n=n+.5|0),"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}function oo(t){return t[0]>0&&t[1]>0}function ao(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}let lo=0;const ho=1<<lo++,uo=1<<lo++,co=1<<lo++,fo=1<<lo++,po=1<<lo++,go=1<<lo++,mo=Math.pow(2,6)-1,yo={[ho]:"boolean",[uo]:"number",[co]:"string",[fo]:"color",[po]:"number[]",[go]:"size"},_o=Object.keys(yo).map(Number).sort(S);function vo(t){const e=[];for(const i of _o)xo(t,i)&&e.push(yo[i]);return 0===e.length?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function xo(t,e){return(t&e)===e}function wo(t,e){return t===e}class bo{constructor(t,e){if(!function(t){return t in yo}(t))throw new Error(`literal expressions must have a specific type, got ${vo(t)}`);this.type=t,this.value=e}}class So{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function Mo(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1}}function Eo(t,e,i){switch(typeof t){case"boolean":if(wo(e,co))return new bo(co,t?"true":"false");if(!xo(e,ho))throw new Error(`got a boolean, but expected ${vo(e)}`);return new bo(ho,t);case"number":if(wo(e,go))return new bo(go,ao(t));if(wo(e,ho))return new bo(ho,!!t);if(wo(e,co))return new bo(co,t.toString());if(!xo(e,uo))throw new Error(`got a number, but expected ${vo(e)}`);return new bo(uo,t);case"string":if(wo(e,fo))return new bo(fo,no(t));if(wo(e,ho))return new bo(ho,!!t);if(!xo(e,co))throw new Error(`got a string, but expected ${vo(e)}`);return new bo(co,t)}if(!Array.isArray(t))throw new Error("expression must be an array or a primitive value");if(0===t.length)throw new Error("empty expression");if("string"==typeof t[0])return function(t,e,i){const n=t[0],r=va[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(t,e,i)}(t,e,i);for(const e of t)if("number"!=typeof e)throw new Error("expected an array of numbers");if(wo(e,go)){if(2!==t.length)throw new Error(`expected an array of two values for a size, got ${t.length}`);return new bo(go,t)}if(wo(e,fo)){if(3===t.length)return new bo(fo,[...t,1]);if(4===t.length)return new bo(fo,t);throw new Error(`expected an array of 3 or 4 values for a color, got ${t.length}`)}if(!xo(e,po))throw new Error(`got an array of numbers, but expected ${vo(e)}`);return new bo(po,t)}const Co="get",Po="var",Io="concat",To="geometry-type",ko="line-metric",Ro="any",Ao="all",Oo="!",Go="resolution",Fo="zoom",Lo="time",jo="==",No="!=",Do=">",zo=">=",qo="<",Bo="<=",$o="*",Uo="/",Wo="+",Xo="-",Vo="clamp",Ko="%",Zo="^",Yo="abs",Ho="floor",Jo="ceil",Qo="round",ta="sin",ea="cos",ia="atan",na="sqrt",ra="match",sa="between",oa="interpolate",aa="coalesce",la="case",ha="in",ua="number",ca="string",da="array",fa="color",pa="id",ga="band",ma="palette",ya="to-string",_a="has",va={[Co]:Pa(Sa(1,1/0),xa),[Po]:Pa(Sa(1,1),function(t,e,i){const n=t[1];if("string"!=typeof n)throw new Error("expected a string argument for var operation");return i.variables.add(n),[new bo(co,n)]}),[_a]:Pa(Sa(1,1/0),xa),[pa]:Pa(function(t,e,i){i.featureId=!0},ba),[Io]:Pa(Sa(2,1/0),Ea(co)),[To]:Pa(function(t,e,i){i.geometryType=!0},ba),[ko]:Pa(function(t,e,i){i.mCoordinate=!0},ba),[Go]:Pa(wa,ba),[Fo]:Pa(wa,ba),[Lo]:Pa(wa,ba),[Ro]:Pa(Sa(2,1/0),Ea(ho)),[Ao]:Pa(Sa(2,1/0),Ea(ho)),[Oo]:Pa(Sa(1,1),Ea(ho)),[jo]:Pa(Sa(2,2),Ea(mo)),[No]:Pa(Sa(2,2),Ea(mo)),[Do]:Pa(Sa(2,2),Ea(uo)),[zo]:Pa(Sa(2,2),Ea(uo)),[qo]:Pa(Sa(2,2),Ea(uo)),[Bo]:Pa(Sa(2,2),Ea(uo)),[$o]:Pa(Sa(2,1/0),Ma),[aa]:Pa(Sa(2,1/0),Ma),[Uo]:Pa(Sa(2,2),Ea(uo)),[Wo]:Pa(Sa(2,1/0),Ea(uo)),[Xo]:Pa(Sa(2,2),Ea(uo)),[Vo]:Pa(Sa(3,3),Ea(uo)),[Ko]:Pa(Sa(2,2),Ea(uo)),[Zo]:Pa(Sa(2,2),Ea(uo)),[Yo]:Pa(Sa(1,1),Ea(uo)),[Ho]:Pa(Sa(1,1),Ea(uo)),[Jo]:Pa(Sa(1,1),Ea(uo)),[Qo]:Pa(Sa(1,1),Ea(uo)),[ta]:Pa(Sa(1,1),Ea(uo)),[ea]:Pa(Sa(1,1),Ea(uo)),[ia]:Pa(Sa(1,2),Ea(uo)),[na]:Pa(Sa(1,1),Ea(uo)),[ra]:Pa(Sa(4,1/0),Ca,function(t,e,i){const n=t.length-1,r=co|uo|ho,s=Eo(t[1],r,i),o=Eo(t[t.length-1],e,i),a=new Array(n-2);for(let e=0;e<n-2;e+=2){try{const n=Eo(t[e+2],s.type,i);a[e]=n}catch(t){throw new Error(`failed to parse argument ${e+1} of match expression: ${t.message}`)}try{const n=Eo(t[e+3],o.type,i);a[e+1]=n}catch(t){throw new Error(`failed to parse argument ${e+2} of match expression: ${t.message}`)}}return[s,...a,o]}),[sa]:Pa(Sa(3,3),Ea(uo)),[oa]:Pa(Sa(6,1/0),Ca,function(t,e,i){const n=t[1];let r;switch(n[0]){case"linear":r=1;break;case"exponential":const t=n[1];if("number"!=typeof t||t<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(t)} instead`);r=t;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}const s=new bo(uo,r);let o;try{o=Eo(t[2],uo,i)}catch(t){throw new Error(`failed to parse argument 1 in interpolate expression: ${t.message}`)}const a=new Array(t.length-3);for(let n=0;n<a.length;n+=2){try{const e=Eo(t[n+3],uo,i);a[n]=e}catch(t){throw new Error(`failed to parse argument ${n+2} for interpolate expression: ${t.message}`)}try{const r=Eo(t[n+4],e,i);a[n+1]=r}catch(t){throw new Error(`failed to parse argument ${n+3} for interpolate expression: ${t.message}`)}}return[s,o,...a]}),[la]:Pa(Sa(3,1/0),function(t,e,i){const n=t[0],r=t.length-1;if(r%2==0)throw new Error(`expected an odd number of arguments for ${n}, got ${r} instead`)},function(t,e,i){const n=Eo(t[t.length-1],e,i),r=new Array(t.length-1);for(let e=0;e<r.length-1;e+=2){try{const n=Eo(t[e+1],ho,i);r[e]=n}catch(t){throw new Error(`failed to parse argument ${e} of case expression: ${t.message}`)}try{const s=Eo(t[e+2],n.type,i);r[e+1]=s}catch(t){throw new Error(`failed to parse argument ${e+1} of case expression: ${t.message}`)}}return r[r.length-1]=n,r}),[ha]:Pa(Sa(2,2),function(t,e,i){let n,r=t[2];if(!Array.isArray(r))throw new Error('the second argument for the "in" operator must be an array');if("literal"===r[0]){if(r=r[1],!Array.isArray(r))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if("string"==typeof r[0])throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');n="string"==typeof r[0]?co:uo;const s=new Array(r.length);for(let t=0;t<s.length;t++)try{const e=Eo(r[t],n,i);s[t]=e}catch(e){throw new Error(`failed to parse haystack item ${t} for "in" expression: ${e.message}`)}return[Eo(t[1],n,i),...s]}),[ua]:Pa(Sa(1,1/0),Ea(mo)),[ca]:Pa(Sa(1,1/0),Ea(mo)),[da]:Pa(Sa(1,1/0),Ea(uo)),[fa]:Pa(Sa(1,4),Ea(uo)),[ga]:Pa(Sa(1,3),Ea(uo)),[ma]:Pa(Sa(2,2),function(t,e,i){let n;try{n=Eo(t[1],uo,i)}catch(t){throw new Error(`failed to parse first argument in palette expression: ${t.message}`)}const r=t[2];if(!Array.isArray(r))throw new Error("the second argument of palette must be an array");const s=new Array(r.length);for(let t=0;t<s.length;t++){let e;try{e=Eo(r[t],fo,i)}catch(e){throw new Error(`failed to parse color at index ${t} in palette expression: ${e.message}`)}if(!(e instanceof bo))throw new Error(`the palette color at index ${t} must be a literal value`);s[t]=e}return[n,...s]}),[ya]:Pa(Sa(1,1),Ea(ho|uo|co|fo))};function xa(t,e,i){const n=t.length-1,r=new Array(n);for(let e=0;e<n;++e){const n=t[e+1];switch(typeof n){case"number":r[e]=new bo(uo,n);break;case"string":r[e]=new bo(co,n);break;default:throw new Error(`expected a string key or numeric array index for a get operation, got ${n}`)}0===e&&i.properties.add(String(n))}return r}function wa(t,e,i){i.mapState=!0}function ba(t,e,i){const n=t[0];if(1!==t.length)throw new Error(`expected no arguments for ${n} operation`);return[]}function Sa(t,e){return function(i,n,r){const s=i[0],o=i.length-1;if(t===e){if(o!==t)throw new Error(`expected ${t} argument${1===t?"":"s"} for ${s}, got ${o}`)}else if(o<t||o>e)throw new Error(`expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${s}, got ${o}`)}}function Ma(t,e,i){const n=t.length-1,r=new Array(n);for(let s=0;s<n;++s){const n=Eo(t[s+1],e,i);r[s]=n}return r}function Ea(t){return function(e,i,n){const r=e.length-1,s=new Array(r);for(let i=0;i<r;++i){const r=Eo(e[i+1],t,n);s[i]=r}return s}}function Ca(t,e,i){const n=t[0],r=t.length-1;if(r%2==1)throw new Error(`expected an even number of arguments for operation ${n}, got ${r} instead`)}function Pa(...t){return function(e,i,n){const r=e[0];let s;for(let r=0;r<t.length;r++){const o=t[r](e,i,n);if(r==t.length-1){if(!o)throw new Error("expected last argument validator to return the parsed args");s=o}}return new So(i,r,...s)}}function Ia(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 Ia(t.getGeometries()[0]);default:return""}}function Ta(t,e,i){return ka(Eo(t,e,i),i)}function ka(t,e){if(t instanceof bo){if(t.type===fo&&"string"==typeof t.value){const e=no(t.value);return function(){return e}}return function(){return t.value}}const i=t.operator;switch(i){case ua:case ca:case aa:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=ka(t.args[i],e);switch(i){case aa:return t=>{for(let e=0;e<n;++e){const i=r[e](t);if(null!=i)return i}throw new Error("Expected one of the values to be non-null")};case ua:case ca:return t=>{for(let e=0;e<n;++e){const n=r[e](t);if(typeof n===i)return n}throw new Error(`Expected one of the values to be a ${i}`)};default:throw new Error(`Unsupported assertion operator ${i}`)}}(t,e);case Co:case Po:case _a:return function(t){const e=t.args[0].value;switch(t.operator){case Co:return i=>{const n=t.args;let r=i.properties[e];for(let t=1,e=n.length;t<e;++t)r=r[n[t].value];return r};case Po:return t=>t.variables[e];case _a:return i=>{const n=t.args;if(!(e in i.properties))return!1;let r=i.properties[e];for(let t=1,e=n.length;t<e;++t){const e=n[t].value;if(!r||!Object.hasOwn(r,e))return!1;r=r[e]}return!0};default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}(t);case"id":return t=>t.featureId;case To:return t=>t.geometryType;case Io:{const i=t.args.map(t=>ka(t,e));return t=>"".concat(...i.map(e=>e(t).toString()))}case Go:return t=>t.resolution;case Ro:case Ao:case sa:case ha:case"!":return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=ka(t.args[i],e);switch(i){case Ro:return t=>{for(let e=0;e<n;++e)if(r[e](t))return!0;return!1};case Ao:return t=>{for(let e=0;e<n;++e)if(!r[e](t))return!1;return!0};case sa:return t=>{const e=r[0](t),i=r[1](t),n=r[2](t);return e>=i&&e<=n};case ha:return t=>{const e=r[0](t);for(let i=1;i<n;++i)if(e===r[i](t))return!0;return!1};case"!":return t=>!r[0](t);default:throw new Error(`Unsupported logical operator ${i}`)}}(t,e);case jo:case No:case"<":case Bo:case">":case zo:return function(t,e){const i=t.operator,n=ka(t.args[0],e),r=ka(t.args[1],e);switch(i){case jo:return t=>n(t)===r(t);case No:return t=>n(t)!==r(t);case"<":return t=>n(t)<r(t);case Bo:return t=>n(t)<=r(t);case">":return t=>n(t)>r(t);case zo:return t=>n(t)>=r(t);default:throw new Error(`Unsupported comparison operator ${i}`)}}(t,e);case"*":case"/":case"+":case"-":case Vo:case"%":case"^":case Yo:case Ho:case Jo:case Qo:case ta:case ea:case ia:case na:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=ka(t.args[i],e);switch(i){case"*":return t=>{let e=1;for(let i=0;i<n;++i)e*=r[i](t);return e};case"/":return t=>r[0](t)/r[1](t);case"+":return t=>{let e=0;for(let i=0;i<n;++i)e+=r[i](t);return e};case"-":return t=>r[0](t)-r[1](t);case Vo:return t=>{const e=r[0](t),i=r[1](t);if(e<i)return i;const n=r[2](t);return e>n?n:e};case"%":return t=>r[0](t)%r[1](t);case"^":return t=>Math.pow(r[0](t),r[1](t));case Yo:return t=>Math.abs(r[0](t));case Ho:return t=>Math.floor(r[0](t));case Jo:return t=>Math.ceil(r[0](t));case Qo:return t=>Math.round(r[0](t));case ta:return t=>Math.sin(r[0](t));case ea:return t=>Math.cos(r[0](t));case ia:return 2===n?t=>Math.atan2(r[0](t),r[1](t)):t=>Math.atan(r[0](t));case na:return t=>Math.sqrt(r[0](t));default:throw new Error(`Unsupported numeric operator ${i}`)}}(t,e);case la:return function(t,e){const i=t.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=ka(t.args[r],e);return t=>{for(let e=0;e<i-1;e+=2)if(n[e](t))return n[e+1](t);return n[i-1](t)}}(t,e);case ra:return function(t,e){const i=t.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=ka(t.args[r],e);return t=>{const e=n[0](t);for(let r=1;r<i-1;r+=2)if(e===n[r](t))return n[r+1](t);return n[i-1](t)}}(t,e);case oa:return function(t,e){const i=t.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=ka(t.args[r],e);return t=>{const e=n[0](t),r=n[1](t);let s,o;for(let a=2;a<i;a+=2){const i=n[a](t);let l=n[a+1](t);const h=Array.isArray(l);if(h&&(l=Hs(l)),i>=r)return 2===a?l:h?Aa(e,r,s,o,i,l):Ra(e,r,s,o,i,l);s=i,o=l}return o}}(t,e);case ya:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=ka(t.args[i],e);if(i===ya)return e=>{const i=r[0](e);return t.args[0].type===fo?so(i):i.toString()};throw new Error(`Unsupported convert operator ${i}`)}(t,e);default:throw new Error(`Unsupported operator ${i}`)}}function Ra(t,e,i,n,r,s){const o=r-i;if(0===o)return n;const a=e-i;return n+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(s-n)}function Aa(t,e,i,n,r,s){if(0===r-i)return n;const o=io(n),a=io(s);let l=a[2]-o[2];return l>180?l-=360:l<-180&&(l+=360),function(t){const e=(t[0]+16)/116,i=t[1],n=t[2]*Math.PI/180,r=Qs(e),s=Qs(e+i/500*Math.cos(n)),o=Qs(e-i/200*Math.sin(n)),a=Js(3.021973625*s-1.617392459*r-.404875592*o),l=Js(-.943766287*s+1.916279586*r+.027607165*o),h=Js(.069407491*s-.22898585*r+1.159737864*o);return[mt(a+.5|0,0,255),mt(l+.5|0,0,255),mt(h+.5|0,0,255),t[3]]}([Ra(t,e,i,o[0],r,a[0]),Ra(t,e,i,o[1],r,a[1]),o[2]+Ra(t,e,i,0,r,l),Ra(t,e,i,n[3],r,s[3])])}function Oa(t,e){return t+":"+(e?ro(e):"null")}const Ga=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=Oa(t,e);return i in this.cache_?this.cache_[i]:null}getPattern(t,e){const i=Oa(t,e);return i in this.patternCache_?this.patternCache_[i]:null}set(t,e,i,n){const r=Oa(t,e),s=r in this.cache_;this.cache_[r]=i,n&&(0===i.getImageState()&&i.load(),1===i.getImageState()?i.ready().then(()=>{this.patternCache_[r]=dr().createPattern(i.getImage(1),"repeat")}):this.patternCache_[r]=dr().createPattern(i.getImage(1),"repeat")),s||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};let Fa=null;class La extends F{constructor(t,e,i,n,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i?.crossOrigin,this.referrerPolicy_=i?.referrerPolicy,this.canvas_={},this.color_=r,this.imageState_=void 0===n?0:n,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(void 0===this.tainted_&&2===this.imageState_){Fa||(Fa=ur(1,1,void 0,{willReadFrequently:!0})),Fa.drawImage(this.image_,0,0);try{Fa.getImageData(0,0,1,1),this.tainted_=!1}catch{Fa=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(g)}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=ur(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&&tt?new Promise((e,i)=>t.decode().then(()=>e(t)).catch(n=>t.complete&&t.width?e(t):i(n))):function(t){return new Promise((e,i)=>{function n(){s(),e(t)}function r(){s(),i(new Error("Image load error"))}function s(){t.removeEventListener("load",n),t.removeEventListener("error",r)}t.addEventListener("load",n),t.addEventListener("error",r)})}(t)).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}var t,e}replaceColor_(t){if(!this.color_||this.canvas_[t]||2!==this.imageState_)return;const e=this.image_,i=ur(Math.ceil(e.width*t),Math.ceil(e.height*t)),n=i.canvas;var r;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle="string"==typeof(r=this.color_)?r:so(r),i.fillRect(0,0,n.width/t,n.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=n}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(2===this.imageState_||3===this.imageState_)t();else{const e=()=>{2!==this.imageState_&&3!==this.imageState_||(this.removeEventListener(g,e),t())};this.addEventListener(g,e)}})),this.ready_}}function ja(t,e,i,n,r,s){let o=void 0===e?void 0:Ga.get(e,r);return o||(o=new La(t,t&&"src"in t?t.src||void 0:e,i,n,r),Ga.set(e,r,o,s)),s&&o&&!Ga.getPattern(e,r)&&Ga.set(e,r,o,s),o}const Na=La;function Da(t){return t?Array.isArray(t)?so(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return Ga.getPattern(t.src,t.color);const e=t.src+":"+t.offset,i=Ga.getPattern(e,t.color);if(i)return i;const n=Ga.get(t.src,null);if(2!==n.getImageState())return null;const r=ur(t.size[0],t.size[1]);return r.drawImage(n.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),ja(r.canvas,e,void 0,2,t.color,!0),Ga.getPattern(e,t.color)}(t):t:null}const za="10px sans-serif",qa="#000",Ba="round",$a=[],Ua="round",Wa="#000",Xa="center",Va="middle",Ka=[0,0,0,0],Za=new B;let Ya,Ha=null;const Ja={},Qa=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function tl(t,e,i){return`${t} ${e} 16px "${i}"`}const el=function(){const t=100;let e,i;async function n(t){await i.ready;const e=await i.load(t);if(0===e.length)return!1;const n=hr(t),r=n.families[0].toLowerCase(),s=n.weight;return e.some(t=>{const e=t.family.replace(/^['"]|['"]$/g,"").toLowerCase(),i=lr[t.weight]||t.weight;return e===r&&t.style===n.style&&i==s})}async function r(){await i.ready;let s=!0;const o=Za.getProperties(),a=Object.keys(o).filter(e=>o[e]<t);for(let e=a.length-1;e>=0;--e){const i=a[e];let r=o[i];r<t&&(await n(i)?(u(Ja),Za.set(i,t)):(r+=10,Za.set(i,r,!0),r<t&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(t){i||(i=Q?self.fonts:document.fonts);const n=hr(t);if(!n)return;const s=n.families;let o=!1;for(const t of s){if(Qa.has(t))continue;const e=tl(n.style,n.weight,t);void 0===Za.get(e)&&(Za.set(e,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(r,100))}}(),il=function(){let t;return function(e){let i=Ja[e];if(null==i){if(Q){const t=hr(e),n=nl(e,"Žg");i=(isNaN(Number(t.lineHeight))?1.2:Number(t.lineHeight))*(n.actualBoundingBoxAscent+n.actualBoundingBoxDescent)}else t||(t=document.createElement("div"),t.innerHTML="M",t.style.minHeight="0",t.style.maxHeight="none",t.style.height="auto",t.style.padding="0",t.style.border="none",t.style.position="absolute",t.style.display="block",t.style.left="-99999px"),t.style.font=e,document.body.appendChild(t),i=t.offsetHeight,document.body.removeChild(t);Ja[e]=i}return i}}();function nl(t,e){return Ha||(Ha=ur(1,1)),t!=Ya&&(Ha.font=t,Ya=Ha.font),Ha.measureText(e)}function rl(t,e){return nl(t,e).width}function sl(t,e,i){if(e in i)return i[e];const n=e.split("\n").reduce((e,i)=>Math.max(e,rl(t,i)),0);return i[e]=n,n}class ol{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=ao(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new ol({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 N()}getImage(t){return N()}getHitDetectionImage(){return N()}getPixelRatio(t){return 1}getImageState(){return N()}getImageSize(){return N()}getOrigin(){return N()}getSize(){return N()}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_=ao(t)}listenImageChange(t){N()}load(){N()}unlistenImageChange(t){N()}ready(){return Promise.resolve()}}const al=ol;class ll extends al{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 ll({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let n=Ga.get(i,null)?.getImage(1);if(!n){const e=this.renderOptions_,r=Math.ceil(e.size*t),s=ur(r,r);this.draw_(e,s,t),n=s.canvas;const o=new Na(n,void 0,null,2,null);Ga.set(i,null,o),createImageBitmap(n).then(t=>{o.setImage(t)})}return n}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(t){this.radius!==t&&(this.radius=t,this.render())}getRadius2(){return this.radius2_}setRadius2(t){this.radius2_!==t&&(this.radius2_=t,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let n=this.radius,r=void 0===this.radius2_?n:this.radius2_;if(n<r){const t=n;n=r,r=t}const s=void 0===this.radius2_?this.points_:2*this.points_,o=2*Math.PI/s,a=r*Math.sin(o),l=n-Math.sqrt(r*r-a*a),h=Math.sqrt(a*a+l*l),u=h/a;if("miter"===t&&u<=i)return u*e;const c=e/2/u,d=e/2*(l/h),f=Math.sqrt((n+c)*(n+c)+d*d)-n;if(void 0===this.radius2_||"bevel"===t)return 2*f;const p=n*Math.sin(o),g=r-Math.sqrt(n*n-p*p),m=Math.sqrt(p*p+g*g)/p;if(m<=i){const t=m*e/2-r-n;return 2*Math.max(f,t)}return 2*f}createRenderOptions(){let t,e=Ba,i=Ua,n=0,r=null,s=0,o=0;this.stroke_&&(t=Da(this.stroke_.getColor()??Wa),o=this.stroke_.getWidth()??1,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,i=this.stroke_.getLineJoin()??Ua,e=this.stroke_.getLineCap()??Ba,n=this.stroke_.getMiterLimit()??10);const a=this.calculateLineJoinSize_(i,o,n),l=Math.max(this.radius,this.radius2_||0);return{strokeStyle:t,strokeWidth:o,size:Math.ceil(2*l+a),lineCap:e,lineDash:r,lineDashOffset:s,lineJoin:i,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let t=this.fill_.getColor();null===t&&(t=qa),e.fillStyle=Da(t),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),n=0;"string"==typeof i&&(i=ro(i)),null===i?n=1:Array.isArray(i)&&(n=4===i.length?i[3]:1),0===n&&(e=ur(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const n=void 0===this.radius2_?i:this.radius2_;void 0!==this.radius2_&&(e*=2);const r=this.angle_-Math.PI/2,s=2*Math.PI/e;for(let o=0;o<e;o++){const e=r+o*s,a=o%2==0?i:n;t.lineTo(a*Math.cos(e),a*Math.sin(e))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=qa,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 hl=ll;class ul extends hl{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 ul({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 cl=ul;class dl{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 dl({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=ja(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?z(t):"object"==typeof t&&"src"in t?t.src+":"+t.offset:ro(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}const fl=dl;function pl(t,e,i,n){return void 0!==i&&void 0!==n?[i/t,n/e]:void 0!==i?i/t:void 0!==n?n/e:1}class gl extends al{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,n=void 0!==t.scale?t.scale:1,r=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:n,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy;const s=void 0!==t.img?t.img:null;let o,a=t.src;if(ct(!(void 0!==a&&s),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!s||(a=s.src||z(s)),ct(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),ct(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==t.src?o=0:void 0!==s&&(o="complete"in s?s.complete?s.src?2:0:1:2),this.color_=void 0!==t.color?ro(t.color):null,this.iconImage_=ja(s,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},o,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,this.initialOptions_,void 0!==t.width||void 0!==t.height){let e,i;if(t.size)[e,i]=t.size;else{const n=this.getImage(1);if(n.width&&n.height)e=n.width,i=n.height;else if(n instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(pl(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(pl(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 gl({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?ro(t):null;if(this.color_===e||this.color_&&e&&this.color_.length===e.length&&this.color_.every((t,i)=>t===e[i]))return;this.color_=e;const i=this.getSrc(),n=void 0!==i?null:this.getHitDetectionImage(),r=void 0!==i?0:this.iconImage_.getImageState();this.iconImage_=ja(n,i,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},r,this.color_)}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if("top-left"!=this.offsetOrigin_){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=ja(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(g,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(g,t)}ready(){return this.iconImage_.ready()}}const ml=gl;class yl{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 yl({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 _l=yl;class vl{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=bl,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 vl({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_=bl,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let xl=null;function wl(t,e){if(!xl){const t=new fl({color:"rgba(255,255,255,0.4)"}),e=new _l({color:"#3399CC",width:1.25});xl=[new vl({image:new cl({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return xl}function bl(t){return t.getGeometry()}const Sl=vl;class Ml{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_=ao(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 fl({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 Ml({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 fl?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_=ao(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 El=Ml;function Cl(t){return!0}function Pl(t){const e=Mo(),i=function(t,e){const i=t.length,n=new Array(i);for(let r=0;r<i;++r){const i=t[r],s="filter"in i?Ta(i.filter,ho,e):Cl;let o;if(Array.isArray(i.style)){const t=i.style.length;o=new Array(t);for(let n=0;n<t;++n)o[n]=Tl(i.style[n],e)}else o=[Tl(i.style,e)];n[r]={filter:s,styles:o}}return function(e){const r=[];let s=!1;for(let o=0;o<i;++o)if((0,n[o].filter)(e)&&(!t[o].else||!s)){s=!0;for(const t of n[o].styles){const i=t(e);i&&r.push(i)}}return r}}(t,e),n={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""};return function(t,r){if(n.properties=t.getPropertiesInternal(),n.resolution=r,e.featureId){const e=t.getId();n.featureId=void 0!==e?e:null}return e.geometryType&&(n.geometryType=Ia(t.getGeometry())),i(n)}}function Il(t){const e=Mo(),i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=Tl(t[r],e);const r={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""},s=new Array(i);return function(t,o){if(r.properties=t.getPropertiesInternal(),r.resolution=o,e.featureId){const e=t.getId();r.featureId=void 0!==e?e:null}let a=0;for(let t=0;t<i;++t){const e=n[t](r);e&&(s[a]=e,a+=1)}return s.length=a,s}}function Tl(t,e){const i=kl(t,"",e),n=Rl(t,"",e),r=function(t,e){const i="text-",n=Gl(t,i+"value",e);if(!n)return null;const r=kl(t,i,e),s=kl(t,i+"background-",e),o=Rl(t,i,e),a=Rl(t,i+"background-",e),l=Gl(t,i+"font",e),h=Ol(t,i+"max-angle",e),u=Ol(t,i+"offset-x",e),c=Ol(t,i+"offset-y",e),d=Fl(t,i+"overflow",e),f=Gl(t,i+"placement",e),p=Ol(t,i+"repeat",e),g=zl(t,i+"scale",e),m=Fl(t,i+"rotate-with-view",e),y=Ol(t,i+"rotation",e),_=Gl(t,i+"align",e),v=Gl(t,i+"justify",e),x=Gl(t,i+"baseline",e),w=Fl(t,i+"keep-upright",e),b=jl(t,i+"padding",e),S=Ul(t,i+"declutter-mode"),M=new El({declutterMode:S});return function(t){if(M.setText(n(t)),r&&M.setFill(r(t)),s&&M.setBackgroundFill(s(t)),o&&M.setStroke(o(t)),a&&M.setBackgroundStroke(a(t)),l&&M.setFont(l(t)),h&&M.setMaxAngle(h(t)),u&&M.setOffsetX(u(t)),c&&M.setOffsetY(c(t)),d&&M.setOverflow(d(t)),f){const e=f(t);if("point"!==e&&"line"!==e)throw new Error("Expected point or line for text-placement");M.setPlacement(e)}if(p&&M.setRepeat(p(t)),g&&M.setScale(g(t)),m&&M.setRotateWithView(m(t)),y&&M.setRotation(y(t)),_){const e=_(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");M.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");M.setJustify(e)}if(x){const e=x(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");M.setTextBaseline(e)}return b&&M.setPadding(b(t)),w&&M.setKeepUpright(w(t)),M}}(t,e),s=function(t,e){return"icon-src"in t?function(t,e){const i="icon-",n=i+"src",r=Xl(t[n],n),s=Nl(t,i+"anchor",e),o=zl(t,i+"scale",e),a=Ol(t,i+"opacity",e),l=Nl(t,i+"displacement",e),h=Ol(t,i+"rotation",e),u=Fl(t,i+"rotate-with-view",e),c=Bl(t,i+"anchor-origin"),d=$l(t,i+"anchor-x-units"),f=$l(t,i+"anchor-y-units"),p=Al(t,i+"color");let g,m=null;void 0!==p&&(Array.isArray(p)&&p.length>0&&"string"==typeof p[0]?m=Ll(t,i+"color",e):g=Kl(p,i+"color"));const y=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"),_=function(t,e){const i=t[e];if(void 0!==i)return Wl(i,e)}(t,i+"offset"),v=Bl(t,i+"offset-origin"),x=ql(t,i+"width"),w=ql(t,i+"height"),b=function(t,e){const i=t[e];if(void 0!==i){if("number"==typeof i)return ao(i);if(!Array.isArray(i))throw new Error(`Expected a number or size array for ${e}`);if(2!==i.length||"number"!=typeof i[0]||"number"!=typeof i[1])throw new Error(`Expected a number or size array for ${e}`);return i}}(t,i+"size"),S={src:r,anchorOrigin:c,anchorXUnits:d,anchorYUnits:f,crossOrigin:y,offset:_,offsetOrigin:v,height:w,width:x,size:b,declutterMode:Ul(t,i+"declutter-mode")};let M=null;return function(t){if(M)m&&M.setColor(m(t));else{const e=m?m(t):g;M=new ml(void 0!==e?Object.assign({},S,{color:e}):Object.assign({},S))}return a&&M.setOpacity(a(t)),l&&M.setDisplacement(l(t)),h&&M.setRotation(h(t)),u&&M.setRotateWithView(u(t)),o&&M.setScale(o(t)),s&&M.setAnchor(s(t)),M}}(t,e):"shape-points"in t?function(t,e){const i="shape-",n=i+"points",r=i+"radius",s=Vl(t[n],n);if(!(r in t))throw new Error(`Expected a number for ${r}`);const o=Ol(t,r,e),a="number"==typeof t[r]?t[r]:5,l=i+"radius2",h=Ol(t,l,e),u="number"==typeof t[l]?t[l]:void 0,c=kl(t,i,e),d=Rl(t,i,e),f=zl(t,i+"scale",e),p=Nl(t,i+"displacement",e),g=Ol(t,i+"rotation",e),m=Fl(t,i+"rotate-with-view",e),y=ql(t,i+"angle"),_=Ul(t,i+"declutter-mode"),v=new hl({points:s,radius:a,radius2:u,angle:y,declutterMode:_});return function(t){return o&&v.setRadius(o(t)),h&&v.setRadius2(h(t)),c&&v.setFill(c(t)),d&&v.setStroke(d(t)),p&&v.setDisplacement(p(t)),g&&v.setRotation(g(t)),m&&v.setRotateWithView(m(t)),f&&v.setScale(f(t)),v}}(t,e):"circle-radius"in t?function(t,e){const i="circle-",n=kl(t,i,e),r=Rl(t,i,e),s=Ol(t,i+"radius",e),o=zl(t,i+"scale",e),a=Nl(t,i+"displacement",e),l=Ol(t,i+"rotation",e),h=Fl(t,i+"rotate-with-view",e),u=Ul(t,i+"declutter-mode"),c=new cl({radius:5,declutterMode:u});return function(t){return s&&c.setRadius(s(t)),n&&c.setFill(n(t)),r&&c.setStroke(r(t)),a&&c.setDisplacement(a(t)),l&&c.setRotation(l(t)),h&&c.setRotateWithView(h(t)),o&&c.setScale(o(t)),c}}(t,e):null}(t,e),o=Ol(t,"z-index",e);if(!(i||n||r||s||c(t)))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(t));const a=new Sl;return function(t){let e=!0;if(i){const n=i(t);n&&(e=!1),a.setFill(n)}if(n){const i=n(t);i&&(e=!1),a.setStroke(i)}if(r){const i=r(t);i&&(e=!1),a.setText(i)}if(s){const i=s(t);i&&(e=!1),a.setImage(i)}return o&&a.setZIndex(o(t)),e?null:a}}function kl(t,e,i){let n;if(e+"fill-pattern-src"in t)n=function(t,e,i){const n=Gl(t,e+"pattern-src",i),r=Dl(t,e+"pattern-offset",i),s=Dl(t,e+"pattern-size",i),o=Ll(t,e+"color",i);return function(t){return{src:n(t),offset:r&&r(t),size:s&&s(t),color:o&&o(t)}}}(t,e+"fill-",i);else{if("none"===t[e+"fill-color"])return t=>null;n=Ll(t,e+"fill-color",i)}if(!n)return null;const r=new fl;return function(t){const e=n(t);return e===zs?null:(r.setColor(e),r)}}function Rl(t,e,i){const n=Ol(t,e+"stroke-width",i),r=Ll(t,e+"stroke-color",i);if(!n&&!r)return null;const s=Gl(t,e+"stroke-line-cap",i),o=Gl(t,e+"stroke-line-join",i),a=jl(t,e+"stroke-line-dash",i),l=Ol(t,e+"stroke-line-dash-offset",i),h=Ol(t,e+"stroke-miter-limit",i),u=Ol(t,e+"stroke-offset",i),c=new _l;return function(t){if(r){const e=r(t);if(e===zs)return null;c.setColor(e)}if(n&&c.setWidth(n(t)),s){const e=s(t);if("butt"!==e&&"round"!==e&&"square"!==e)throw new Error("Expected butt, round, or square line cap");c.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");c.setLineJoin(e)}return a&&c.setLineDash(a(t)),l&&c.setLineDashOffset(l(t)),h&&c.setMiterLimit(h(t)),u&&c.setOffset(u(t)),c}}function Al(t,e){if(!(e in t))return;const i=t[e];return void 0===i?void 0:i}function Ol(t,e,i){const n=Al(t,e);if(void 0===n)return;const r=Ta(n,uo,i);return function(t){return Vl(r(t),e)}}function Gl(t,e,i){const n=Al(t,e);if(void 0===n)return null;const r=Ta(n,co,i);return function(t){return Xl(r(t),e)}}function Fl(t,e,i){const n=Al(t,e);if(void 0===n)return null;const r=Ta(n,ho,i);return function(t){const i=r(t);if("boolean"!=typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function Ll(t,e,i){const n=Al(t,e);if(void 0===n)return null;const r=Ta(n,fo,i);return function(t){return Kl(r(t),e)}}function jl(t,e,i){const n=Al(t,e);if(void 0===n)return null;if(Array.isArray(n)&&(0===n.length||"string"!=typeof n[0])){const t=n.map((t,n)=>{if("number"==typeof t)return()=>t;const r=Ta(t,uo,i);return function(t){return Vl(r(t),`${e}[${n}]`)}});return function(e){const i=new Array(t.length);for(let n=0;n<t.length;++n)i[n]=t[n](e);return i}}const r=Ta(n,po,i);return function(t){return Wl(r(t),e)}}function Nl(t,e,i){const n=Al(t,e);if(void 0===n)return null;const r=Ta(n,po,i);return function(t){const i=Wl(r(t),e);if(2!==i.length)throw new Error(`Expected two numbers for ${e}`);return i}}function Dl(t,e,i){const n=Al(t,e);if(void 0===n)return null;const r=Ta(n,po,i);return function(t){return Zl(r(t),e)}}function zl(t,e,i){const n=Al(t,e);if(void 0===n)return null;const r=Ta(n,po|uo,i);return function(t){return i=r(t),n=e,"number"==typeof i?i:Zl(i,n);var i,n}}function ql(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 Bl(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 $l(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 Ul(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 Wl(t,e){if(!Array.isArray(t))throw new Error(`Expected an array for ${e}`);const i=t.length;for(let n=0;n<i;++n)if("number"!=typeof t[n])throw new Error(`Expected an array of numbers for ${e}`);return t}function Xl(t,e){if("string"!=typeof t)throw new Error(`Expected a string for ${e}`);return t}function Vl(t,e){if("number"!=typeof t)throw new Error(`Expected a number for ${e}`);return t}function Kl(t,e){if("string"==typeof t)return t;const i=Wl(t,e),n=i.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function Zl(t,e){const i=Wl(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}const Yl="renderOrder",Hl=class extends ws{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(Yl)}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 Es(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Yl,t)}setStyle(t){this.style_=void 0===t?wl:t;const e=function(t){if(void 0===t)return wl;if(!t)return null;if("function"==typeof t)return t;if(t instanceof Sl)return t;if(!Array.isArray(t))return Il([t]);if(0===t.length)return[];const e=t.length,i=t[0];if(i instanceof Sl){const i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!(e instanceof Sl))throw new Error("Expected a list of style instances");i[n]=e}return i}if("style"in i){const i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!("style"in e))throw new Error("Expected a list of rules with a style property");i[n]=e}return Pl(i)}return Il(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:(ct("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()}},Jl=class extends G{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}};function Ql(t,e){Ga.expire()}const th=class extends b{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){N()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=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]),Ki(n,i)}forEachFeatureAtCoordinate(t,e,i,n,r,s,o,a){let l;const h=e.viewState;function u(t,e,i,n){return r.call(s,e,t?i:null,n)}const c=h.projection,d=de(t.slice(),c),f=[[0,0]];if(c.canWrapX()&&n){const t=se(c.getExtent());f.push([-t,0],[t,0])}const p=e.layerStatesArray,g=p.length,m=[],y=[];for(let n=0;n<f.length;n++)for(let r=g-1;r>=0;--r){const s=p[r],c=s.layer;if(c.hasRenderer()&&xs(s,h)&&o.call(a,c)){const r=c.getRenderer(),o=c.getSource();if(r&&o){const a=o.getWrapX()?d:t,h=u.bind(null,s.managed);y[0]=a[0]+f[n][0],y[1]=a[1]+f[n][1],l=r.forEachFeatureAtCoordinate(y,e,i,h,m)}if(l)return l}}if(0===m.length)return;const _=1/m.length;return m.forEach((t,e)=>t.distanceSq+=e*_),m.sort((t,e)=>t.distanceSq-e.distanceSq),m.some(t=>l=t.callback(t.feature,t.layer,t.geometry)),l}hasFeatureAtCoordinate(t,e,i,n,r,s){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,n,T,this,r,s)}getMap(){return this.map_}renderFrame(t){N()}scheduleExpireIconCache(t){Ga.canExpireCache()&&t.postRenderFunctions.push(Ql)}},eh=class extends th{constructor(t){super(t),this.fontChangeListenerKey_=d(Za,h,t.redrawText,t),this.element_=Q?gr():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=nr+" 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 n=new Jl(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){p(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(_s,t);const e=t.layerStatesArray.sort((t,e)=>t.zIndex-e.zIndex);e.some(t=>t.layer instanceof Hl&&t.layer.getDeclutter())&&(t.declutter={});const i=t.viewState;this.children_.length=0;const n=[];let r=null;for(let s=0,o=e.length;s<o;++s){const o=e[s];t.layerIndex=s;const a=o.layer,l=a.getSourceState();if(!xs(o,i)||"ready"!=l&&"undefined"!=l){a.unrender();continue}const h=a.render(t,r);h&&(h!==r&&(this.children_.push(h),r=h),n.push(o))}this.declutter(t,n),function(t,e){const i=t.childNodes;for(let n=0;;++n){const r=i[n],s=e[n];if(!r&&!s)break;r!==s&&(r?s?t.insertBefore(s,r):(t.removeChild(r),--n):t.appendChild(s))}}(this.element_,this.children_);const s=this.getMap().getTargetElement();if(mr(s)){const t=s.getContext("2d");for(const e of this.children_){const i=e.firstElementChild||e,n=e.style.backgroundColor;if(n&&(!mr(i)||i.width>0)&&(t.fillStyle=n,t.fillRect(0,0,s.width,s.height)),mr(i)&&i.width>0){t.save();const n=e.style.opacity||i.style.opacity;t.globalAlpha=""===n?1:Number(n);const r=i.style.transform;if(r)t.transform(...Yi(r));else{const e=parseFloat(i.style.width)/i.width,n=parseFloat(i.style.height)/i.height;t.transform(e,0,0,n,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 n=e[i],r=n.layer;r.getDeclutter()&&r.renderDeclutter(t,n)}e.forEach(e=>e.layer.renderDeferred(t))}}};function ih(t){t instanceof ws?t.setMapInternal(null):t instanceof gs&&t.getLayers().forEach(ih)}function nh(t,e){if(t instanceof ws)t.setMapInternal(e);else if(t instanceof gs){const i=t.getLayers().getArray();for(let t=0,n=i.length;t<n;++t)nh(i[t],e)}}const rh=class extends B{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={},n=t.layers&&"function"==typeof t.layers.getLayers?t.layers:new gs({layers:t.layers});let r,s,o;return i[at]=n,i[ht]=t.target,i[ut]=t.view instanceof er?t.view:new er,void 0!==t.controls&&(Array.isArray(t.controls)?r=new W(t.controls.slice()):(ct("function"==typeof t.controls.getArray,"Expected `controls` to be an array or an `ol/Collection.js`"),r=t.controls)),void 0!==t.interactions&&(Array.isArray(t.interactions)?s=new W(t.interactions.slice()):(ct("function"==typeof t.interactions.getArray,"Expected `interactions` to be an array or an `ol/Collection.js`"),s=t.interactions)),void 0!==t.overlays?Array.isArray(t.overlays)?o=new W(t.overlays.slice()):(ct("function"==typeof t.overlays.getArray,"Expected `overlays` to be an array or an `ol/Collection.js`"),o=t.overlays):o=new W,{controls:r,interactions:s,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:J,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,Q||(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,Q||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=e.controls||(Q?new W:function(t){t=t||{};const e=new W;return(void 0===t.zoom||t.zoom)&&e.push(new xr(t.zoomOptions)),(void 0===t.rotate||t.rotate)&&e.push(new vr(t.rotateOptions)),(void 0===t.attribution||t.attribution)&&e.push(new _r(t.attributionOptions)),e}()),this.interactions=e.interactions||(Q?new W:Qr({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new pt(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(at,this.handleLayerGroupChanged_),this.addChangeListener(ut,this.handleViewChanged_),this.addChangeListener(lt,this.handleSizeChanged_),this.addChangeListener(ht,this.handleTargetChanged_),this.setProperties(e.values);const i=this;!t.view||t.view instanceof er||t.view.then(function(t){i.setView(new er(t))}),this.controls.addEventListener(a,t=>{t.element.setMap(this)}),this.controls.addEventListener(l,t=>{t.element.setMap(null)}),this.interactions.addEventListener(a,t=>{t.element.setMap(this)}),this.interactions.addEventListener(l,t=>{t.element.setMap(null)}),this.overlays_.addEventListener(a,t=>{this.addOverlayInternal_(t.element)}),this.overlays_.addEventListener(l,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){nh(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 n=this.getCoordinateFromPixelInternal(t),r=void 0!==(i=void 0!==i?i:{}).hitTolerance?i.hitTolerance:0,s=void 0!==i.layerFilter?i.layerFilter:T,o=!1!==i.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,r,o,e,null,s,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 gs?e(i.getLayers()):t.push(i)})}(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t),n=void 0!==(e=void 0!==e?e:{}).layerFilter?e.layerFilter:T,r=void 0!==e.hitTolerance?e.hitTolerance:0,s=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,s,n,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(),n=e.width/i[0],r=e.height/i[1],s="changedTouches"in t?t.changedTouches[0]:t;return[(s.clientX-e.left)/n,(s.clientY-e.top)/r]}getTarget(){return this.get(ht)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return Ai(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?Wi(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(at)}setLayers(t){const e=this.getLayerGroup();if(t instanceof W)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 n=i.layer.getRenderer();if(n&&!n.ready)return!0;const r=i.layer.getSource();if(r&&r.loading)return!0}return!1}getPixelFromCoordinate(t){const e=Oi(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?Wi(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(lt)}getView(){return this.get(ut)}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,n){return function(t,e,i,n,r){if(!t||!(i in t.wantedTiles))return dt;if(!t.wantedTiles[i][e.getKey()])return dt;const s=t.viewState.center,o=n[0]-s[0],a=n[1]-s[1];return 65536*Math.log(r)+Math.sqrt(o*o+a*a)/r}(this.frameState_,t,e,i,n)}handleBrowserEvent(t,e){e=e||t.type;const i=new V(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===it||i===w||i===_){const t=this.getOwnerDocument(),i=this.viewport_.getRootNode?this.viewport_.getRootNode():t,n=e.target,r=i instanceof ShadowRoot?i.host===n?i.host.ownerDocument:i:i===t?t.documentElement:i;if(this.overlayContainerStopEvent_.contains(n)||!r.contains(n))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 n=e[i];if(n.getMap()===this&&n.getActive()&&this.getTargetElement()&&(!n.handleEvent(t)||t.propagationStopped))break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let i=this.maxTilesLoading_,n=i;const r=t?t.viewHints:void 0,s=!!r&&(r[0]||r[1]);if(s){const e=Date.now()-t.time>8;i=e?0:8,n=e?0:2}e.getTilesLoading()<i&&(s&&e.reprioritize(),e.loadMoreTiles(i,n))}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(vs)&&this.renderer_.dispatchRenderEvent(vs,t),!1===this.loaded_&&(this.loaded_=!0,this.dispatchEvent(new X(ot,this,t)))):!0===this.loaded_&&(this.loaded_=!1,this.dispatchEvent(new X(st,this,t))));const i=this.postRenderFunctions_;if(t)for(let e=0,n=i.length;e<n;++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)p(this.targetChangeHandlerKeys_[t]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(m,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(w,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!mr(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(mr(e)||e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new eh(this)),!mr(e)){this.mapBrowserEventHandler_=new nt(this,this.moveTolerance_);for(const t in K)this.mapBrowserEventHandler_.addEventListener(K[t],this.handleMapBrowserEvent.bind(this));let t;if(this.viewport_.addEventListener(m,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(w,this.boundHandleBrowserEvent_,!!et&&{passive:!1}),this.keyboardEventTarget_)t=this.keyboardEventTarget_;else{const i=e.getRootNode();t=i instanceof ShadowRoot?i.host:e}if(this.targetChangeHandlerKeys_=[d(t,_,this.handleBrowserEvent,this),d(t,v,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_&&(p(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(p(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=d(t,h,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=d(t,g,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(p),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new ds("addlayer",t)),this.layerGroupPropertyListenerKeys_=[d(t,h,this.render,this),d(t,g,this.render,this),d(t,"addlayer",this.handleLayerAdd_,this),d(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){ih(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),n=this.frameState_;let r=null;if(void 0!==e&&oo(e)&&i&&i.isDef()){const n=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),s=i.getState();if(r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Qt(s.center,s.resolution,s.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:s,viewHints:n,wantedTiles:{},mapId:z(this),renderTargets:{}},s.nextCenter&&s.nextResolution){const t=isNaN(s.nextRotation)?s.rotation:s.nextRotation;r.nextExtent=Qt(s.nextCenter,s.nextResolution,t,e)}}this.frameState_=r,this.renderer_.renderFrame(r),r&&(r.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,r.postRenderFunctions),n&&(!this.previousExtent_||!ae(this.previousExtent_)&&!Bt(r.extent,this.previousExtent_))&&(this.dispatchEvent(new X("movestart",this,n)),this.previousExtent_=Dt(this.previousExtent_)),this.previousExtent_&&!r.viewHints[0]&&!r.viewHints[1]&&!Bt(r.extent,this.previousExtent_)&&(this.dispatchEvent(new X("moveend",this,r)),At(r.extent,this.previousExtent_))),this.dispatchEvent(new X(rt,this,r)),this.renderComplete_=(this.hasListener(st)||this.hasListener(ot)||this.hasListener(vs))&&!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 ds("removelayer",e)),this.set(at,t)}setSize(t){this.set(lt,t)}setTarget(t){this.set(ht,t)}setView(t){if(!t||t instanceof er)return void this.set(ut,t);this.set(ut,new er);const e=this;t.then(function(t){e.setView(new er(t))})}updateSize(){const t=this.getTargetElement();let e;if(t){let i,n;if(mr(t)){const e=t.getContext("2d").getTransform();i=t.width/e.a,n=t.height/e.d}else{const e=getComputedStyle(t);i=t.offsetWidth-parseFloat(e.borderLeftWidth)-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight)-parseFloat(e.borderRightWidth),n=t.offsetHeight-parseFloat(e.borderTopWidth)-parseFloat(e.paddingTop)-parseFloat(e.paddingBottom)-parseFloat(e.borderBottomWidth)}isNaN(i)||isNaN(n)||(e=[Math.max(0,i),Math.max(0,n)],!oo(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&we("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&I(e,i)||(this.updateViewportSize_(e),this.setSize(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}};var sh=6378137,oh=.0066943799901413165,ah=484813681109536e-20,lh=Math.PI/2,hh=1e-10,uh=.017453292519943295,ch=57.29577951308232,dh=Math.PI/4,fh=2*Math.PI,ph=3.14159265359;const gh={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},mh={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 yh=/[\s_\-\/\(\)]/g;function _h(t,e){if(t[e])return t[e];for(var i,n=Object.keys(t),r=e.toLowerCase().replace(yh,""),s=-1;++s<n.length;)if((i=n[s]).toLowerCase().replace(yh,"")===r)return t[i]}function vh(t){var e,i,n,r={},s=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){r.rf=parseFloat(t)},lat_0:function(t){r.lat0=t*uh},lat_1:function(t){r.lat1=t*uh},lat_2:function(t){r.lat2=t*uh},lat_ts:function(t){r.lat_ts=t*uh},lon_0:function(t){r.long0=t*uh},lon_1:function(t){r.long1=t*uh},lon_2:function(t){r.long2=t*uh},alpha:function(t){r.alpha=parseFloat(t)*uh},gamma:function(t){r.rectified_grid_angle=parseFloat(t)*uh},lonc:function(t){r.longc=t*uh},x_0:function(t){r.x0=parseFloat(t)},y_0:function(t){r.y0=parseFloat(t)},k_0:function(t){r.k0=parseFloat(t)},k:function(t){r.k0=parseFloat(t)},a:function(t){r.a=parseFloat(t)},b:function(t){r.b=parseFloat(t)},r:function(t){r.a=r.b=parseFloat(t)},r_a:function(){r.R_A=!0},zone:function(t){r.zone=parseInt(t,10)},south:function(){r.utmSouth=!0},towgs84:function(t){r.datum_params=t.split(",").map(function(t){return parseFloat(t)})},to_meter:function(t){r.to_meter=parseFloat(t)},units:function(t){r.units=t;var e=_h(mh,t);e&&(r.to_meter=e.to_meter)},from_greenwich:function(t){r.from_greenwich=t*uh},pm:function(t){var e=_h(gh,t);r.from_greenwich=(e||parseFloat(t))*uh},nadgrids:function(t){"@null"===t?r.datumCode="none":r.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))&&(r.axis=t)},approx:function(){r.approx=!0},over:function(){r.over=!0}};for(e in s)i=s[e],e in o?"function"==typeof(n=o[e])?n(i):r[n]=i:r[e]=i;return"string"==typeof r.datumCode&&"WGS84"!==r.datumCode&&(r.datumCode=r.datumCode.toLowerCase()),r.projStr=t,r}const xh=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],n=parseFloat(t[2])||null,r=t.find(t=>Array.isArray(t)&&"ID"===t[0]);return{type:e,name:i,conversion_factor:n,id:r?{authority:r[1],code:parseInt(r[2],10)}:null}}static convertAxis(t){const e=t[1]||"Unknown";let i;const n=e.match(/^\((.)\)$/);if(n){const e=n[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 r=t.find(t=>Array.isArray(t)&&"ORDER"===t[0]),s=r?parseInt(r[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:s}}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 n=t.find(t=>Array.isArray(t)&&"LENGTHUNIT"===t[0]);if(n){const t=this.convertUnit(n);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 r=t.find(t=>Array.isArray(t)&&("DATUM"===t[0]||"ENSEMBLE"===t[0]));if(r){const i=this.convert(r);"ENSEMBLE"===r[0]?e.datum_ensemble=i:e.datum=i;const n=t.find(t=>Array.isArray(t)&&"PRIMEM"===t[0]);n&&"Greenwich"!==n[1]&&(i.prime_meridian={name:n[1],longitude:parseFloat(n[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 s=t.find(t=>Array.isArray(t)&&"ENSEMBLEACCURACY"===t[0]);s&&(e.accuracy=parseFloat(s[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 l=t.find(t=>Array.isArray(t)&&"TARGETCRS"===t[0]);if(l){const t=l.find(t=>Array.isArray(t));e.target_crs=t?this.convert(t):null}const h=t.find(t=>Array.isArray(t)&&"ABRIDGEDTRANSFORMATION"===t[0]);e.transformation=h?this.convert(h):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 u=this.convertUnit(t,"LinearUnit");e.coordinate_system&&e.coordinate_system.axis&&e.coordinate_system.axis.forEach(t=>{t.unit||(t.unit=u)}),u.conversion_factor&&1!==u.conversion_factor&&e.semi_major_axis&&(e.semi_major_axis={value:e.semi_major_axis,unit:u});break;default:e.keyword=t[0]}return e}},wh=class extends xh{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}},bh=class extends xh{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 n=t.find(t=>Array.isArray(t)&&"USAGE"===t[0]);if(n){const t=n.find(t=>Array.isArray(t)&&"SCOPE"===t[0]),i=n.find(t=>Array.isArray(t)&&"AREA"===t[0]),r=n.find(t=>Array.isArray(t)&&"BBOX"===t[0]);e.usage={},t&&(e.usage.scope=t[1]),i&&(e.usage.area=i[1]),r&&(e.usage.bbox=r.slice(1))}return e}};var Sh=/\s/,Mh=/[A-Za-z]/,Eh=/[A-Za-z84_]/,Ch=/[,\]]/,Ph=/[\d\.E\-\+]/;function Ih(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 Th(t,e,i){Array.isArray(e)&&(i.unshift(e),e=null);var n=e?{}:t,r=i.reduce(function(t,e){return kh(e,t),t},n);e&&(t[e]=r)}function kh(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 kh(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 n;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&&kh(t[2],e[i]));case"SPHEROID":case"ELLIPSOID":return e[i]={name:t[0],a:t[1],rf:t[2]},void(4===t.length&&kh(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 Th(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]],Th(e,i,t),void(e[i].type=i);default:for(n=-1;++n<t.length;)if(!Array.isArray(t[n]))return kh(t,e[i]);return Th(e,i,t)}}else e[i]=t;else e[i]=!0}else e[t]=!0}function Rh(t){return.017453292519943295*t}function Ah(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=Rh(t.lat0>0?90:-90),delete t.lat1):(t.lat0=Rh(t.lat1>0?90:-90),t.lat_ts=t.lat1,delete t.lat1)}function Oh(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 Gh(t){return"object"==typeof t?t.value*t.unit.conversion_factor:t}function Fh(t,e){t.ellipsoid.radius?(e.a=t.ellipsoid.radius,e.rf=0):(e.a=Gh(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-Gh(t.ellipsoid.semi_minor_axis))))}function Lh(t,e={}){return t&&"object"==typeof t?"BoundCRS"===t.type?(Lh(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 n=t[i];if(null!==n)switch(i){case"name":if(e.srsCode)break;e.name=n,e.srsCode=n;break;case"type":"GeographicCRS"===n?e.projName="longlat":"GeodeticCRS"===n?t.coordinate_system&&"Cartesian"===t.coordinate_system.subtype?e.projName="geocent":e.projName="longlat":"ProjectedCRS"===n&&t.conversion&&t.conversion.method&&(e.projName=t.conversion.method.name);break;case"datum":case"datum_ensemble":n.ellipsoid&&(e.ellps=n.ellipsoid.name,Fh(n,e)),n.prime_meridian&&(e.from_greenwich=n.prime_meridian.longitude*Math.PI/180);break;case"ellipsoid":e.ellps=n.name,Fh(n,e);break;case"prime_meridian":e.long0=(n.longitude||0)*Math.PI/180;break;case"coordinate_system":if(n.axis){const t={east:"e",north:"n",west:"w",south:"s",up:"u",down:"d",geocentricx:"e",geocentricy:"n",geocentricz:"u"},i=n.axis.map(e=>t[e.direction.toLowerCase()]);if(i.every(Boolean)&&(e.axis=i.join(""),2===e.axis.length&&(e.axis+="u")),n.unit){const{units:t,to_meter:i}=Oh(n.unit);e.units=t,e.to_meter=i}else if(n.axis[0]&&n.axis[0].unit){const{units:t,to_meter:i}=Oh(n.axis[0].unit);e.units=t,e.to_meter=i}}break;case"id":n.authority&&n.code&&(e.title=n.authority+":"+n.code);break;case"conversion":n.method&&n.method.name&&(e.projName=n.method.name),n.parameters&&n.parameters.forEach(t=>{const i=t.name.toLowerCase().replace(/\s+/g,"_"),n=t.value;t.unit&&t.unit.conversion_factor?e[i]=n*t.unit.conversion_factor:"degree"===t.unit?e[i]=n*Math.PI/180:e[i]=n});break;case"unit":n.name&&(e.units=n.name.toLowerCase(),"metre"===e.units&&(e.units="meter")),n.conversion_factor&&(e.to_meter=n.conversion_factor);break;case"base_crs":Lh(n,e),e.datumCode=n.id?n.id.authority+"_"+n.id.code:n.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),Ah(e),e):t}Ih.prototype.readCharicter=function(){var t=this.text[this.place++];if(4!==this.state)for(;Sh.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}},Ih.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=4);if(Ch.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)},Ih.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},Ih.prototype.number=function(t){if(!Ph.test(t)){if(Ch.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},Ih.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=5},Ih.prototype.keyword=function(t){if(Eh.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(!Ch.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}},Ih.prototype.neutral=function(t){if(Mh.test(t))return this.word=t,void(this.state=2);if('"'===t)return this.word="",void(this.state=4);if(Ph.test(t))return this.word=t,void(this.state=3);if(!Ch.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)},Ih.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 Nh(t){for(var e=Object.keys(t),i=0,n=e.length;i<n;++i){var r=e[i];-1!==jh.indexOf(r)&&Dh(t[r]),"object"==typeof t[r]&&Nh(t[r])}}function Dh(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="",n=0,r=t.AXIS.length;n<r;++n){var s=[t.AXIS[n][0].toLowerCase(),t.AXIS[n][1].toLowerCase()];-1!==s[0].indexOf("north")||("y"===s[0]||"lat"===s[0])&&"north"===s[1]?i+="n":-1!==s[0].indexOf("south")||("y"===s[0]||"lat"===s[0])&&"south"===s[1]?i+="s":-1!==s[0].indexOf("east")||("x"===s[0]||"lon"===s[0])&&"east"===s[1]?i+="e":-1===s[0].indexOf("west")&&("x"!==s[0]&&"lon"!==s[0]||"west"!==s[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=Rh(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=Rh(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",Rh],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",Rh],["x0","false_easting",a],["y0","false_northing",a],["long0","central_meridian",Rh],["lat0","latitude_of_origin",Rh],["lat0","standard_parallel_1",Rh],["lat1","standard_parallel_1",Rh],["lat2","standard_parallel_2",Rh],["azimuth","Azimuth"],["alpha","azimuth",Rh],["srsCode","name"]].forEach(function(e){return function(t,e){var i=e[0],n=e[1];!(i in t)&&n in t&&(t[i]=t[n],3===e.length&&(t[i]=e[2](t[i])))}(t,e)}),Ah(t)}function zh(t){if("object"==typeof t)return Lh(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 Ih(t).output();if("WKT2"===e)return Lh(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?bh:wh).convert(t)}(i));var n=i[0],r={};return kh(i,r),Nh(r),r[n]}function qh(t){var e=this;if(2===arguments.length){var i=arguments[1];"string"==typeof i?"+"===i.charAt(0)?qh[t]=vh(arguments[1]):qh[t]=zh(arguments[1]):i&&"object"==typeof i&&!("projName"in i)?qh[t]=zh(arguments[1]):(qh[t]=i,i||delete qh[t])}else if(1===arguments.length){if(Array.isArray(t))return t.map(function(t){return Array.isArray(t)?qh.apply(e,t):qh(t)});if("string"==typeof t){if(t in qh)return qh[t]}else"EPSG"in t?qh["EPSG:"+t.EPSG]=t:"ESRI"in t?qh["ESRI:"+t.ESRI]=t:"IAU2000"in t?qh["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"]}(qh);const Bh=qh;var $h=["3857","900913","3785","102113"];function Uh(t,e){var i,n;if(t=t||{},!e)return t;for(n in e)void 0!==(i=e[n])&&(t[n]=i);return t}function Wh(t,e,i){var n=t*e;return i/Math.sqrt(1-n*n)}function Xh(t){return t<0?-1:1}function Vh(t,e){return e||Math.abs(t)<=ph?t:t-Xh(t)*fh}function Kh(t,e,i){var n=t*i,r=.5*t;return n=Math.pow((1-n)/(1+n),r),Math.tan(.5*(lh-e))/n}function Zh(t,e){for(var i,n,r=.5*t,s=lh-2*Math.atan(e),o=0;o<=15;o++)if(i=t*Math.sin(s),s+=n=lh-2*Math.atan(e*Math.pow((1-i)/(1+i),r))-s,Math.abs(n)<=1e-10)return s;return-9999}function Yh(t){return t}var Hh=["longlat","identity"],Jh=[{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=Wh(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,n=t.x,r=t.y;if(r*ch>90&&r*ch<-90&&n*ch>180&&n*ch<-180)return null;if(Math.abs(Math.abs(r)-lh)<=hh)return null;if(this.sphere)e=this.x0+this.a*this.k0*Vh(n-this.long0,this.over),i=this.y0+this.a*this.k0*Math.log(Math.tan(dh+.5*r));else{var s=Math.sin(r),o=Kh(this.e,r,s);e=this.x0+this.a*this.k0*Vh(n-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,n=t.x-this.x0,r=t.y-this.y0;if(this.sphere)i=lh-2*Math.atan(Math.exp(-r/(this.a*this.k0)));else{var s=Math.exp(-r/(this.a*this.k0));if(-9999===(i=Zh(this.e,s)))return null}return e=Vh(this.long0+n/(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:Yh,inverse:Yh,names:Hh}],Qh={},tu=[];function eu(t,e){var i=tu.length;return t.names?(tu[i]=t,t.names.forEach(function(t){Qh[t.toLowerCase()]=i}),this):(console.log(e),!0)}function iu(t){return t.replace(/[-\(\)\s]+/g," ").trim().replace(/ /g,"_")}const nu={start:function(){Jh.forEach(eu)},add:eu,get:function(t){if(!t)return!1;var e=t.toLowerCase();return void 0!==Qh[e]&&tu[Qh[e]]||(e=iu(e))in Qh&&tu[Qh[e]]?tu[Qh[e]]:void 0}},ru={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)"}},su=ru.WGS84;var ou={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 au in ou){var lu=ou[au];lu.datumName&&(ou[lu.datumName]=lu)}const hu=ou;var uu={};async function cu(t,e){for(var i=[],n=await e.getImageCount(),r=n-1;r>=0;r--){var s=await e.getImage(r),o=await s.readRasters(),a=[s.getWidth(),s.getHeight()],l=s.getBoundingBox().map(fu),h=[s.fileDirectory.ModelPixelScale[0],s.fileDirectory.ModelPixelScale[1]].map(fu),u=l[0]+(a[0]-1)*h[0],c=l[3]-(a[1]-1)*h[1],d=o[0],f=o[1],p=[];for(let t=a[1]-1;t>=0;t--)for(let e=a[0]-1;e>=0;e--){var g=t*a[0]+e;p.push([-pu(f[g]),pu(d[g])])}i.push({del:h,lim:a,ll:[-u,c],cvs:p})}var m={header:{nSubgrids:n},subgrids:i};return uu[t]=m,m}function du(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:uu[t]||null,isNull:!1}}function fu(t){return t*Math.PI/180}function pu(t){return t/3600*Math.PI/180}function gu(t,e,i){return String.fromCharCode.apply(null,new Uint8Array(t.buffer.slice(e,i)))}function mu(t){return t.map(function(t){return[pu(t.longitudeShift),pu(t.latitudeShift)]})}function yu(t,e,i){return{name:gu(t,e+8,e+16).trim(),parent:gu(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 _u(t,e,i,n,r){var s=e+176,o=16;!1===r&&(o=8);for(var a=[],l=0;l<i.gridNodeCount;l++){var h={latitudeShift:t.getFloat32(s+l*o,n),longitudeShift:t.getFloat32(s+l*o+4,n)};!1!==r&&(h.latitudeAccuracy=t.getFloat32(s+l*o+8,n),h.longitudeAccuracy=t.getFloat32(s+l*o+12,n)),a.push(h)}return a}function vu(t,e){if(!(this instanceof vu))return new vu(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 Bh}(t))e=Bh[t];else if(function(t){return 0!==t.indexOf("+")&&-1!==t.indexOf("[")||"object"==typeof t&&!("srsCode"in t)}(t)){e=zh(t);var i=function(t){var e=_h(t,"extension");if(e)return _h(e,"proj4")}(e);i&&(e=vh(i))}else(function(t){return"+"===t[0]})(t)&&(e=vh(t));else e="projName"in t?t:zh(t);return e&&function(t){if(t.title)return 0===t.title.toLowerCase().indexOf("epsg:")&&$h.indexOf(t.title.substr(5))>-1;var e=_h(t,"authority");if(e){var i=_h(e,"epsg");return i&&$h.indexOf(i)>-1}}(e)?Bh["EPSG:3857"]:e}(t);if("object"==typeof i){var n=vu.projections.get(i.projName);if(n){if(i.datumCode&&"none"!==i.datumCode){var r=_h(hu,i.datumCode);r&&(i.datum_params=i.datum_params||(r.towgs84?r.towgs84.split(","):null),i.ellps=r.ellipse,i.datumName=r.datumName?r.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 s=function(t,e,i,n,r){if(!t){var s=_h(ru,n);s||(s=su),t=s.a,e=s.b,i=s.rf}return i&&!e&&(e=(1-1/i)*t),(0===i||Math.abs(t-e)<hh)&&(r=!0,e=t),{a:t,b:e,rf:i,sphere:r}}(i.a,i.b,i.rf,i.ellps,i.sphere),o=function(t,e,i,n){var r=t*t,s=e*e,o=(r-s)/r,a=0;return n?(r=(t*=1-o*(.16666666666666666+o*(.04722222222222222+.022156084656084655*o)))*t,o=0):a=Math.sqrt(o),{es:o,e:a,ep2:(r-s)/s}}(s.a,s.b,s.rf,i.R_A),a=function(t){return void 0===t?null:t.split(",").map(du)}(i.nadgrids),l=i.datum||function(t,e,i,n,r,s,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]*=ah,a.datum_params[4]*=ah,a.datum_params[5]*=ah,a.datum_params[6]=a.datum_params[6]/1e6+1))),o&&(a.datum_type=3,a.grids=o),a.a=i,a.b=n,a.es=r,a.ep2=s,a}(i.datumCode,i.datum_params,s.a,s.b,o.es,o.ep2,a);Uh(this,i),Uh(this,n),this.a=s.a,this.b=s.b,this.rf=s.rf,this.sphere=s.sphere,this.es=o.es,this.e=o.e,this.ep2=o.ep2,this.datum=l,"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)}vu.projections=nu,vu.projections.start();const xu=vu;function wu(t,e,i){var n,r,s,o,a=t.x,l=t.y,h=t.z?t.z:0;if(l<-lh&&l>-1.001*lh)l=-lh;else if(l>lh&&l<1.001*lh)l=lh;else{if(l<-lh)return{x:-1/0,y:-1/0,z:t.z};if(l>lh)return{x:1/0,y:1/0,z:t.z}}return a>Math.PI&&(a-=2*Math.PI),r=Math.sin(l),o=Math.cos(l),s=r*r,{x:((n=i/Math.sqrt(1-e*s))+h)*o*Math.cos(a),y:(n+h)*o*Math.sin(a),z:(n*(1-e)+h)*r}}function bu(t,e,i,n){var r,s,o,a,l,h,u,c,d,f,p,g,m,y,_,v=t.x,x=t.y,w=t.z?t.z:0;if(r=Math.sqrt(v*v+x*x),s=Math.sqrt(v*v+x*x+w*w),r/i<1e-12){if(y=0,s/i<1e-12)return _=-n,{x:t.x,y:t.y,z:t.z}}else y=Math.atan2(x,v);o=w/s,c=(a=r/s)*(1-e)*(l=1/Math.sqrt(1-e*(2-e)*a*a)),d=o*l,m=0;do{m++,h=e*(u=i/Math.sqrt(1-e*d*d))/(u+(_=r*c+w*d-u*(1-e*d*d))),g=(p=o*(l=1/Math.sqrt(1-h*(2-h)*a*a)))*c-(f=a*(1-h)*l)*d,c=f,d=p}while(g*g>1e-24&&m<30);return{x:y,y:Math.atan(p/Math.abs(f)),z:_}}function Su(t){return 1===t||2===t}function Mu(t,e,i){if(null===t.grids||0===t.grids.length)return console.log("Grid shift grids not found"),-1;var n={x:-i.x,y:i.y},r={x:Number.NaN,y:Number.NaN},s=[];t:for(var o=0;o<t.grids.length;o++){var a=t.grids[o];if(s.push(a.name),a.isNull){r=n;break}if(null!==a.grid)for(var l=a.grid.subgrids,h=0,u=l.length;h<u;h++){var c=l[h],d=(Math.abs(c.del[1])+Math.abs(c.del[0]))/1e4,f=c.ll[0]-d,p=c.ll[1]-d,g=c.ll[0]+(c.lim[0]-1)*c.del[0]+d,m=c.ll[1]+(c.lim[1]-1)*c.del[1]+d;if(!(p>n.y||f>n.x||m<n.y||g<n.x||(r=Eu(n,e,c),isNaN(r.x))))break t}else if(a.mandatory)return console.log("Unable to find mandatory grid '"+a.name+"'"),-1}return isNaN(r.x)?(console.log("Failed to find a grid shift table for location '"+-n.x*ch+" "+n.y*ch+" tried: '"+s+"'"),-1):(i.x=-r.x,i.y=r.y,0)}function Eu(t,e,i){var n={x:Number.NaN,y:Number.NaN};if(isNaN(t.x))return n;var r={x:t.x,y:t.y};r.x-=i.ll[0],r.y-=i.ll[1],r.x=Vh(r.x-Math.PI)+Math.PI;var s=Cu(r,i);if(e){if(isNaN(s.x))return n;s.x=r.x-s.x,s.y=r.y-s.y;var o,a,l=9;do{if(a=Cu(s,i),isNaN(a.x)){console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");break}o={x:r.x-(a.x+s.x),y:r.y-(a.y+s.y)},s.x+=o.x,s.y+=o.y}while(l--&&Math.abs(o.x)>1e-12&&Math.abs(o.y)>1e-12);if(l<0)return console.log("Inverse grid shift iterator failed to converge."),n;n.x=Vh(s.x+i.ll[0]),n.y=s.y+i.ll[1]}else isNaN(s.x)||(n.x=t.x+s.x,n.y=t.y+s.y);return n}function Cu(t,e){var i,n={x:t.x/e.del[0],y:t.y/e.del[1]},r=Math.floor(n.x),s=Math.floor(n.y),o=n.x-1*r,a=n.y-1*s,l={x:Number.NaN,y:Number.NaN};if(r<0||r>=e.lim[0])return l;if(s<0||s>=e.lim[1])return l;i=s*e.lim[0]+r;var h=e.cvs[i][0],u=e.cvs[i][1];i++;var c=e.cvs[i][0],d=e.cvs[i][1];i+=e.lim[0];var f=e.cvs[i][0],p=e.cvs[i][1];i--;var g=e.cvs[i][0],m=e.cvs[i][1],y=o*a,_=o*(1-a),v=(1-o)*(1-a),x=(1-o)*a;return l.x=v*h+_*c+x*g+y*f,l.y=v*u+_*d+x*m+y*p,l}function Pu(t,e,i){var n,r,s,o=i.x,a=i.y,l=i.z||0,h={};for(s=0;s<3;s++)if(!e||2!==s||void 0!==i.z)switch(0===s?(n=o,r=-1!=="ew".indexOf(t.axis[s])?"x":"y"):1===s?(n=a,r=-1!=="ns".indexOf(t.axis[s])?"y":"x"):(n=l,r="z"),t.axis[s]){case"e":case"n":h[r]=n;break;case"w":case"s":h[r]=-n;break;case"u":void 0!==i[r]&&(h.z=n);break;case"d":void 0!==i[r]&&(h.z=-n);break;default:return null}return h}function Iu(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 Tu(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 ku(t,e,i,n){var r,s=void 0!==(i=Array.isArray(i)?Iu(i):{x:i.x,y:i.y,z:i.z,m:i.m}).z;if(function(t){Tu(t.x),Tu(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=ku(t,r=new xu("WGS84"),i,n),t=r),n&&"enu"!==t.axis&&(i=Pu(t,!1,i)),"longlat"===t.projName)i={x:i.x*uh,y:i.y*uh,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 n=t.a,r=t.es;if(3===t.datum_type){if(0!==Mu(t,!1,i))return;n=sh,r=oh}var s=e.a,o=e.b,a=e.es;return 3===e.datum_type&&(s=sh,o=6356752.314,a=oh),r!==a||n!==s||Su(t.datum_type)||Su(e.datum_type)?(i=wu(i,r,n),Su(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 n=i[0],r=i[1],s=i[2],o=i[3],a=i[4],l=i[5],h=i[6];return{x:h*(t.x-l*t.y+a*t.z)+n,y:h*(l*t.x+t.y-o*t.z)+r,z:h*(-a*t.x+o*t.y+t.z)+s}}}(i,t.datum_type,t.datum_params)),Su(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 n=i[0],r=i[1],s=i[2],o=i[3],a=i[4],l=i[5],h=i[6],u=(t.x-n)/h,c=(t.y-r)/h,d=(t.z-s)/h;return{x:u+l*c-a*d,y:-l*u+c+o*d,z:a*u-o*c+d}}}(i,e.datum_type,e.datum_params)),i=bu(i,a,s,o),3!==e.datum_type||0===Mu(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})),n&&"enu"!==e.axis?Pu(e,!0,i):(i&&!s&&"geocent"!==e.projName&&delete i.z,i)}var Ru=xu("WGS84");function Au(t,e,i,n){var r,s,o;return Array.isArray(i)?(r=ku(t,e,i,n)||{x:NaN,y:NaN},i.length>2?void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name?"number"==typeof r.z?[r.x,r.y,r.z].concat(i.slice(3)):[r.x,r.y,i[2]].concat(i.slice(3)):[r.x,r.y].concat(i.slice(2)):[r.x,r.y]):(s=ku(t,e,i,n),2===(o=Object.keys(i)).length||o.forEach(function(n){if(void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name){if("x"===n||"y"===n||"z"===n)return}else if("x"===n||"y"===n)return;s[n]=i[n]}),s)}function Ou(t){return t instanceof xu?t:"object"==typeof t&&"oProj"in t?t.oProj:xu(t)}var Gu="AJSAJS",Fu="AFAFAF",Lu=65,ju=73,Nu=79;const Du={forward:zu,inverse:function(t){var e=Uu(Xu(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat,e.lon,e.lat]:[e.left,e.bottom,e.right,e.top]},toPoint:qu};function zu(t,e){return e=e||5,function(t,e){var i,n,r,s,o,a,l,h,u,c,d,f="00000"+t.easting,p="00000"+t.northing;return t.zoneNumber+t.zoneLetter+(u=t.easting,c=t.northing,d=Wu(t.zoneNumber),i=Math.floor(u/1e5),n=Math.floor(c/1e5)%20,s=Gu.charCodeAt(r=d-1),o=Fu.charCodeAt(r),h=!1,(a=s+i-1)>90&&(a=a-90+Lu-1,h=!0),(a===ju||s<ju&&a>ju||(a>ju||s<ju)&&h)&&a++,(a===Nu||s<Nu&&a>Nu||(a>Nu||s<Nu)&&h)&&++a===ju&&a++,a>90&&(a=a-90+Lu-1),(l=o+n)>86?(l=l-86+Lu-1,h=!0):h=!1,(l===ju||o<ju&&l>ju||(l>ju||o<ju)&&h)&&l++,(l===Nu||o<Nu&&l>Nu||(l>Nu||o<Nu)&&h)&&++l===ju&&l++,l>86&&(l=l-86+Lu-1),String.fromCharCode(a)+String.fromCharCode(l))+f.substr(f.length-5,e)+p.substr(p.length-5,e)}(function(t){var e,i,n,r,s,o,a,l=t.lat,h=t.lon,u=6378137,c=.00669438,d=.9996,f=Bu(l),p=Bu(h);a=Math.floor((h+180)/6)+1,180===h&&(a=60),l>=56&&l<64&&h>=3&&h<12&&(a=32),l>=72&&l<84&&(h>=0&&h<9?a=31:h>=9&&h<21?a=33:h>=21&&h<33?a=35:h>=33&&h<42&&(a=37)),o=Bu(6*(a-1)-180+3),e=.006739496752268451,i=u/Math.sqrt(1-c*Math.sin(f)*Math.sin(f)),n=Math.tan(f)*Math.tan(f),r=e*Math.cos(f)*Math.cos(f);var g,m,y=d*i*((s=Math.cos(f)*(p-o))+(1-n+r)*s*s*s/6+(5-18*n+n*n+72*r-58*e)*s*s*s*s*s/120)+5e5,_=d*(u*(.9983242984503243*f-.002514607064228144*Math.sin(2*f)+2639046602129982e-21*Math.sin(4*f)-3.418046101696858e-9*Math.sin(6*f))+i*Math.tan(f)*(s*s/2+(5-n+9*r+4*r*r)*s*s*s*s/24+(61-58*n+n*n+600*r-2.2240339282485886)*s*s*s*s*s*s/720));return l<0&&(_+=1e7),{northing:Math.round(_),easting:Math.round(y),zoneNumber:a,zoneLetter:(g=l,m="Z",84>=g&&g>=72?m="X":72>g&&g>=64?m="W":64>g&&g>=56?m="V":56>g&&g>=48?m="U":48>g&&g>=40?m="T":40>g&&g>=32?m="S":32>g&&g>=24?m="R":24>g&&g>=16?m="Q":16>g&&g>=8?m="P":8>g&&g>=0?m="N":0>g&&g>=-8?m="M":-8>g&&g>=-16?m="L":-16>g&&g>=-24?m="K":-24>g&&g>=-32?m="J":-32>g&&g>=-40?m="H":-40>g&&g>=-48?m="G":-48>g&&g>=-56?m="F":-56>g&&g>=-64?m="E":-64>g&&g>=-72?m="D":-72>g&&g>=-80&&(m="C"),m)}}({lat:t[1],lon:t[0]}),e)}function qu(t){var e=Uu(Xu(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function Bu(t){return t*(Math.PI/180)}function $u(t){return t/Math.PI*180}function Uu(t){var e=t.northing,i=t.easting,n=t.zoneLetter,r=t.zoneNumber;if(r<0||r>60)return null;var s,o,a,l,h,u,c,d,f,p=.9996,g=6378137,m=.00669438,y=(1-Math.sqrt(.99330562))/(1+Math.sqrt(.99330562)),_=i-5e5,v=e;n<"N"&&(v-=1e7),c=6*(r-1)-180+3,s=.006739496752268451,f=(d=v/p/6367449.145945056)+(3*y/2-27*y*y*y/32)*Math.sin(2*d)+(21*y*y/16-55*y*y*y*y/32)*Math.sin(4*d)+151*y*y*y/96*Math.sin(6*d),o=g/Math.sqrt(1-m*Math.sin(f)*Math.sin(f)),a=Math.tan(f)*Math.tan(f),l=s*Math.cos(f)*Math.cos(f),h=.99330562*g/Math.pow(1-m*Math.sin(f)*Math.sin(f),1.5),u=_/(o*p);var x=f-o*Math.tan(f)/h*(u*u/2-(5+3*a+10*l-4*l*l-9*s)*u*u*u*u/24+(61+90*a+298*l+45*a*a-1.6983531815716497-3*l*l)*u*u*u*u*u*u/720);x=$u(x);var w,b=(u-(1+2*a+l)*u*u*u/6+(5-2*l+28*a-3*l*l+8*s+24*a*a)*u*u*u*u*u/120)/Math.cos(f);if(b=c+$u(b),t.accuracy){var S=Uu({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});w={top:S.lat,right:S.lon,bottom:x,left:b}}else w={lat:x,lon:b};return w}function Wu(t){var e=t%6;return 0===e&&(e=6),e}function Xu(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";for(var e,i=t.length,n=null,r="",s=0;!/[A-Z]/.test(e=t.charAt(s));){if(s>=2)throw"MGRSPoint bad conversion from: "+t;r+=e,s++}var o=parseInt(r,10);if(0===s||s+3>i)throw"MGRSPoint bad conversion from: "+t;var a=t.charAt(s++);if(a<="A"||"B"===a||"Y"===a||a>="Z"||"I"===a||"O"===a)throw"MGRSPoint zone letter "+a+" not handled: "+t;n=t.substring(s,s+=2);for(var l=Wu(o),h=function(t,e){for(var i=Gu.charCodeAt(e-1),n=1e5,r=!1;i!==t.charCodeAt(0);){if(++i===ju&&i++,i===Nu&&i++,i>90){if(r)throw"Bad character: "+t;i=Lu,r=!0}n+=1e5}return n}(n.charAt(0),l),u=function(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;for(var i=Fu.charCodeAt(e-1),n=0,r=!1;i!==t.charCodeAt(0);){if(++i===ju&&i++,i===Nu&&i++,i>86){if(r)throw"Bad character: "+t;i=Lu,r=!0}n+=1e5}return n}(n.charAt(1),l);u<Vu(a);)u+=2e6;var c=i-s;if(c%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,f,p,g=c/2,m=0,y=0;return g>0&&(d=1e5/Math.pow(10,g),f=t.substring(s,s+g),m=parseFloat(f)*d,p=t.substring(s+g),y=parseFloat(p)*d),{easting:m+h,northing:y+u,zoneLetter:a,zoneNumber:o,accuracy:d}}function Vu(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 Ku(t,e,i){if(!(this instanceof Ku))return new Ku(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 n=t.split(",");this.x=parseFloat(n[0]),this.y=parseFloat(n[1]),this.z=parseFloat(n[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")}Ku.fromMGRS=function(t){return new Ku(qu(t))},Ku.prototype.toMGRS=function(t){return zu([this.x,this.y],t)};const Zu=Ku;var Yu=.046875,Hu=.01953125,Ju=.01068115234375;function Qu(t){var e=[];e[0]=1-t*(.25+t*(Yu+t*(Hu+t*Ju))),e[1]=t*(.75-t*(Yu+t*(Hu+t*Ju)));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 tc(t,e,i,n){return i*=e,e*=e,n[0]*t-i*(n[1]+e*(n[2]+e*(n[3]+e*n[4])))}function ec(t,e,i){for(var n=1/(1-e),r=t,s=20;s;--s){var o=Math.sin(r),a=1-e*o*o;if(r-=a=(tc(r,o,Math.cos(r),i)-t)*(a*Math.sqrt(a))*n,Math.abs(a)<hh)return r}return r}const ic={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=Qu(this.es),this.ml0=tc(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))},forward:function(t){var e,i,n,r=t.x,s=t.y,o=Vh(r-this.long0,this.over),a=Math.sin(s),l=Math.cos(s);if(this.es){var h=l*o,u=Math.pow(h,2),c=this.ep2*Math.pow(l,2),d=Math.pow(c,2),f=Math.abs(l)>hh?Math.tan(s):0,p=Math.pow(f,2),g=Math.pow(p,2);e=1-this.es*Math.pow(a,2),h/=Math.sqrt(e);var m=tc(s,a,l,this.en);i=this.a*(this.k0*h*(1+u/6*(1-p+c+u/20*(5-18*p+g+14*c-58*p*c+u/42*(61+179*g-g*p-479*p)))))+this.x0,n=this.a*(this.k0*(m-this.ml0+a*o*h/2*(1+u/12*(5-p+9*c+4*d+u/30*(61+g-58*p+270*c-330*p*c+u/56*(1385+543*g-g*p-3111*p))))))+this.y0}else{var y=l*Math.sin(o);if(Math.abs(Math.abs(y)-1)<hh)return 93;if(i=.5*this.a*this.k0*Math.log((1+y)/(1-y))+this.x0,n=l*Math.cos(o)/Math.sqrt(1-Math.pow(y,2)),(y=Math.abs(n))>=1){if(y-1>hh)return 93;n=0}else n=Math.acos(n);s<0&&(n=-n),n=this.a*this.k0*(n-this.lat0)+this.y0}return t.x=i,t.y=n,t},inverse:function(t){var e,i,n,r,s=(t.x-this.x0)*(1/this.a),o=(t.y-this.y0)*(1/this.a);if(this.es)if(i=ec(e=this.ml0+o/this.k0,this.es,this.en),Math.abs(i)<lh){var a=Math.sin(i),l=Math.cos(i),h=Math.abs(l)>hh?Math.tan(i):0,u=this.ep2*Math.pow(l,2),c=Math.pow(u,2),d=Math.pow(h,2),f=Math.pow(d,2);e=1-this.es*Math.pow(a,2);var p=s*Math.sqrt(e)/this.k0,g=Math.pow(p,2);n=i-(e*=h)*g/(1-this.es)*.5*(1-g/12*(5+3*d-9*u*d+u-4*c-g/30*(61+90*d-252*u*d+45*f+46*u-g/56*(1385+3633*d+4095*f+1574*f*d)))),r=Vh(this.long0+p*(1-g/6*(1+2*d+u-g/20*(5+28*d+24*f+8*u*d+6*u-g/42*(61+662*d+1320*f+720*f*d))))/l,this.over)}else n=lh*Xh(o),r=0;else{var m=Math.exp(s/this.k0),y=.5*(m-1/m),_=this.lat0+o/this.k0,v=Math.cos(_);e=Math.sqrt((1-Math.pow(v,2))/(1+Math.pow(y,2))),n=Math.asin(e),o<0&&(n=-n),r=0===y&&0===v?0:Vh(Math.atan2(y,v)+this.long0,this.over)}return t.x=r,t.y=n,t},names:["Fast_Transverse_Mercator","Fast Transverse Mercator"]};function nc(t){var e=Math.exp(t);return(e-1/e)/2}function rc(t,e){t=Math.abs(t),e=Math.abs(e);var i=Math.max(t,e),n=Math.min(t,e)/(i||1);return i*Math.sqrt(1+Math.pow(n,2))}function sc(t,e){for(var i,n=2*Math.cos(2*e),r=t.length-1,s=t[r],o=0;--r>=0;)i=n*s-o+t[r],o=s,s=i;return e+i*Math.sin(2*e)}function oc(t,e,i){for(var n,r,s=Math.sin(e),o=Math.cos(e),a=nc(i),l=function(t){var e=Math.exp(t);return(e+1/e)/2}(i),h=2*o*l,u=-2*s*a,c=t.length-1,d=t[c],f=0,p=0,g=0;--c>=0;)n=p,r=f,d=h*(p=d)-n-u*(f=g)+t[c],g=u*p-r+h*f;return[(h=s*l)*d-(u=o*a)*g,h*g+u*d]}const ac={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&&(ic.init.apply(this),this.forward=ic.forward,this.inverse=ic.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 n=sc(this.cbg,this.lat0);this.Zb=-this.Qn*(n+function(t,e){for(var i,n=2*Math.cos(e),r=t.length-1,s=t[r],o=0;--r>=0;)i=n*s-o+t[r],o=s,s=i;return Math.sin(e)*i}(this.gtu,2*n))},forward:function(t){var e=Vh(t.x-this.long0,this.over),i=t.y;i=sc(this.cbg,i);var n=Math.sin(i),r=Math.cos(i),s=Math.sin(e),o=Math.cos(e);i=Math.atan2(n,o*r),e=Math.atan2(s*r,rc(n,r*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/(rc(1,e)+1))),t<0?-e:e}(Math.tan(e));var a,l,h=oc(this.gtu,2*i,2*e);return i+=h[0],e+=h[1],Math.abs(e)<=2.623395162778?(a=this.a*(this.Qn*e)+this.x0,l=this.a*(this.Qn*i+this.Zb)+this.y0):(a=1/0,l=1/0),t.x=a,t.y=l,t},inverse:function(t){var e,i,n=(t.x-this.x0)*(1/this.a),r=(t.y-this.y0)*(1/this.a);if(r=(r-this.Zb)/this.Qn,n/=this.Qn,Math.abs(n)<=2.623395162778){var s=oc(this.utg,2*r,2*n);r+=s[0],n+=s[1],n=Math.atan(nc(n));var o=Math.sin(r),a=Math.cos(r),l=Math.sin(n),h=Math.cos(n);r=Math.atan2(o*h,rc(l,h*a)),e=Vh((n=Math.atan2(l,h*a))+this.long0,this.over),i=sc(this.cgb,r)}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"]},lc={init:function(){var t=function(t,e){if(void 0===t){if((t=Math.floor(30*(Vh(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)*uh,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,ac.init.apply(this),this.forward=ac.forward,this.inverse=ac.inverse},names:["Universal Transverse Mercator System","utm"],dependsOn:"etmerc"};function hc(t,e){return Math.pow((1-t)/(1+t),e)}const uc={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+dh)/(Math.pow(Math.tan(.5*this.lat0+dh),this.C)*hc(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+dh),this.C)*hc(this.e*Math.sin(i),this.ratexp))-lh,t.x=this.C*e,t},inverse:function(t){for(var e=t.x/this.C,i=t.y,n=Math.pow(Math.tan(.5*i+dh)/this.K,1/this.C),r=20;r>0&&(i=2*Math.atan(n*hc(this.e*Math.sin(t.y),-.5*this.e))-lh,!(Math.abs(i-t.y)<1e-14));--r)t.y=i;return r?(t.x=e,t.y=i,t):null},names:["gauss"]},cc={init:function(){uc.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,n,r;return t.x=Vh(t.x-this.long0,this.over),uc.forward.apply(this,[t]),e=Math.sin(t.y),i=Math.cos(t.y),n=Math.cos(t.x),r=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*i*n),t.x=r*i*Math.sin(t.x),t.y=r*(this.cosc0*e-this.sinc0*i*n),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t},inverse:function(t){var e,i,n,r,s;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,s=rc(t.x,t.y)){var o=2*Math.atan2(s,this.R2);e=Math.sin(o),i=Math.cos(o),r=Math.asin(i*this.sinc0+t.y*e*this.cosc0/s),n=Math.atan2(t.x*e,s*this.cosc0*i-t.y*this.sinc0*e)}else r=this.phic0,n=0;return t.x=n,t.y=r,uc.inverse.apply(this,[t]),t.x=Vh(t.x+this.long0,this.over),t},names:["Stereographic_North_Pole","Oblique_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"]};function dc(t,e,i){return e*=i,Math.tan(.5*(lh+t))*Math.pow((1-e)/(1+e),.5*i)}const fc={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)<=hh&&(this.k0=.5*(1+Xh(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=hh&&(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)<=hh&&Math.abs(Math.cos(this.lat_ts))>hh&&(this.k0=.5*this.cons*Wh(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Kh(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=Wh(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(dc(this.lat0,this.sinlat0,this.e))-lh,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))},forward:function(t){var e,i,n,r,s,o,a=t.x,l=t.y,h=Math.sin(l),u=Math.cos(l),c=Vh(a-this.long0,this.over);return Math.abs(Math.abs(a-this.long0)-Math.PI)<=hh&&Math.abs(l+this.lat0)<=hh?(t.x=NaN,t.y=NaN,t):this.sphere?(e=2*this.k0/(1+this.sinlat0*h+this.coslat0*u*Math.cos(c)),t.x=this.a*e*u*Math.sin(c)+this.x0,t.y=this.a*e*(this.coslat0*h-this.sinlat0*u*Math.cos(c))+this.y0,t):(i=2*Math.atan(dc(l,h,this.e))-lh,r=Math.cos(i),n=Math.sin(i),Math.abs(this.coslat0)<=hh?(s=Kh(this.e,l*this.con,this.con*h),o=2*this.a*this.k0*s/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)<hh?(e=2*this.a*this.k0/(1+r*Math.cos(c)),t.y=e*n):(e=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*n+this.cosX0*r*Math.cos(c))),t.y=e*(this.cosX0*n-this.sinX0*r*Math.cos(c))+this.y0),t.x=e*r*Math.sin(c)+this.x0,t))},inverse:function(t){var e,i,n,r,s;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<=hh?(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)<hh?this.lat0>0?Vh(this.long0+Math.atan2(t.x,-1*t.y),this.over):Vh(this.long0+Math.atan2(t.x,t.y),this.over):Vh(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)<=hh){if(o<=hh)return i=this.lat0,e=this.long0,t.x=e,t.y=i,t;t.x*=this.con,t.y*=this.con,n=o*this.cons/(2*this.a*this.k0),i=this.con*Zh(this.e,n),e=this.con*Vh(this.con*this.long0+Math.atan2(t.x,-1*t.y),this.over)}else r=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,o<=hh?s=this.X0:(s=Math.asin(Math.cos(r)*this.sinX0+t.y*Math.sin(r)*this.cosX0/o),e=Vh(this.long0+Math.atan2(t.x*Math.sin(r),o*this.cosX0*Math.cos(r)-t.y*this.sinX0*Math.sin(r)),this.over)),i=-1*Zh(this.e,Math.tan(.5*(lh+s)));return t.x=e,t.y=i,t},names:["stere","Stereographic_South_Pole","Polar_Stereographic_variant_A","Polar_Stereographic_variant_B","Polar_Stereographic"],ssfn_:dc},pc={init:function(){var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),i=this.a,n=1/this.rf,r=2*n-Math.pow(n,2),s=this.e=Math.sqrt(r);this.R=this.k0*i*Math.sqrt(1-r)/(1-r*Math.pow(e,2)),this.alpha=Math.sqrt(1+r/(1-r)*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)),l=Math.log((1+s*e)/(1-s*e));this.K=o-this.alpha*a+this.alpha*s/2*l},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))),n=-this.alpha*(e+i)+this.K,r=2*(Math.atan(Math.exp(n))-Math.PI/4),s=this.alpha*(t.x-this.lambda0),o=Math.atan(Math.sin(s)/(Math.sin(this.b0)*Math.tan(r)+Math.cos(this.b0)*Math.cos(s))),a=Math.asin(Math.cos(this.b0)*Math.sin(r)-Math.sin(this.b0)*Math.cos(r)*Math.cos(s));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,n=e/this.R,r=2*(Math.atan(Math.exp(i/this.R))-Math.PI/4),s=Math.asin(Math.cos(this.b0)*Math.sin(r)+Math.sin(this.b0)*Math.cos(r)*Math.cos(n)),o=Math.atan(Math.sin(n)/(Math.cos(this.b0)*Math.cos(n)-Math.sin(this.b0)*Math.tan(r))),a=this.lambda0+o/this.alpha,l=0,h=s,u=-1e3,c=0;Math.abs(h-u)>1e-7;){if(++c>20)return;l=1/this.alpha*(Math.log(Math.tan(Math.PI/4+s/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(h))/2)),u=h,h=2*Math.atan(Math.exp(l))-Math.PI/2}return t.x=a,t.y=h,t},names:["somerc"]};var gc=1e-7;const mc={init:function(){var t,e,i,n,r,s,o,a,l,h,u,c,d,f,p=0,g=0,m=0,y=0,_=0,v=0,x=0;this.no_off=(d=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],f="object"==typeof(c=this).projName?Object.keys(c.projName)[0]:c.projName,"no_uoff"in c||"no_off"in c||-1!==d.indexOf(f)||-1!==d.indexOf(iu(f))),this.no_rot="no_rot"in this;var w=!1;"alpha"in this&&(w=!0);var b=!1;if("rectified_grid_angle"in this&&(b=!0),w&&(x=this.alpha),b&&(p=this.rectified_grid_angle),w||b)g=this.longc;else if(m=this.long1,_=this.lat1,y=this.long2,v=this.lat2,Math.abs(_-v)<=gc||(t=Math.abs(_))<=gc||Math.abs(t-lh)<=gc||Math.abs(Math.abs(this.lat0)-lh)<=gc||Math.abs(Math.abs(v)-lh)<=gc)throw new Error;var S=1-this.es;e=Math.sqrt(S),Math.abs(this.lat0)>hh?(a=Math.sin(this.lat0),i=Math.cos(this.lat0),t=1-this.es*a*a,this.B=i*i,this.B=Math.sqrt(1+this.es*this.B*this.B/S),this.A=this.B*this.k0*e/t,(r=(n=this.B*e/(i*Math.sqrt(t)))*n-1)<=0?r=0:(r=Math.sqrt(r),this.lat0<0&&(r=-r)),this.E=r+=n,this.E*=Math.pow(Kh(this.e,this.lat0,a),this.B)):(this.B=1/e,this.A=this.k0,this.E=n=r=1),w||b?(w?(u=Math.asin(Math.sin(x)/n),b||(p=x)):(u=p,x=Math.asin(n*Math.sin(u))),this.lam0=g-Math.asin(.5*(r-1/r)*Math.tan(u))/this.B):(s=Math.pow(Kh(this.e,_,Math.sin(_)),this.B),o=Math.pow(Kh(this.e,v,Math.sin(v)),this.B),r=this.E/s,l=(o-s)/(o+s),h=((h=this.E*this.E)-o*s)/(h+o*s),(t=m-y)<-Math.PI?y-=fh:t>Math.PI&&(y+=fh),this.lam0=Vh(.5*(m+y)-Math.atan(h*Math.tan(.5*this.B*(m-y))/l)/this.B,this.over),u=Math.atan(2*Math.sin(this.B*Vh(m-this.lam0,this.over))/(r-1/r)),p=x=Math.asin(n*Math.sin(u))),this.singam=Math.sin(u),this.cosgam=Math.cos(u),this.sinrot=Math.sin(p),this.cosrot=Math.cos(p),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(n*n-1)/Math.cos(x))),this.lat0<0&&(this.u_0=-this.u_0)),r=.5*u,this.v_pole_n=this.ArB*Math.log(Math.tan(dh-r)),this.v_pole_s=this.ArB*Math.log(Math.tan(dh+r))},forward:function(t){var e,i,n,r,s,o,a,l,h={};if(t.x=t.x-this.lam0,Math.abs(Math.abs(t.y)-lh)>hh){if(e=.5*((s=this.E/Math.pow(Kh(this.e,t.y,Math.sin(t.y)),this.B))-(o=1/s)),i=.5*(s+o),r=Math.sin(this.B*t.x),n=(e*this.singam-r*this.cosgam)/i,Math.abs(Math.abs(n)-1)<hh)throw new Error;l=.5*this.ArB*Math.log((1-n)/(1+n)),o=Math.cos(this.B*t.x),a=Math.abs(o)<gc?this.A*t.x:this.ArB*Math.atan2(e*this.cosgam+r*this.singam,o)}else l=t.y>0?this.v_pole_n:this.v_pole_s,a=this.ArB*t.y;return this.no_rot?(h.x=a,h.y=l):(a-=this.u_0,h.x=l*this.cosrot+a*this.sinrot,h.y=a*this.cosrot-l*this.sinrot),h.x=this.a*h.x+this.x0,h.y=this.a*h.y+this.y0,h},inverse:function(t){var e,i,n,r,s,o,a,l={};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),r=.5*((n=Math.exp(-this.BrA*i))-1/n),s=.5*(n+1/n),a=((o=Math.sin(this.BrA*e))*this.cosgam+r*this.singam)/s,Math.abs(Math.abs(a)-1)<hh)l.x=0,l.y=a<0?-lh:lh;else{if(l.y=this.E/Math.sqrt((1+a)/(1-a)),l.y=Zh(this.e,Math.pow(l.y,1/this.B)),l.y===1/0)throw new Error;l.x=-this.rB*Math.atan2(r*this.cosgam-o*this.singam,Math.cos(this.BrA*e))}return l.x+=this.lam0,l},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"]},yc={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)<hh)){var t=this.b/this.a;this.e=Math.sqrt(1-t*t);var e=Math.sin(this.lat1),i=Math.cos(this.lat1),n=Wh(this.e,e,i),r=Kh(this.e,this.lat1,e),s=Math.sin(this.lat2),o=Math.cos(this.lat2),a=Wh(this.e,s,o),l=Kh(this.e,this.lat2,s),h=Math.abs(Math.abs(this.lat0)-lh)<hh?0:Kh(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>hh?this.ns=Math.log(n/a)/Math.log(r/l):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=n/(this.ns*Math.pow(r,this.ns)),this.rh=this.a*this.f0*Math.pow(h,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)<=hh&&(i=Xh(i)*(lh-2e-10));var n,r,s=Math.abs(Math.abs(i)-lh);if(s>hh)n=Kh(this.e,i,Math.sin(i)),r=this.a*this.f0*Math.pow(n,this.ns);else{if((s=i*this.ns)<=0)return null;r=0}var o=this.ns*Vh(e-this.long0,this.over);return t.x=this.k0*(r*Math.sin(o))+this.x0,t.y=this.k0*(this.rh-r*Math.cos(o))+this.y0,t},inverse:function(t){var e,i,n,r,s,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 l=0;if(0!==e&&(l=Math.atan2(i*o,i*a)),0!==e||this.ns>0){if(i=1/this.ns,n=Math.pow(e/(this.a*this.f0),i),-9999===(r=Zh(this.e,n)))return null}else r=-lh;return s=Vh(l/this.ns+this.long0,this.over),t.x=s,t.y=r,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)"]},_c={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,n,r,s,o,a,l=t.x,h=t.y,u=Vh(l-this.long0,this.over);return e=Math.pow((1+this.e*Math.sin(h))/(1-this.e*Math.sin(h)),this.alfa*this.e/2),i=2*(Math.atan(this.k*Math.pow(Math.tan(h/2+this.s45),this.alfa)/e)-this.s45),n=-u*this.alfa,r=Math.asin(Math.cos(this.ad)*Math.sin(i)+Math.sin(this.ad)*Math.cos(i)*Math.cos(n)),s=Math.asin(Math.cos(i)*Math.sin(n)/Math.cos(r)),o=this.n*s,a=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(r/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,n,r,s,o,a,l=t.x;t.x=t.y,t.y=l,this.czech||(t.y*=-1,t.x*=-1),s=Math.sqrt(t.x*t.x+t.y*t.y),r=Math.atan2(t.y,t.x)/Math.sin(this.s0),n=2*(Math.atan(Math.pow(this.ro0/s,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(n)-Math.sin(this.ad)*Math.cos(n)*Math.cos(r)),i=Math.asin(Math.cos(n)*Math.sin(r)/Math.cos(e)),t.x=this.long0-i/this.alfa,o=e,a=0;var h=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,h+=1}while(0===a&&h<15);return h>=15?null:t},names:["Krovak","Krovak Modified","Krovak (North Orientated)","Krovak Modified (North Orientated)","krovak"]};function vc(t,e,i,n,r){return t*r-e*Math.sin(2*r)+i*Math.sin(4*r)-n*Math.sin(6*r)}function xc(t){return 1-.25*t*(1+t/16*(3+1.25*t))}function wc(t){return.375*t*(1+.25*t*(1+.46875*t))}function bc(t){return.05859375*t*t*(1+.75*t)}function Sc(t){return t*t*t*(35/3072)}function Mc(t,e,i){var n=e*i;return t/Math.sqrt(1-n*n)}function Ec(t){return Math.abs(t)<lh?t:t-Xh(t)*Math.PI}function Cc(t,e,i,n,r){var s,o;s=t/e;for(var a=0;a<15;a++)if(s+=o=(t-(e*s-i*Math.sin(2*s)+n*Math.sin(4*s)-r*Math.sin(6*s)))/(e-2*i*Math.cos(2*s)+4*n*Math.cos(4*s)-6*r*Math.cos(6*s)),Math.abs(o)<=1e-10)return s;return NaN}const Pc={init:function(){this.sphere||(this.e0=xc(this.es),this.e1=wc(this.es),this.e2=bc(this.es),this.e3=Sc(this.es),this.ml0=this.a*vc(this.e0,this.e1,this.e2,this.e3,this.lat0))},forward:function(t){var e,i,n=t.x,r=t.y;if(n=Vh(n-this.long0,this.over),this.sphere)e=this.a*Math.asin(Math.cos(r)*Math.sin(n)),i=this.a*(Math.atan2(Math.tan(r),Math.cos(n))-this.lat0);else{var s=Math.sin(r),o=Math.cos(r),a=Mc(this.a,this.e,s),l=Math.tan(r)*Math.tan(r),h=n*Math.cos(r),u=h*h,c=this.es*o*o/(1-this.es);e=a*h*(1-u*l*(1/6-(8-l+8*c)*u/120)),i=this.a*vc(this.e0,this.e1,this.e2,this.e3,r)-this.ml0+a*s/o*u*(.5+(5-l+6*c)*u/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,n=t.x/this.a,r=t.y/this.a;if(this.sphere){var s=r+this.lat0;e=Math.asin(Math.sin(s)*Math.cos(n)),i=Math.atan2(Math.tan(n),Math.cos(s))}else{var o=Cc(this.ml0/this.a+r,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(o)-lh)<=hh)return t.x=this.long0,t.y=lh,r<0&&(t.y*=-1),t;var a=Mc(this.a,this.e,Math.sin(o)),l=a*a*a/this.a/this.a*(1-this.es),h=Math.pow(Math.tan(o),2),u=n*this.a/a,c=u*u;e=o-a*Math.tan(o)/l*u*u*(.5-(1+3*h)*u*u/24),i=u*(1-c*(h/3+(1+3*h)*h*c/15))/Math.cos(o)}return t.x=Vh(i+this.long0,this.over),t.y=Ec(e),t},names:["Cassini","Cassini_Soldner","cass"]};function Ic(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 Tc={init:function(){var t,e=Math.abs(this.lat0);if(Math.abs(e-lh)<hh?this.mode=this.lat0<0?1:2:Math.abs(e)<hh?this.mode=3:this.mode=4,this.es>0)switch(this.qp=Ic(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=Ic(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,n,r,s,o,a,l,h,u,c=t.x,d=t.y;if(c=Vh(c-this.long0,this.over),this.sphere){if(s=Math.sin(d),u=Math.cos(d),n=Math.cos(c),this.mode===this.OBLIQ||this.mode===this.EQUIT){if((i=this.mode===this.EQUIT?1+u*n:1+this.sinph0*s+this.cosph0*u*n)<=hh)return null;e=(i=Math.sqrt(2/i))*u*Math.sin(c),i*=this.mode===this.EQUIT?s:this.cosph0*s-this.sinph0*u*n}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(n=-n),Math.abs(d+this.lat0)<hh)return null;i=dh-.5*d,e=(i=2*(this.mode===this.S_POLE?Math.cos(i):Math.sin(i)))*Math.sin(c),i*=n}}else{switch(a=0,l=0,h=0,n=Math.cos(c),r=Math.sin(c),s=Math.sin(d),o=Ic(this.e,s),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(a=o/this.qp,l=Math.sqrt(1-a*a)),this.mode){case this.OBLIQ:h=1+this.sinb1*a+this.cosb1*l*n;break;case this.EQUIT:h=1+l*n;break;case this.N_POLE:h=lh+d,o=this.qp-o;break;case this.S_POLE:h=d-lh,o=this.qp+o}if(Math.abs(h)<hh)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:h=Math.sqrt(2/h),i=this.mode===this.OBLIQ?this.ymf*h*(this.cosb1*a-this.sinb1*l*n):(h=Math.sqrt(2/(1+l*n)))*a*this.ymf,e=this.xmf*h*l*r;break;case this.N_POLE:case this.S_POLE:o>=0?(e=(h=Math.sqrt(o))*r,i=n*(this.mode===this.S_POLE?h:-h)):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,n,r,s,o,a,l,h,u,c=t.x/this.a,d=t.y/this.a;if(this.sphere){var f,p=0,g=0;if((i=.5*(f=Math.sqrt(c*c+d*d)))>1)return null;switch(i=2*Math.asin(i),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(g=Math.sin(i),p=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(f)<=hh?0:Math.asin(d*g/f),c*=g,d=p*f;break;case this.OBLIQ:i=Math.abs(f)<=hh?this.lat0:Math.asin(p*this.sinph0+d*g*this.cosph0/f),c*=g*this.cosph0,d=(p-Math.sin(i)*this.sinph0)*f;break;case this.N_POLE:d=-d,i=lh-i;break;case this.S_POLE:i-=lh}e=0!==d||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(c,d):0}else{if(a=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(c/=this.dd,d*=this.dd,(o=Math.sqrt(c*c+d*d))<hh)return t.x=this.long0,t.y=this.lat0,t;r=2*Math.asin(.5*o/this.rq),n=Math.cos(r),c*=r=Math.sin(r),this.mode===this.OBLIQ?(a=n*this.sinb1+d*r*this.cosb1/o,s=this.qp*a,d=o*this.cosb1*n-d*this.sinb1*r):(a=d*r/o,s=this.qp*a,d=o*n)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(d=-d),!(s=c*c+d*d))return t.x=this.long0,t.y=this.lat0,t;a=1-s/this.qp,this.mode===this.S_POLE&&(a=-a)}e=Math.atan2(c,d),u=(l=Math.asin(a))+l,i=l+(h=this.apa)[0]*Math.sin(u)+h[1]*Math.sin(u+u)+h[2]*Math.sin(u+u+u)}return t.x=Vh(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 kc(t){return Math.abs(t)>1&&(t=t>1?1:-1),Math.asin(t)}const Rc={init:function(){Math.abs(this.lat1+this.lat2)<hh||(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=Wh(this.e3,this.sin_po,this.cos_po),this.qs1=Ic(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=Wh(this.e3,this.sin_po,this.cos_po),this.qs2=Ic(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=Ic(this.e3,this.sin_po),Math.abs(this.lat1-this.lat2)>hh?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 n=Ic(this.e3,this.sin_phi),r=this.a*Math.sqrt(this.c-this.ns0*n)/this.ns0,s=this.ns0*Vh(e-this.long0,this.over),o=r*Math.sin(s)+this.x0,a=this.rh-r*Math.cos(s)+this.y0;return t.x=o,t.y=a,t},inverse:function(t){var e,i,n,r,s,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),n=1):(e=-Math.sqrt(t.x*t.x+t.y*t.y),n=-1),r=0,0!==e&&(r=Math.atan2(n*t.x,n*t.y)),n=e*this.ns0/this.a,this.sphere?o=Math.asin((this.c-n*n)/(2*this.ns0)):(i=(this.c-n*n)/this.ns0,o=this.phi1z(this.e3,i)),s=Vh(r/this.ns0+this.long0,this.over),t.x=s,t.y=o,t},names:["Albers_Conic_Equal_Area","Albers_Equal_Area","Albers","aea"],phi1z:function(t,e){var i,n,r,s,o=kc(.5*e);if(t<hh)return o;for(var a=t*t,l=1;l<=25;l++)if(o+=s=.5*(r=1-(n=t*(i=Math.sin(o)))*n)*r/Math.cos(o)*(e/(1-a)-i/r+.5/t*Math.log((1-n)/(1+n))),Math.abs(s)<=1e-7)return o;return null}},Ac={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,n,r,s,o,a,l=t.x,h=t.y;return n=Vh(l-this.long0,this.over),e=Math.sin(h),i=Math.cos(h),r=Math.cos(n),(s=this.sin_p14*e+this.cos_p14*i*r)>0||Math.abs(s)<=hh?(o=this.x0+1*this.a*i*Math.sin(n)/s,a=this.y0+1*this.a*(this.cos_p14*e-this.sin_p14*i*r)/s):(o=this.x0+this.infinity_dist*i*Math.sin(n),a=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*i*r)),t.x=o,t.y=a,t},inverse:function(t){var e,i,n,r,s,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))?(r=Math.atan2(e,this.rc),i=Math.sin(r),o=kc((n=Math.cos(r))*this.sin_p14+t.y*i*this.cos_p14/e),s=Math.atan2(t.x*i,e*this.cos_p14*n-t.y*this.sin_p14*i),s=Vh(this.long0+s,this.over)):(o=this.phic0,s=0),t.x=s,t.y=o,t},names:["gnom"]},Oc={init:function(){this.sphere||(this.k0=Wh(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))},forward:function(t){var e,i,n=t.x,r=t.y,s=Vh(n-this.long0,this.over);if(this.sphere)e=this.x0+this.a*s*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(r)/Math.cos(this.lat_ts);else{var o=Ic(this.e,Math.sin(r));e=this.x0+this.a*this.k0*s,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=Vh(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*lh:lh;for(var n,r,s,o,a=Math.asin(.5*e),l=0;l<30;l++)if(r=Math.sin(a),s=Math.cos(a),o=t*r,a+=n=Math.pow(1-o*o,2)/(2*s)*(e/(1-t*t)-r/(1-o*o)+.5/t*Math.log((1-o)/(1+o))),Math.abs(n)<=1e-10)return a;return NaN}(this.e,2*t.y*this.k0/this.a),e=Vh(this.long0+t.x/(this.a*this.k0),this.over)),t.x=e,t.y=i,t},names:["cea"]},Gc={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,n=Vh(e-this.long0,this.over),r=Ec(i-this.lat0);return t.x=this.x0+this.a*n*this.rc,t.y=this.y0+this.a*r,t},inverse:function(t){var e=t.x,i=t.y;return t.x=Vh(this.long0+(e-this.x0)/(this.a*this.rc),this.over),t.y=Ec(this.lat0+(i-this.y0)/this.a),t},names:["Equirectangular","Equidistant_Cylindrical","Equidistant_Cylindrical_Spherical","eqc"]},Fc={init:function(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=xc(this.es),this.e1=wc(this.es),this.e2=bc(this.es),this.e3=Sc(this.es),this.ml0=this.a*vc(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(t){var e,i,n,r=t.x,s=t.y,o=Vh(r-this.long0,this.over);if(n=o*Math.sin(s),this.sphere)Math.abs(s)<=hh?(e=this.a*o,i=-1*this.a*this.lat0):(e=this.a*Math.sin(n)/Math.tan(s),i=this.a*(Ec(s-this.lat0)+(1-Math.cos(n))/Math.tan(s)));else if(Math.abs(s)<=hh)e=this.a*o,i=-1*this.ml0;else{var a=Mc(this.a,this.e,Math.sin(s))/Math.tan(s);e=a*Math.sin(n),i=this.a*vc(this.e0,this.e1,this.e2,this.e3,s)-this.ml0+a*(1-Math.cos(n))}return t.x=e+this.x0,t.y=i+this.y0,t},inverse:function(t){var e,i,n,r,s,o,a,l,h;if(n=t.x-this.x0,r=t.y-this.y0,this.sphere)if(Math.abs(r+this.a*this.lat0)<=hh)e=Vh(n/this.a+this.long0,this.over),i=0;else{var u;for(o=this.lat0+r/this.a,a=n*n/this.a/this.a+o*o,l=o,s=20;s;--s)if(l+=h=-1*(o*(l*(u=Math.tan(l))+1)-l-.5*(l*l+a)*u)/((l-o)/u-1),Math.abs(h)<=hh){i=l;break}e=Vh(this.long0+Math.asin(n*Math.tan(l)/this.a)/Math.sin(i),this.over)}else if(Math.abs(r+this.ml0)<=hh)i=0,e=Vh(this.long0+n/this.a,this.over);else{var c,d,f,p,g;for(o=(this.ml0+r)/this.a,a=n*n/this.a/this.a+o*o,l=o,s=20;s;--s)if(g=this.e*Math.sin(l),c=Math.sqrt(1-g*g)*Math.tan(l),d=this.a*vc(this.e0,this.e1,this.e2,this.e3,l),f=this.e0-2*this.e1*Math.cos(2*l)+4*this.e2*Math.cos(4*l)-6*this.e3*Math.cos(6*l),l-=h=(o*(c*(p=d/this.a)+1)-p-.5*c*(p*p+a))/(this.es*Math.sin(2*l)*(p*p+a-2*o*p)/(4*c)+(o-p)*(c*f-2/Math.sin(2*l))-f),Math.abs(h)<=hh){i=l;break}c=Math.sqrt(1-this.es*Math.pow(Math.sin(i),2))*Math.tan(i),e=Vh(this.long0+Math.asin(n*c/this.a)/Math.sin(i),this.over)}return t.x=e,t.y=i,t},names:["Polyconic","American_Polyconic","poly"]},Lc={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,n=t.y-this.lat0,r=i-this.long0,s=n/ah*1e-5,o=r,a=1,l=0;for(e=1;e<=10;e++)a*=s,l+=this.A[e]*a;var h,u=l,c=o,d=1,f=0,p=0,g=0;for(e=1;e<=6;e++)h=f*u+d*c,d=d*u-f*c,f=h,p=p+this.B_re[e]*d-this.B_im[e]*f,g=g+this.B_im[e]*d+this.B_re[e]*f;return t.x=g*this.a+this.x0,t.y=p*this.a+this.y0,t},inverse:function(t){var e,i,n=t.x,r=t.y,s=n-this.x0,o=(r-this.y0)/this.a,a=s/this.a,l=1,h=0,u=0,c=0;for(e=1;e<=6;e++)i=h*o+l*a,l=l*o-h*a,h=i,u=u+this.C_re[e]*l-this.C_im[e]*h,c=c+this.C_im[e]*l+this.C_re[e]*h;for(var d=0;d<this.iterations;d++){var f,p=u,g=c,m=o,y=a;for(e=2;e<=6;e++)f=g*u+p*c,p=p*u-g*c,g=f,m+=(e-1)*(this.B_re[e]*p-this.B_im[e]*g),y+=(e-1)*(this.B_im[e]*p+this.B_re[e]*g);p=1,g=0;var _=this.B_re[1],v=this.B_im[1];for(e=2;e<=6;e++)f=g*u+p*c,p=p*u-g*c,g=f,_+=e*(this.B_re[e]*p-this.B_im[e]*g),v+=e*(this.B_im[e]*p+this.B_re[e]*g);var x=_*_+v*v;u=(m*_+y*v)/x,c=(y*_-m*v)/x}var w=u,b=c,S=1,M=0;for(e=1;e<=9;e++)S*=w,M+=this.D[e]*S;var E=this.lat0+M*ah*1e5,C=this.long0+b;return t.x=C,t.y=E,t},names:["New_Zealand_Map_Grid","nzmg"]},jc={init:function(){},forward:function(t){var e=t.x,i=t.y,n=Vh(e-this.long0,this.over),r=this.x0+this.a*n,s=this.y0+this.a*Math.log(Math.tan(Math.PI/4+i/2.5))*1.25;return t.x=r,t.y=s,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e=Vh(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"]},Nc={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=Qu(this.es)},forward:function(t){var e,i,n=t.x,r=t.y;if(n=Vh(n-this.long0,this.over),this.sphere){if(this.m)for(var s=this.n*Math.sin(r),o=20;o;--o){var a=(this.m*r+Math.sin(r)-s)/(this.m+Math.cos(r));if(r-=a,Math.abs(a)<hh)break}else r=1!==this.n?Math.asin(this.n*Math.sin(r)):r;e=this.a*this.C_x*n*(this.m+Math.cos(r)),i=this.a*this.C_y*r}else{var l=Math.sin(r),h=Math.cos(r);i=this.a*tc(r,l,h,this.en),e=this.a*n*h/Math.sqrt(1-this.es*l*l)}return t.x=e,t.y=i,t},inverse:function(t){var e,i,n;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=kc((this.m*e+Math.sin(e))/this.n):1!==this.n&&(e=kc(Math.sin(e)/this.n)),i=Vh(i+this.long0,this.over),e=Ec(e)):(e=ec(t.y/this.a,this.es,this.en),(n=Math.abs(e))<lh?(n=Math.sin(e),i=Vh(this.long0+t.x*Math.sqrt(1-this.es*n*n)/(this.a*Math.cos(e)),this.over)):n-hh<lh&&(i=this.long0)),t.x=i,t.y=e,t},names:["Sinusoidal","sinu"]},Dc={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,n=Vh(e-this.long0,this.over),r=i,s=Math.PI*Math.sin(i);;){var o=-(r+Math.sin(r)-s)/(1+Math.cos(r));if(r+=o,Math.abs(o)<hh)break}r/=2,Math.PI/2-Math.abs(i)<hh&&(n=0);var a=.900316316158*this.a*n*Math.cos(r)+this.x0,l=1.4142135623731*this.a*Math.sin(r)+this.y0;return t.x=a,t.y=l,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 n=Vh(this.long0+t.x/(.900316316158*this.a*Math.cos(e)),this.over);n<-Math.PI&&(n=-Math.PI),n>Math.PI&&(n=Math.PI),i=(2*e+Math.sin(2*e))/Math.PI,Math.abs(i)>1&&(i=1);var r=Math.asin(i);return t.x=n,t.y=r,t},names:["Mollweide","moll"]},zc={init:function(){Math.abs(this.lat1+this.lat2)<hh||(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=xc(this.es),this.e1=wc(this.es),this.e2=bc(this.es),this.e3=Sc(this.es),this.sin_phi=Math.sin(this.lat1),this.cos_phi=Math.cos(this.lat1),this.ms1=Wh(this.e,this.sin_phi,this.cos_phi),this.ml1=vc(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<hh?this.ns=this.sin_phi:(this.sin_phi=Math.sin(this.lat2),this.cos_phi=Math.cos(this.lat2),this.ms2=Wh(this.e,this.sin_phi,this.cos_phi),this.ml2=vc(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=vc(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,n=t.y;if(this.sphere)e=this.a*(this.g-n);else{var r=vc(this.e0,this.e1,this.e2,this.e3,n);e=this.a*(this.g-r)}var s=this.ns*Vh(i-this.long0,this.over),o=this.x0+e*Math.sin(s),a=this.y0+this.rh-e*Math.cos(s);return t.x=o,t.y=a,t},inverse:function(t){var e,i,n,r;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 s=0;return 0!==i&&(s=Math.atan2(e*t.x,e*t.y)),this.sphere?(r=Vh(this.long0+s/this.ns,this.over),n=Ec(this.g-i/this.a),t.x=r,t.y=n,t):(n=Cc(this.g-i/this.a,this.e0,this.e1,this.e2,this.e3),r=Vh(this.long0+s/this.ns,this.over),t.x=r,t.y=n,t)},names:["Equidistant_Conic","eqdc"]},qc={init:function(){this.R=this.a},forward:function(t){var e,i,n=t.x,r=t.y,s=Vh(n-this.long0,this.over);Math.abs(r)<=hh&&(e=this.x0+this.R*s,i=this.y0);var o=kc(2*Math.abs(r/Math.PI));(Math.abs(s)<=hh||Math.abs(Math.abs(r)-lh)<=hh)&&(e=this.x0,i=r>=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/s-s/Math.PI),l=a*a,h=Math.sin(o),u=Math.cos(o),c=u/(h+u-1),d=c*c,f=c*(2/h-1),p=f*f,g=Math.PI*this.R*(a*(c-p)+Math.sqrt(l*(c-p)*(c-p)-(p+l)*(d-p)))/(p+l);s<0&&(g=-g),e=this.x0+g;var m=l+c;return g=Math.PI*this.R*(f*m-a*Math.sqrt((p+l)*(l+1)-m*m))/(p+l),i=r>=0?this.y0+g:this.y0-g,t.x=e,t.y=i,t},inverse:function(t){var e,i,n,r,s,o,a,l,h,u,c,d;return t.x-=this.x0,t.y-=this.y0,c=Math.PI*this.R,s=(n=t.x/c)*n+(r=t.y/c)*r,c=3*(r*r/(l=-2*(o=-Math.abs(r)*(1+s))+1+2*r*r+s*s)+(2*(a=o-2*r*r+n*n)*a*a/l/l/l-9*o*a/l/l)/27)/(h=(o-a*a/3/l)/l)/(u=2*Math.sqrt(-h/3)),Math.abs(c)>1&&(c=c>=0?1:-1),d=Math.acos(c)/3,i=t.y>=0?(-u*Math.cos(d+Math.PI/3)-a/3/l)*Math.PI:-(-u*Math.cos(d+Math.PI/3)-a/3/l)*Math.PI,e=Math.abs(n)<hh?this.long0:Vh(this.long0+Math.PI*(s-1+Math.sqrt(1+2*(n*n-r*r)+s*s))/2/n,this.over),t.x=e,t.y=i,t},names:["Van_der_Grinten_I","VanDerGrinten","Van_der_Grinten","vandg"]},Bc={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,n,r,s,o,a,l,h,u,c,d=t.x,f=t.y,p=Math.sin(t.y),g=Math.cos(t.y),m=Vh(d-this.long0,this.over);return this.sphere?Math.abs(this.sin_p12-1)<=hh?(t.x=this.x0+this.a*(lh-f)*Math.sin(m),t.y=this.y0-this.a*(lh-f)*Math.cos(m),t):Math.abs(this.sin_p12+1)<=hh?(t.x=this.x0+this.a*(lh+f)*Math.sin(m),t.y=this.y0+this.a*(lh+f)*Math.cos(m),t):(h=this.sin_p12*p+this.cos_p12*g*Math.cos(m),l=(a=Math.acos(h))?a/Math.sin(a):1,t.x=this.x0+this.a*l*g*Math.sin(m),t.y=this.y0+this.a*l*(this.cos_p12*p-this.sin_p12*g*Math.cos(m)),t):(e=xc(this.es),i=wc(this.es),n=bc(this.es),r=Sc(this.es),Math.abs(this.sin_p12-1)<=hh?(s=this.a*vc(e,i,n,r,lh),o=this.a*vc(e,i,n,r,f),t.x=this.x0+(s-o)*Math.sin(m),t.y=this.y0-(s-o)*Math.cos(m),t):Math.abs(this.sin_p12+1)<=hh?(s=this.a*vc(e,i,n,r,lh),o=this.a*vc(e,i,n,r,f),t.x=this.x0+(s+o)*Math.sin(m),t.y=this.y0+(s+o)*Math.cos(m),t):Math.abs(d)<hh&&Math.abs(f-this.lat0)<hh?(t.x=t.y=0,t):(u=function(t,e,i,n,r,s){const o=n-e,a=Math.atan((1-s)*Math.tan(t)),l=Math.atan((1-s)*Math.tan(i)),h=Math.sin(a),u=Math.cos(a),c=Math.sin(l),d=Math.cos(l);let f,p,g,m,y,_,v,x,w,b,S,M,E,C,P,I=o,T=100;do{if(p=Math.sin(I),g=Math.cos(I),m=Math.sqrt(d*p*(d*p)+(u*c-h*d*g)*(u*c-h*d*g)),0===m)return{azi1:0,s12:0};y=h*c+u*d*g,_=Math.atan2(m,y),v=u*d*p/m,x=1-v*v,w=0!==x?y-2*h*c/x:0,b=s/16*x*(4+s*(4-3*x)),f=I,I=o+(1-b)*s*v*(_+b*m*(w+b*y*(2*w*w-1)))}while(Math.abs(I-f)>1e-12&&--T>0);return 0===T?{azi1:NaN,s12:NaN}:(S=x*(r*r-r*(1-s)*(r*(1-s)))/(r*(1-s)*(r*(1-s))),M=1+S/16384*(4096+S*(S*(320-175*S)-768)),E=S/1024*(256+S*(S*(74-47*S)-128)),C=E*m*(w+E/4*(y*(2*w*w-1)-E/6*w*(4*m*m-3)*(4*w*w-3))),P=r*(1-s)*M*(_-C),{azi1:Math.atan2(d*p,u*c-h*d*g),s12:P})}(this.lat0,this.long0,f,d,this.a,this.f),c=u.azi1,t.x=u.s12*Math.sin(c),t.y=u.s12*Math.cos(c),t))},inverse:function(t){var e,i,n,r,s,o,a,l,h,u,c,d,f,p,g;if(t.x-=this.x0,t.y-=this.y0,this.sphere){if((e=Math.sqrt(t.x*t.x+t.y*t.y))>2*lh*this.a)return;return i=e/this.a,n=Math.sin(i),r=Math.cos(i),s=this.long0,Math.abs(e)<=hh?o=this.lat0:(o=kc(r*this.sin_p12+t.y*n*this.cos_p12/e),a=Math.abs(this.lat0)-lh,s=Math.abs(a)<=hh?this.lat0>=0?Vh(this.long0+Math.atan2(t.x,-t.y),this.over):Vh(this.long0-Math.atan2(-t.x,t.y),this.over):Vh(this.long0+Math.atan2(t.x*n,e*this.cos_p12*r-t.y*this.sin_p12*n),this.over)),t.x=s,t.y=o,t}return l=xc(this.es),h=wc(this.es),u=bc(this.es),c=Sc(this.es),Math.abs(this.sin_p12-1)<=hh?(o=Cc(((d=this.a*vc(l,h,u,c,lh))-(e=Math.sqrt(t.x*t.x+t.y*t.y)))/this.a,l,h,u,c),s=Vh(this.long0+Math.atan2(t.x,-1*t.y),this.over),t.x=s,t.y=o,t):Math.abs(this.sin_p12+1)<=hh?(d=this.a*vc(l,h,u,c,lh),o=Cc(((e=Math.sqrt(t.x*t.x+t.y*t.y))-d)/this.a,l,h,u,c),s=Vh(this.long0+Math.atan2(t.x,t.y),this.over),t.x=s,t.y=o,t):(f=Math.atan2(t.x,t.y),p=Math.sqrt(t.x*t.x+t.y*t.y),g=function(t,e,i,n,r,s){const o=Math.atan((1-s)*Math.tan(t)),a=Math.sin(o),l=Math.cos(o),h=Math.sin(i),u=Math.cos(i),c=Math.atan2(a,l*u),d=l*h,f=1-d*d,p=f*(r*r-r*(1-s)*(r*(1-s)))/(r*(1-s)*(r*(1-s))),g=1+p/16384*(4096+p*(p*(320-175*p)-768)),m=p/1024*(256+p*(p*(74-47*p)-128));let y,_,v,x,w,b=n/(r*(1-s)*g),S=100;do{_=Math.cos(2*c+b),v=Math.sin(b),x=Math.cos(b),w=m*v*(_+m/4*(x*(2*_*_-1)-m/6*_*(4*v*v-3)*(4*_*_-3))),y=b,b=n/(r*(1-s)*g)+w}while(Math.abs(b-y)>1e-12&&--S>0);if(0===S)return{lat2:NaN,lon2:NaN};const M=a*v-l*x*u,E=s/16*f*(4+s*(4-3*f));return{lat2:Math.atan2(a*x+l*v*u,(1-s)*Math.sqrt(d*d+M*M)),lon2:e+(Math.atan2(v*h,l*x-a*v*u)-(1-E)*s*d*(b+E*v*(_+E*x*(2*_*_-1))))}}(this.lat0,this.long0,f,p,this.a,this.f),t.x=g.lon2,t.y=g.lat2,t)},names:["Azimuthal_Equidistant","aeqd"]},$c={init:function(){this.sin_p14=Math.sin(this.lat0||0),this.cos_p14=Math.cos(this.lat0||0)},forward:function(t){var e,i,n,r,s,o,a,l=t.x,h=t.y;return n=Vh(l-(this.long0||0),this.over),e=Math.sin(h),i=Math.cos(h),r=Math.cos(n),((s=this.sin_p14*e+this.cos_p14*i*r)>0||Math.abs(s)<=hh)&&(o=1*this.a*i*Math.sin(n),a=(this.y0||0)+1*this.a*(this.cos_p14*e-this.sin_p14*i*r)),t.x=o,t.y=a,t},inverse:function(t){var e,i,n,r,s,o,a,l,h;return t.x-=this.x0||0,t.y-=this.y0||0,i=kc((e=Math.sqrt(t.x*t.x+t.y*t.y))/this.a),n=Math.sin(i),r=Math.cos(i),l=this.long0||0,h=this.lat0||0,o=l,Math.abs(e)<=hh?(a=h,t.x=o,t.y=a,t):(a=kc(r*this.sin_p14+t.y*n*this.cos_p14/e),s=Math.abs(h)-lh,Math.abs(s)<=hh?(o=Vh(h>=0?l+Math.atan2(t.x,-t.y):l-Math.atan2(-t.x,t.y),this.over),t.x=o,t.y=a,t):(o=Vh(l+Math.atan2(t.x*n,e*this.cos_p14*r-t.y*this.sin_p14*n),this.over),t.x=o,t.y=a,t))},names:["ortho"]};function Uc(t,e,i,n){var r;return t<hh?(n.value=1,r=0):(r=Math.atan2(e,i),Math.abs(r)<=dh?n.value=1:r>dh&&r<=lh+dh?(n.value=2,r-=lh):r>lh+dh||r<=-(lh+dh)?(n.value=3,r=r>=0?r-ph:r+ph):(n.value=4,r+=lh)),r}function Wc(t,e){var i=t+e;return i<-ph?i+=fh:i>+ph&&(i-=fh),i}const Xc={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>=lh-dh/2?this.face=5:this.lat0<=-(lh-dh/2)?this.face=6:Math.abs(this.long0)<=dh?this.face=1:Math.abs(this.long0)<=lh+dh?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,n,r,s,o,a={x:0,y:0},l={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)r=lh-e,i>=dh&&i<=lh+dh?(l.value=1,n=i-lh):i>lh+dh||i<=-(lh+dh)?(l.value=2,n=i>0?i-ph:i+ph):i>-(lh+dh)&&i<=-dh?(l.value=3,n=i+lh):(l.value=4,n=i);else if(6===this.face)r=lh+e,i>=dh&&i<=lh+dh?(l.value=1,n=-i+lh):i<dh&&i>=-dh?(l.value=2,n=-i):i<-dh&&i>=-(lh+dh)?(l.value=3,n=-i-lh):(l.value=4,n=i>0?-i+ph:-i-ph);else{var h,u,c,d,f,p;2===this.face?i=Wc(i,+lh):3===this.face?i=Wc(i,+ph):4===this.face&&(i=Wc(i,-lh)),d=Math.sin(e),f=Math.cos(e),p=Math.sin(i),h=f*Math.cos(i),u=f*p,c=d,1===this.face?n=Uc(r=Math.acos(h),c,u,l):2===this.face?n=Uc(r=Math.acos(u),c,-h,l):3===this.face?n=Uc(r=Math.acos(-h),c,-u,l):4===this.face?n=Uc(r=Math.acos(-u),c,h,l):(r=n=0,l.value=1)}return o=Math.atan(12/ph*(n+Math.acos(Math.sin(n)*Math.cos(dh))-lh)),s=Math.sqrt((1-Math.cos(r))/(Math.cos(o)*Math.cos(o))/(1-Math.cos(Math.atan(1/Math.cos(n))))),2===l.value?o+=lh:3===l.value?o+=ph:4===l.value&&(o+=1.5*ph),a.x=s*Math.cos(o),a.y=s*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,n,r,s,o,a,l,h,u,c,d,f={lam:0,phi:0},p={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)?p.value=1:t.y>=0&&t.y>=Math.abs(t.x)?(p.value=2,e-=lh):t.x<0&&-t.x>=Math.abs(t.y)?(p.value=3,e=e<0?e+ph:e-ph):(p.value=4,e+=lh),h=ph/12*Math.tan(e),s=Math.sin(h)/(Math.cos(h)-1/Math.sqrt(2)),o=Math.atan(s),(a=1-(n=Math.cos(e))*n*(r=Math.tan(i))*r*(1-Math.cos(Math.atan(1/Math.cos(o)))))<-1?a=-1:a>1&&(a=1),5===this.face)l=Math.acos(a),f.phi=lh-l,1===p.value?f.lam=o+lh:2===p.value?f.lam=o<0?o+ph:o-ph:3===p.value?f.lam=o-lh:f.lam=o;else if(6===this.face)l=Math.acos(a),f.phi=l-lh,1===p.value?f.lam=-o+lh:2===p.value?f.lam=-o:3===p.value?f.lam=-o-lh:f.lam=o<0?-o-ph:-o+ph;else{var g,m,y;h=(g=a)*g,m=(h+=(y=h>=1?0:Math.sqrt(1-h)*Math.sin(o))*y)>=1?0:Math.sqrt(1-h),2===p.value?(h=m,m=-y,y=h):3===p.value?(m=-m,y=-y):4===p.value&&(h=m,m=y,y=-h),2===this.face?(h=g,g=-m,m=h):3===this.face?(g=-g,m=-m):4===this.face&&(h=g,g=m,m=-h),f.phi=Math.acos(-y)-lh,f.lam=Math.atan2(m,g),2===this.face?f.lam=Wc(f.lam,-lh):3===this.face?f.lam=Wc(f.lam,-ph):4===this.face&&(f.lam=Wc(f.lam,+lh))}return 0!==this.es&&(u=f.phi<0?1:0,c=Math.tan(f.phi),d=this.b/Math.sqrt(c*c+this.one_minus_f_squared),f.phi=Math.atan(Math.sqrt(this.a*this.a-d*d)/(this.one_minus_f*d)),u&&(f.phi=-f.phi)),f.lam+=this.long0,t.x=f.lam,t.y=f.phi,t},names:["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"]};var Vc=[[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]],Kc=[[-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]],Zc=.8487,Yc=1.3523,Hc=ch/5,Jc=1/Hc,Qc=function(t,e){return t[0]+e*(t[1]+e*(t[2]+e*t[3]))};const td={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=Vh(t.x-this.long0,this.over),i=Math.abs(t.y),n=Math.floor(i*Hc);n<0?n=0:n>=18&&(n=17);var r={x:Qc(Vc[n],i=ch*(i-Jc*n))*e,y:Qc(Kc[n],i)};return t.y<0&&(r.y=-r.y),r.x=r.x*this.a*Zc+this.x0,r.y=r.y*this.a*Yc+this.y0,r},inverse:function(t){var e={x:(t.x-this.x0)/(this.a*Zc),y:Math.abs(t.y-this.y0)/(this.a*Yc)};if(e.y>=1)e.x/=Vc[18][0],e.y=t.y<0?-lh:lh;else{var i=Math.floor(18*e.y);for(i<0?i=0:i>=18&&(i=17);;)if(Kc[i][0]>e.y)--i;else{if(!(Kc[i+1][0]<=e.y))break;++i}var n=Kc[i],r=5*(e.y-n[0])/(Kc[i+1][0]-n[0]);r=function(t,e,i,n){for(var r=e;n;--n){var s=t(r);if(r-=s,Math.abs(s)<1e-10)break}return r}(function(t){return(Qc(n,t)-e.y)/function(t,e){return t[1]+e*(2*t[2]+3*e*t[3])}(n,t)},r,0,100),e.x/=Qc(Vc[i],r),e.y=(5*i+r)*uh,t.y<0&&(e.y=-e.y)}return e.x=Vh(e.x+this.long0,this.over),e},names:["Robinson","robin"]},ed={init:function(){this.name="geocent"},forward:function(t){return wu(t,this.es,this.a)},inverse:function(t){return bu(t,this.es,this.a,this.b)},names:["Geocentric","geocentric","geocent","Geocent"]};var id={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 nd={init:function(){if(Object.keys(id).forEach(function(t){if(void 0===this[t])this[t]=id[t].def;else{if(id[t].num&&isNaN(this[t]))throw new Error("Invalid parameter value, must be numeric "+t+" = "+this[t]);id[t].num&&(this[t]=parseFloat(this[t]))}id[t].degrees&&(this[t]=this[t]*uh)}.bind(this)),Math.abs(Math.abs(this.lat0)-lh)<hh?this.mode=this.lat0<0?1:0:Math.abs(this.lat0)<hh?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,n,r,s=Math.sin(t.y),o=Math.cos(t.y),a=Math.cos(t.x);switch(this.mode){case 3:i=this.sinph0*s+this.cosph0*o*a;break;case 2:i=o*a;break;case 1:i=-s;break;case 0:i=s}switch(e=(i=this.pn1/(this.p-i))*o*Math.sin(t.x),this.mode){case 3:i*=this.cosph0*s-this.sinph0*o*a;break;case 2:i*=s;break;case 0:i*=-o*a;break;case 1:i*=o*a}return r=1/((n=i*this.cg+e*this.sg)*this.sw*this.h1+this.cw),e=(e*this.cg-i*this.sg)*this.cw*r,i=n*r,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,n,r={x:t.x,y:t.y};n=1/(this.pn1-t.y*this.sw),e=this.pn1*t.x*n,i=this.pn1*t.y*this.cw*n,t.x=e*this.cg+i*this.sg,t.y=i*this.cg-e*this.sg;var s=rc(t.x,t.y);if(Math.abs(s)<hh)r.x=0,r.y=t.y;else{var o,a;switch(a=1-s*s*this.pfact,a=(this.p-Math.sqrt(a))/(this.pn1/s+s/this.pn1),o=Math.sqrt(1-a*a),this.mode){case 3:r.y=Math.asin(o*this.sinph0+t.y*a*this.cosph0/s),t.y=(o-this.sinph0*Math.sin(r.y))*s,t.x*=a*this.cosph0;break;case 2:r.y=Math.asin(t.y*a/s),t.y=o*s,t.x*=a;break;case 0:r.y=Math.asin(o),t.y=-t.y;break;case 1:r.y=-Math.asin(o)}r.x=Math.atan2(t.x,t.y)}return t.x=r.x+this.long0,t.y=r.y,t},names:["Tilted_Perspective","tpers"]},rd={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,n,r,s=t.x,o=t.y;if(s-=this.long0,"ellipse"===this.shape){o=Math.atan(this.radius_p2*Math.tan(o));var a=this.radius_p/rc(this.radius_p*Math.cos(o),Math.sin(o));if(i=a*Math.cos(s)*Math.cos(o),n=a*Math.sin(s)*Math.cos(o),r=a*Math.sin(o),(this.radius_g-i)*i-n*n-r*r*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(n/rc(r,e)),t.y=this.radius_g_1*Math.atan(r/e)):(t.x=this.radius_g_1*Math.atan(n/e),t.y=this.radius_g_1*Math.atan(r/rc(n,e)))}else"sphere"===this.shape&&(e=Math.cos(o),i=Math.cos(s)*e,n=Math.sin(s)*e,r=Math.sin(o),e=this.radius_g-i,this.flip_axis?(t.x=this.radius_g_1*Math.atan(n/rc(r,e)),t.y=this.radius_g_1*Math.atan(r/e)):(t.x=this.radius_g_1*Math.atan(n/e),t.y=this.radius_g_1*Math.atan(r/rc(n,e))));return t.x=t.x*this.a,t.y=t.y*this.a,t},inverse:function(t){var e,i,n,r,s=-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)*rc(1,a)):(o=Math.tan(t.x/this.radius_g_1),a=Math.tan(t.y/this.radius_g_1)*rc(1,o));var l=a/this.radius_p;if(e=o*o+l*l+s*s,(n=(i=2*this.radius_g*s)*i-4*e*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;r=(-i-Math.sqrt(n))/(2*e),s=this.radius_g+r*s,o*=r,a*=r,t.x=Math.atan2(o,s),t.y=Math.atan(a*Math.cos(t.x)/s),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+s*s,(n=(i=2*this.radius_g*s)*i-4*e*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;r=(-i-Math.sqrt(n))/(2*e),s=this.radius_g+r*s,o*=r,a*=r,t.x=Math.atan2(o,s),t.y=Math.atan(a*Math.cos(t.x)/s)}return t.x=t.x+this.long0,t},names:["Geostationary Satellite View","Geostationary_Satellite","geos"]};var sd=1.340264,od=-.081106,ad=893e-6,ld=.003796,hd=Math.sqrt(3)/2;const ud={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=Vh(t.x-this.long0,this.over),i=t.y,n=Math.asin(hd*Math.sin(i)),r=n*n,s=r*r*r;return t.x=e*Math.cos(n)/(hd*(sd+3*od*r+s*(7*ad+9*ld*r))),t.y=n*(sd+od*r+s*(ad+ld*r)),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,n,r,s=t.y;for(r=0;r<12&&(s-=n=(s*(sd+od*(e=s*s)+(i=e*e*e)*(ad+ld*e))-t.y)/(sd+3*od*e+i*(7*ad+9*ld*e)),!(Math.abs(n)<1e-9));++r);return i=(e=s*s)*e*e,t.x=hd*t.x*(sd+3*od*e+i*(7*ad+9*ld*e))/Math.cos(s),t.y=Math.asin(Math.sin(s)/hd),t.x=Vh(t.x+this.long0,this.over),t},names:["eqearth","Equal Earth","Equal_Earth"]};var cd=1e-10;function dd(t){var e,i,n,r=Vh(t.x-(this.long0||0),this.over),s=t.y;return e=this.am1+this.m1-tc(s,i=Math.sin(s),n=Math.cos(s),this.en),i=n*r/(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 fd(t){var e,i,n,r;if(t.x=(t.x-(this.x0||0))/this.a,t.y=(t.y-(this.y0||0))/this.a,i=rc(t.x,t.y=this.am1-t.y),r=ec(this.am1+this.m1-i,this.es,this.en),(e=Math.abs(r))<lh)e=Math.sin(r),n=i*Math.atan2(t.x,t.y)*Math.sqrt(1-this.es*e*e)/Math.cos(r);else{if(!(Math.abs(e-lh)<=cd))throw new Error;n=0}return t.x=Vh(n+(this.long0||0),this.over),t.y=Ec(r),t}function pd(t){var e,i,n=Vh(t.x-(this.long0||0),this.over),r=t.y;return i=this.cphi1+this.phi1-r,Math.abs(i)>cd?(t.x=i*Math.sin(e=n*Math.cos(r)/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 gd(t){var e,i;t.x=(t.x-(this.x0||0))/this.a,t.y=(t.y-(this.y0||0))/this.a;var n=rc(t.x,t.y=this.cphi1-t.y);if(i=this.cphi1+this.phi1-n,Math.abs(i)>lh)throw new Error;return e=Math.abs(Math.abs(i)-lh)<=cd?0:n*Math.atan2(t.x,t.y)/Math.cos(i),t.x=Vh(e+(this.long0||0),this.over),t.y=Ec(i),t}const md={init:function(){var t;if(this.phi1=this.lat1,Math.abs(this.phi1)<cd)throw new Error;this.es?(this.en=Qu(this.es),this.m1=tc(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=fd,this.forward=dd):(Math.abs(this.phi1)+cd>=lh?this.cphi1=0:this.cphi1=1/Math.tan(this.phi1),this.inverse=gd,this.forward=pd)},names:["bonne","Bonne (Werner lat_1=90)"]},yd={OBLIQUE:{forward:function(t,e){let{x:i,y:n}=e;i+=t.long0;const r=Math.cos(i),s=Math.sin(n),o=Math.cos(n);e.x=Vh(Math.atan2(o*Math.sin(i),t.sphip*o*r+t.cphip*s)+t.lamp),e.y=Math.asin(t.sphip*s-t.cphip*o*r);const a=t.obliqueProjection.forward(e);return t.isIdentity&&(a.x*=ch,a.y*=ch),a},inverse:function(t,e){t.isIdentity&&(e.x*=uh,e.y*=uh);const i=t.obliqueProjection.inverse(e);let{x:n,y:r}=i;if(n<Number.MAX_VALUE){n-=t.lamp;const i=Math.cos(n),s=Math.sin(r),o=Math.cos(r);e.x=Math.atan2(o*Math.sin(n),t.sphip*o*i-t.cphip*s),e.y=Math.asin(t.sphip*s+t.cphip*o*i)}return e.x=Vh(e.x+t.long0),e}},TRANSVERSE:{forward:function(t,e){let{x:i,y:n}=e;i+=t.long0;const r=Math.cos(n),s=Math.cos(i);e.x=Vh(Math.atan2(r*Math.sin(i),Math.sin(n))+t.lamp),e.y=Math.asin(-1*r*s);const o=t.obliqueProjection.forward(e);return t.isIdentity&&(o.x*=ch,o.y*=ch),o},inverse:function(t,e){t.isIdentity&&(e.x*=uh,e.y*=uh);const i=t.obliqueProjection.inverse(e);let{x:n,y:r}=i;if(n<Number.MAX_VALUE){const i=Math.cos(r);n-=t.lamp,e.x=Math.atan2(i*Math.sin(n),-1*Math.sin(r)),e.y=Math.asin(i*Math.cos(n))}return e.x=Vh(e.x+t.long0),e}}},_d={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"}},vd={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=Hh.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=xu(t);if(!e)throw new Error("Invalid parameter: o_proj. Unknown projection "+this.o_proj);let i;e.long0=0,this.obliqueProjection=e;const n=Object.keys(_d),r=t=>{if(void 0===this[t])return;const e=parseFloat(this[t])*uh;if(isNaN(e))throw new Error("Invalid value for "+t+": "+this[t]);return e};for(let t=0;t<n.length;t++){const e=n[t],s=_d[e],o=Object.entries(s);if(o.some(([t])=>void 0!==this[t])){i=s;for(let t=0;t<o.length;t++){const[e,i]=o[t],n=r(e);if(void 0===n)throw new Error("Missing parameter: "+e+".");this[i]=n}break}}if(!i)throw new Error("No valid parameters provided for ob_tran projection.");const{lamp:s,phip:o}=function(t,e){let i,n;if(e===_d.ROTATE){let e=t.oLongC,r=t.oLatC,s=t.oAlpha;if(Math.abs(Math.abs(r)-lh)<=hh)throw new Error("Invalid value for o_lat_c: "+t.o_lat_c+" should be < 90°");n=e+Math.atan2(-1*Math.cos(s),-1*Math.sin(s)*Math.sin(r)),i=Math.asin(Math.cos(r)*Math.sin(s))}else if(e===_d.NEW_POLE)n=t.oLongP,i=t.oLatP;else{let e=t.oLong1,r=t.oLat1,s=t.oLong2,o=t.oLat2,a=Math.abs(r);if(Math.abs(r)>lh-hh)throw new Error("Invalid value for o_lat_1: "+t.o_lat_1+" should be < 90°");if(Math.abs(o)>lh-hh)throw new Error("Invalid value for o_lat_2: "+t.o_lat_2+" should be < 90°");if(Math.abs(r-o)<hh)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<hh)throw new Error("Invalid value for o_lat_1: o_lat_1 should be different from zero");n=Math.atan2(Math.cos(r)*Math.sin(o)*Math.cos(e)-Math.sin(r)*Math.cos(o)*Math.cos(s),Math.sin(r)*Math.cos(o)*Math.sin(s)-Math.cos(r)*Math.sin(o)*Math.sin(e)),i=Math.atan(-1*Math.cos(n-e)/Math.tan(r))}return{lamp:n,phip:i}}(this,i);this.lamp=s,Math.abs(o)>hh?(this.cphip=Math.cos(o),this.sphip=Math.sin(o),this.projectionType=yd.OBLIQUE):this.projectionType=yd.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"]},xd=Object.assign(function(t,e,i){var n,r,s,o=!1;return void 0===e?(r=Ou(t),n=Ru,o=!0):(void 0!==e.x||Array.isArray(e))&&(i=e,r=Ou(t),n=Ru,o=!0),n||(n=Ou(t)),r||(r=Ou(e)),i?Au(n,r,i):(s={forward:function(t,e){return Au(n,r,t,e)},inverse:function(t,e){return Au(r,n,t,e)}},o&&(s.oProj=r),s)},{defaultDatum:"WGS84",Proj:xu,WGS84:new xu("WGS84"),Point:Zu,toPoint:Iu,defs:Bh,nadgrid:function(t,e,i){return e instanceof ArrayBuffer?function(t,e,i){var n=!0;void 0!==i&&!1===i.includeErrorFields&&(n=!1);var r=new DataView(e),s=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)}(r),o=function(t,e){return{nFields:t.getInt32(8,e),nSubgridFields:t.getInt32(24,e),nSubgrids:t.getInt32(40,e),shiftType:gu(t,56,64).trim(),fromSemiMajorAxis:t.getFloat64(120,e),fromSemiMinorAxis:t.getFloat64(136,e),toSemiMajorAxis:t.getFloat64(152,e),toSemiMinorAxis:t.getFloat64(168,e)}}(r,s),a=function(t,e,i,n){for(var r=176,s=[],o=0;o<e.nSubgrids;o++){var a=yu(t,r,i),l=_u(t,r,a,i,n),h=Math.round(1+(a.upperLongitude-a.lowerLongitude)/a.longitudeInterval),u=Math.round(1+(a.upperLatitude-a.lowerLatitude)/a.latitudeInterval);s.push({ll:[pu(a.lowerLongitude),pu(a.lowerLatitude)],del:[pu(a.longitudeInterval),pu(a.latitudeInterval)],lim:[h,u],count:a.gridNodeCount,cvs:mu(l)});var c=16;!1===n&&(c=8),r+=176+a.gridNodeCount*c}return s}(r,o,s,n),l={header:o,subgrids:a};return uu[t]=l,l}(t,e,i):{ready:cu(t,e)}},transform:ku,mgrs:Du,version:"__VERSION__"});var wd;(wd=xd).Proj.projections.add(ic),wd.Proj.projections.add(ac),wd.Proj.projections.add(lc),wd.Proj.projections.add(cc),wd.Proj.projections.add(fc),wd.Proj.projections.add(pc),wd.Proj.projections.add(mc),wd.Proj.projections.add(yc),wd.Proj.projections.add(_c),wd.Proj.projections.add(Pc),wd.Proj.projections.add(Tc),wd.Proj.projections.add(Rc),wd.Proj.projections.add(Ac),wd.Proj.projections.add(Oc),wd.Proj.projections.add(Gc),wd.Proj.projections.add(Fc),wd.Proj.projections.add(Lc),wd.Proj.projections.add(jc),wd.Proj.projections.add(Nc),wd.Proj.projections.add(Dc),wd.Proj.projections.add(zc),wd.Proj.projections.add(qc),wd.Proj.projections.add(Bc),wd.Proj.projections.add($c),wd.Proj.projections.add(Xc),wd.Proj.projections.add(td),wd.Proj.projections.add(ed),wd.Proj.projections.add(nd),wd.Proj.projections.add(rd),wd.Proj.projections.add(ud),wd.Proj.projections.add(md),wd.Proj.projections.add(vd);const bd=xd;let Sd=null;var Md=[896,448,224,112,56,28,14,7,3.5,1.75,.875,.4375,.21875,.109375],Ed=[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],Cd=[-238375,1376256],Pd=300,Id=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom"];function Td(t){return"world"===t?{resolutions:Ed,defaultMinZoom:6,maxZoom:20}:{resolutions:Md,defaultMinZoom:0,maxZoom:Md.length-1}}var kd=function(t,e){var i=null,n=function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];clearTimeout(i),i=setTimeout(function(){t.apply(void 0,r)},e)};return n.cancel=function(){i&&(clearTimeout(i),i=null)},n};function Rd(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Ad(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)?Ad(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ad(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function Od(t){var e=t.map,i=t.source,n=t.events,r=t.eventBus,s=t.getZoom,o=t.getCenter,a=t.getBounds,l=t.getResolution,h=!1,u=[],c=[],d=[],f=e.getView(),p=function(t){var e=function(){if(h)return null;var t=s();return{center:o(),bounds:a(),resolution:l(),zoom:t,isAtMaxZoom:t+.01>=f.getMaxZoom(),isAtMinZoom:t-.01<=f.getMinZoom()}}();e&&r.emit(t,e)},g=function(t,e,i){t.on(e,i),u.push([t,e,i])},m=function(t,e,i){t.on(e,i),c.push([t,e,i])},y=!1,_=function(){y||(y=!0,r.emit(n.MAP_LOADED))},v=kd(function(){return p(n.MAP_DATA_CHANGE)},500);d.push(v);var x=function(t){h||(c.forEach(function(t){var e=Rd(t,3),i=e[0],n=e[1],r=e[2];return i.un(n,r)}),c=[],m(t,"tileloadend",_),m(t,"tileloadend",v))};return function(t){var e=t.map,i=t.view,n=t.emit,r=t.eventBus,s=t.events,o=t.on,a=t.debouncers,l=!1,h=kd(function(){l=!1,n(s.MAP_MOVE_END)},500);a.push(h);var u,c,d=(u=function(){return n(s.MAP_MOVE)},c=0,function(){var t=Date.now();t-c>=10&&(c=t,u.apply(void 0,arguments))});o(i,"change",function(){l||(l=!0,r.emit(s.MAP_MOVE_START)),h()}),o(e,"postrender",function(){l&&d()})}({map:e,view:e.getView(),emit:p,eventBus:r,events:n,on:g,debouncers:d}),x(i),e.once("rendercomplete",function(){return p(n.MAP_FIRST_IDLE)}),function(t){var e=t.map,i=t.eventBus,n=t.events,r=t.on,s=null;r(e,"pointerdown",function(t){s=t.pixel}),r(e,"click",function(t){if(s){var e=t.pixel[0]-s[0],r=t.pixel[1]-s[1];if(Math.hypot(e,r)>6)return}i.emit(n.MAP_CLICK,{point:{x:t.pixel[0],y:t.pixel[1]},coords:t.coordinate})})}({map:e,eventBus:r,events:n,on:g}),g(e,"postrender",function(){return r.emit(n.MAP_RENDER)}),{setSource:x,remove:function(){h=!0,d.forEach(function(t){return t.cancel()}),u.forEach(function(t){var e=Rd(t,3),i=e[0],n=e[1],r=e[2];return i.un(n,r)}),c.forEach(function(t){var e=Rd(t,3),i=e[0],n=e[1],r=e[2];return i.un(n,r)})}}}class Gd{constructor(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function Fd(t,e,i,n,r){return void 0!==r?(r.minX=t,r.maxX=e,r.minY=i,r.maxY=n,r):new Gd(t,e,i,n)}const Ld=Gd;function jd(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function Nd(t,e,i,n,r){return`${z(t)},${e},${function(t,e,i){return t+"/"+e+"/"+i}(i,n,r)}`}function Dd(t){return e=t[0],(t[1]<<e)+t[2];var e}const zd=[0,0,0],qd=class{constructor(t){let e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,ct(function(t){const e=((t,e)=>e-t)||S;return t.every(function(i,n){if(0===n)return!0;const r=e(t[n-1],i);return!(r>0||0===r)})}(this.resolutions_),"`resolutions` must be sorted in descending order"),!t.origins)for(let t=0,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,ct(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_=ne(i)),ct(!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,ct(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,ct(!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 n=new Ld(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);n.minX=Math.max(t.minX,n.minX),n.maxX=Math.min(t.maxX,n.maxX),n.minY=Math.max(t.minY,n.minY),n.maxY=Math.min(t.maxY,n.maxY)}return n}):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const n=this.getTileRangeForExtentAndZ(t,e);for(let t=n.minX,r=n.maxX;t<=r;++t)for(let r=n.minY,s=n.maxY;r<=s;++r)i([e,t,r])}forEachTileCoordParentTileRange(t,e,i,n){let r,s,o,a=null,l=t[0]-1;for(2===this.zoomFactor_?(s=t[1],o=t[2]):a=this.getTileCoordExtent(t,n);l>=this.minZoom;){if(void 0!==s&&void 0!==o?(s=Math.floor(s/2),o=Math.floor(o/2),r=Fd(s,s,o,o,i)):r=this.getTileRangeForExtentAndZ(a,l,i),e(l,r))return!0;--l}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getOrigins(){return this.origins_}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(2===this.zoomFactor_){const i=2*t[1],n=2*t[2];return Fd(i,i+1,n,n+1,e)}const n=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(n,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const n=t[0],r=t[1],s=t[2];if(e===n)return Fd(r,s,r,s,i);if(this.zoomFactor_){const t=Math.pow(this.zoomFactor_,e-n),o=Math.floor(r*t),a=Math.floor(s*t);return e<n?Fd(o,o,a,a,i):Fd(o,Math.floor(t*(r+1))-1,a,Math.floor(t*(s+1))-1,i)}const o=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(o,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,zd);const n=zd[1],r=zd[2];return this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,zd),Fd(n,zd[1],r,zd[2],i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),n=ao(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*n[0]*i,e[1]-(t[2]+.5)*n[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),n=this.getResolution(t[0]),r=ao(this.getTileSize(t[0]),this.tmpSize_),s=i[0]+t[1]*r[0]*n,o=i[1]-(t[2]+1)*r[1]*n;return Nt(s,o,s+r[0]*n,o+r[1]*n,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,n,r){const s=this.getZForResolution(i),o=i/this.getResolution(s),a=this.getOrigin(s),l=ao(this.getTileSize(s),this.tmpSize_);let h=o*(t-a[0])/i/l[0],u=o*(a[1]-e)/i/l[1];return n?(h=Ct(h,5)-1,u=Ct(u,5)-1):(h=Et(h,5),u=Et(u,5)),jd(s,h,u,r)}getTileCoordForXYAndZ_(t,e,i,n,r){const s=this.getOrigin(i),o=this.getResolution(i),a=ao(this.getTileSize(i),this.tmpSize_);let l=(t-s[0])/o/a[0],h=(s[1]-e)/o/a[1];return n?(l=Ct(l,5)-1,h=Ct(h,5)-1):(l=Et(l,5),h=Et(h,5)),jd(i,l,h,r)}getTileCoordForCoordAndZ(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){return mt(E(this.resolutions_,t,e||0),this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return Fn(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,i=new Array(e);for(let n=this.minZoom;n<e;++n)i[n]=this.getTileRangeForExtentAndZ(t,n);this.fullTileRanges_=i}};function Bd(t){let e=t.getDefaultTileGrid();return e||(e=function(t){return function(t,e,i,n){n=void 0!==n?n:"top-left";const r=Ud(t,e,i);return new qd({extent:t,origin:Jt(t,n),resolutions:r,tileSize:i})}(Wd(t),void 0,void 0,void 0)}(t),t.setDefaultTileGrid(e)),e}function $d(t){const e=t||{},i=e.extent||_i("EPSG:3857").getExtent(),n={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:Ud(i,e.maxZoom,e.tileSize,e.maxResolution)};return new qd(n)}function Ud(t,e,i,n){e=void 0!==e?e:42,i=ao(void 0!==i?i:256);const r=ee(t),s=se(t);n=n>0?n:Math.max(s/i[0],r/i[1]);const o=e+1,a=new Array(o);for(let t=0;t<o;++t)a[t]=n/Math.pow(2,t);return a}function Wd(t){let e=(t=_i(t)).getExtent();if(!e){const i=180*Se.degrees/t.getMetersPerUnit();e=Nt(-i,-i,i,i)}return e}const Xd=class extends F{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(g)}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(){N()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;const n=e-i+1e3/60;return n>=this.transition_?1:pe(n/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}},Vd=class extends Xd{constructor(t,e,i,n,r,s){super(t,e,s),this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.src_=i,this.key=i,this.image_,Q?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=2,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=3,this.unlistenImage_(),this.image_=function(){const t=ur(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}handleImageLoad_(){if(Q)this.state=2;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=2:this.state=4}this.unlistenImage_(),this.changed()}load(){3==this.state&&(this.state=0,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),0==this.state&&(this.state=1,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=function(t,e,i){const n=t;let r=!0,s=!1,o=!1;const a=[f(n,"load",function(){o=!0,s||e()})];return n.src&&tt?(s=!0,n.decode().then(function(){r&&e()}).catch(function(t){r&&(o?e():i())})):a.push(f(n,"error",i)),function(){r=!1,a.forEach(p)}}(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}};let Kd;const Zd=[];function Yd(t,e,i,n,r){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(n,r),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(i,r)),t.restore()}function Hd(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function Jd(t,e,i,n){const r=Ii(i,e,t);let s=vi(e,n,i);const o=e.getMetersPerUnit();void 0!==o&&(s*=o);const a=t.getMetersPerUnit();void 0!==a&&(s/=a);const l=t.getExtent();if(!l||Gt(l,r)){const e=vi(t,s,r)/s;isFinite(e)&&e>0&&(s/=e)}return s}const Qd=class{constructor(t,e,i,n,r,s,o){this.sourceProj_=t,this.targetProj_=e;let a={};const l=o?bi(t=>Wi(o,Ii(t,this.targetProj_,this.sourceProj_))):Pi(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){const e=t[0]+"/"+t[1];return a[e]||(a[e]=l(t)),a[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&se(n)>=se(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?se(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?se(this.targetProj_.getExtent()):null;const h=ne(i),u=re(i),c=Yt(i),d=Zt(i),f=this.transformInv_(h),p=this.transformInv_(u),g=this.transformInv_(c),m=this.transformInv_(d),y=10+(s?Math.max(0,Math.ceil(Math.log2(Kt(i)/(s*s*256*256)))):0);if(this.addQuad_(h,u,c,d,f,p,g,m,y),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach(function(e,i,n){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])}),this.triangles_.forEach(e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const i=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];i[0][0]-t>this.sourceWorldWidth_/2&&(i[0][0]-=this.sourceWorldWidth_),i[1][0]-t>this.sourceWorldWidth_/2&&(i[1][0]-=this.sourceWorldWidth_),i[2][0]-t>this.sourceWorldWidth_/2&&(i[2][0]-=this.sourceWorldWidth_);const n=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-n<this.sourceWorldWidth_/2&&(e.source=i)}})}a={}}addTriangle_(t,e,i,n,r,s){this.triangles_.push({source:[n,r,s],target:[t,e,i]})}addQuad_(t,e,i,n,r,s,o,a,l){const h=kt([r,s,o,a]),u=this.sourceWorldWidth_?se(h)/this.sourceWorldWidth_:null,c=this.sourceWorldWidth_,d=this.sourceProj_.canWrapX()&&u>.5&&u<1;let f=!1;if(l>0&&(this.targetProj_.isGlobal()&&this.targetWorldWidth_&&(f=se(kt([t,e,i,n]))/this.targetWorldWidth_>.25||f),!d&&this.sourceProj_.isGlobal()&&u&&(f=u>.25||f)),!f&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!oe(h,this.maxSourceExtent_))return;let p=0;if(!(f||isFinite(r[0])&&isFinite(r[1])&&isFinite(s[0])&&isFinite(s[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)f=!0;else if(p=(isFinite(r[0])&&isFinite(r[1])?0:8)+(isFinite(s[0])&&isFinite(s[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=p&&2!=p&&4!=p&&8!=p)return;if(l>0){if(!f){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],n=this.transformInv_(e);let s;s=d?(wt(r[0],c)+wt(o[0],c))/2-wt(n[0],c):(r[0]+o[0])/2-n[0];const a=(r[1]+o[1])/2-n[1];f=s*s+a*a>this.errorThresholdSquared_}if(f){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const h=[(e[0]+i[0])/2,(e[1]+i[1])/2],u=this.transformInv_(h),c=[(n[0]+t[0])/2,(n[1]+t[1])/2],d=this.transformInv_(c);this.addQuad_(t,e,h,c,r,s,u,d,l-1),this.addQuad_(c,h,i,n,d,u,o,a,l-1)}else{const h=[(t[0]+e[0])/2,(t[1]+e[1])/2],u=this.transformInv_(h),c=[(i[0]+n[0])/2,(i[1]+n[1])/2],d=this.transformInv_(c);this.addQuad_(t,h,c,n,r,u,d,a,l-1),this.addQuad_(h,e,i,c,u,s,o,d,l-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}11&p||this.addTriangle_(t,i,n,r,o,a),14&p||this.addTriangle_(t,i,e,r,o,s),p&&(13&p||this.addTriangle_(e,n,t,s,a,r),7&p||this.addTriangle_(e,n,i,s,a,o))}calculateSourceExtent(){const t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach(function(e,i,n){const r=e.source;Ut(t,r[0]),Ut(t,r[1]),Ut(t,r[2])}),t}getTriangles(){return this.triangles_}},tf=class extends Xd{constructor(t,e,i,n,r,s,o,a,l,h,u,c){super(r,0,c),this.renderEdges_=void 0!==u&&u,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=n,this.wrappedTileCoord_=s||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const d=n.getTileCoordExtent(this.wrappedTileCoord_),f=this.targetTileGrid_.getExtent();let p=this.sourceTileGrid_.getExtent();const g=f?ie(d,f):d;if(0===Kt(g))return void(this.state=4);const m=t.getExtent();m&&(p=p?ie(p,m):m);const y=n.getResolution(this.wrappedTileCoord_[0]),_=function(t,e,i,n){const r=Ht(i);let s=Jd(t,e,r,n);return(!isFinite(s)||s<=0)&&Vt(i,function(i){return s=Jd(t,e,i,n),isFinite(s)&&s>0}),s}(t,i,g,y);if(!isFinite(_)||_<=0)return void(this.state=4);const v=void 0!==h?h:.5;if(this.triangulation_=new Qd(t,i,g,p,_*v,y),0===this.triangulation_.getTriangles().length)return void(this.state=4);this.sourceZ_=e.getZForResolution(_);let x=this.triangulation_.calculateSourceExtent();if(p&&(t.canWrapX()?(x[1]=mt(x[1],p[1],p[3]),x[3]=mt(x[3],p[1],p[3])):x=ie(x,p)),Kt(x)){let i=0,n=0;t.canWrapX()&&(i=se(m),n=Math.floor((x[0]-m[0])/i)),he(x.slice(),t,!0).forEach(t=>{const r=e.getTileRangeForExtentAndZ(t,this.sourceZ_);for(let t=r.minX;t<=r.maxX;t++)for(let e=r.minY;e<=r.maxY;e++){const r=n*i;this.sourceTiles_.push({getTile:()=>l(this.sourceZ_,t,e,o),offset:r})}++n}),0===this.sourceTiles_.length&&(this.state=4)}else this.state=4}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{const i=e.tile;if(i&&2==i.getState()){const n=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);n[0]+=e.offset,n[2]+=e.offset;const r=this.clipExtent_?.slice();r&&(r[0]+=e.offset,r[2]+=e.offset),t.push({extent:n,clipExtent:r,image:i.getImage()})}}),this.sourceTiles_.length=0,0===t.length)this.state=3;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],r="number"==typeof i?i:i[1],s=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=function(t,e,i,n,r,s,o,a,l,h,u,c,d,f){const p=ur(Math.round(i*t),Math.round(i*e),Zd);if(c||(p.imageSmoothingEnabled=!1),0===l.length)return p.canvas;function g(t){return Math.round(t*i)/i}p.scale(i,i),p.globalCompositeOperation="lighter";const m=[1/0,1/0,-1/0,-1/0];let y;l.forEach(function(t,e,i){$t(m,t.extent)});const _=i/n,v=(c?1:1+Math.pow(2,-24))/_;if(!d||1!==l.length||0!==h){if(y=ur(Math.round(se(m)*_),Math.round(ee(m)*_),Zd),c||(y.imageSmoothingEnabled=!1),r&&f){const t=(r[0]-m[0])*_,e=-(r[3]-m[3])*_,i=se(r)*_,n=ee(r)*_;y.rect(t,e,i,n),y.clip()}l.forEach(function(t,e,i){if(t.image.width>0&&t.image.height>0){if(t.clipExtent){y.save();const e=(t.clipExtent[0]-m[0])*_,i=-(t.clipExtent[3]-m[3])*_,n=se(t.clipExtent)*_,r=ee(t.clipExtent)*_;y.rect(c?e:Math.round(e),c?i:Math.round(i),c?n:Math.round(e+n)-Math.round(e),c?r:Math.round(i+r)-Math.round(i)),y.clip()}const e=(t.extent[0]-m[0])*_,i=-(t.extent[3]-m[3])*_,n=se(t.extent)*_,r=ee(t.extent)*_;y.drawImage(t.image,h,h,t.image.width-2*h,t.image.height-2*h,c?e:Math.round(e),c?i:Math.round(i),c?n:Math.round(e+n)-Math.round(e),c?r:Math.round(i+r)-Math.round(i)),t.clipExtent&&y.restore()}})}const x=ne(o);return a.getTriangles().forEach(function(t,e,i){const n=t.source,r=t.target;let o=n[0][0],a=n[0][1],h=n[1][0],u=n[1][1],d=n[2][0],f=n[2][1];const _=g((r[0][0]-x[0])/s),w=g(-(r[0][1]-x[1])/s),b=g((r[1][0]-x[0])/s),S=g(-(r[1][1]-x[1])/s),M=g((r[2][0]-x[0])/s),E=g(-(r[2][1]-x[1])/s),C=o,P=a;o=0,a=0,h-=C,u-=P,d-=C,f-=P;const I=function(t){const e=t.length;for(let i=0;i<e;i++){let n=i,r=Math.abs(t[i][i]);for(let s=i+1;s<e;s++){const e=Math.abs(t[s][i]);e>r&&(r=e,n=s)}if(0===r)return null;const s=t[n];t[n]=t[i],t[i]=s;for(let n=i+1;n<e;n++){const r=-t[n][i]/t[i][i];for(let s=i;s<e+1;s++)i==s?t[n][s]=0:t[n][s]+=r*t[i][s]}}const i=new Array(e);for(let n=e-1;n>=0;n--){i[n]=t[n][e]/t[n][n];for(let r=n-1;r>=0;r--)t[r][e]-=t[r][n]*i[n]}return i}([[h,u,0,0,b-_],[d,f,0,0,M-_],[0,0,h,u,S-w],[0,0,d,f,E-w]]);if(!I)return;if(p.save(),p.beginPath(),function(){if(void 0===Kd){const t=ur(6,6,Zd);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",Yd(t,4,5,4,0),Yd(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;Kd=Hd(e,0)||Hd(e,4)||Hd(e,8),fr(t),Zd.push(t.canvas)}return Kd}()||!c){p.moveTo(b,S);const t=4,e=_-b,i=w-S;for(let n=0;n<t;n++)p.lineTo(b+g((n+1)*e/t),S+g(n*i/(t-1))),n!=t-1&&p.lineTo(b+g((n+1)*e/t),S+g((n+1)*i/(t-1)));p.lineTo(M,E)}else p.moveTo(b,S),p.lineTo(_,w),p.lineTo(M,E);let T;if(p.clip(),p.transform(I[0],I[2],I[1],I[3],_,w),p.translate(m[0]-C,m[3]-P),y)T=y.canvas,p.scale(v,-v);else{const t=l[0],e=t.extent;T=t.image,p.scale(se(e)/T.width,-ee(e)/T.height)}p.drawImage(T,0,0),p.restore()}),y&&(fr(y),Zd.push(y.canvas)),u&&(p.save(),p.globalCompositeOperation="source-over",p.strokeStyle="black",p.lineWidth=1,a.getTriangles().forEach(function(t,e,i){const n=t.target,r=(n[0][0]-x[0])/s,o=-(n[0][1]-x[1])/s,a=(n[1][0]-x[0])/s,l=-(n[1][1]-x[1])/s,h=(n[2][0]-x[0])/s,u=-(n[2][1]-x[1])/s;p.beginPath(),p.moveTo(a,l),p.lineTo(r,o),p.lineTo(h,u),p.closePath(),p.stroke()}),p.restore()),p.canvas}(n,r,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),s,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=2}this.changed()}load(){for(const t of this.sourceTiles_)t.tile=t.getTile();if(0==this.state){this.state=1,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const i=e.getState();if(0==i||1==i){t++;const i=d(e,g,n=>{const r=e.getState();2!=r&&3!=r&&4!=r||(p(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(p),this.sourcesListenerKeys_=null}release(){this.canvas_&&(fr(this.canvas_.getContext("2d")),Zd.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}};function ef(t,e){const i=[];Object.keys(e).forEach(function(t){null!==e[t]&&void 0!==e[t]&&i.push(t+"="+encodeURIComponent(e[t]))});const n=i.join("&");return t=t.replace(/[?&]$/,""),(t+=t.includes("?")?"&":"?")+n}const nf=/\{z\}/g,rf=/\{x\}/g,sf=/\{y\}/g,of=/\{-y\}/g;function af(t,e){return function(i,n,r){if(!i)return;let s;const o=i[0];if(e){const t=e.getFullTileRange(o);t&&(s=t.getHeight()-1)}return function(t,e,i,n,r){return t.replace(nf,e.toString()).replace(rf,i.toString()).replace(sf,n.toString()).replace(of,function(){if(void 0===r)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(r-n).toString()})}(t,o,i[1],i[2],s)}}function lf(t){return t?"function"==typeof t?t:(Array.isArray(t)||(t=[t]),e=>t):null}const hf=class extends B{constructor(t){super(),this.projection=_i(t.projection),this.attributions_=lf(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_=lf(t),this.changed()}setState(t){this.state_=t,this.changed()}};class uf extends G{constructor(t,e){super(t),this.tile=e}}const cf=class extends hf{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&&ao(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),[256,256]),this.tmpSize=[0,0],this.key_=t.key||z(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,n,r,s){return N()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:Bd(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const n=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),s=ao(n.getTileSize(t),this.tmpSize);return 1==r?s:(o=s,a=r,void 0===(l=this.tmpSize)&&(l=[0,0]),l[0]=o[0]*a+.5|0,l[1]=o[1]*a+.5|0,l);var o,a,l}getTileCoordForTileUrlFunction(t,e){const i=void 0!==e?e:this.getProjection(),n=void 0!==e?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=function(t,e,i){const n=e[0],r=t.getTileCoordCenter(e),s=Wd(i);if(!Gt(s,r)){const e=se(s),i=Math.ceil((s[0]-r[0])/e);return r[0]+=e*i,t.getTileCoordForCoordAndZ(r,n)}return e}(n,t,i)),function(t,e){const i=t[0],n=t[1],r=t[2];if(e.getMinZoom()>i||i>e.getMaxZoom())return!1;const s=e.getFullTileRange(i);return!s||s.containsXY(n,r)}(t,n)?t:null}clear(){}refresh(){this.clear(),super.refresh()}};class df extends cf{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===df.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=z(e),n=e.getState();let r;1==n?(this.tileLoadingKeys_[i]=!0,r="tileloadstart"):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=3==n?"tileloaderror":2==n?"tileloadend":void 0),null!=r&&this.dispatchEvent(new uf(r,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,void 0!==e?this.setKey(e):this.changed()}setUrl(t){const e=function(t){const e=[];let i=/\{([a-z])-([a-z])\}/.exec(t);if(i){const n=i[1].charCodeAt(0),r=i[2].charCodeAt(0);let s;for(s=n;s<=r;++s)e.push(t.replace(i[0],String.fromCharCode(s)));return e}if(i=/\{(\d+)-(\d+)\}/.exec(t),i){const n=parseInt(i[2],10);for(let r=parseInt(i[1],10);r<=n;r++)e.push(t.replace(i[0],r.toString()));return e}return e.push(t),e}(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(function(t,e){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=af(t[r],e);return function(t){return 1===t.length?t[0]:function(e,i,n){if(!e)return;const r=wt(Dd(e),t.length);return t[r](e,i,n)}}(n)}(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}const ff=df;function pf(t,e){if(Q){const i=t.getCrossOrigin();let n="same-origin",r="same-origin";"anonymous"===i||""===i?(n="cors",r="omit"):"use-credentials"===i&&(n="cors",r="include");const s={mode:n,credentials:r,referrerPolicy:t.getReferrerPolicy()};return void fetch(e,s).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 gf=class extends ff{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:pf,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:Vd,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!Mi(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||Mi(e,t)))return this.tileGrid;const i=z(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=Bd(t)),this.tileGridForProjection[i]}createTile_(t,e,i,n,r,s){const o=[t,e,i],a=this.getTileCoordForTileUrlFunction(o,r),l=a?this.tileUrlFunction(a,n,r):void 0,h=new this.tileClass(o,void 0!==l?0:4,void 0!==l?l:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return h.key=s,h.addEventListener(g,this.handleTileChange.bind(this)),h}getTile(t,e,i,n,r,s){const o=this.getProjection();if(!o||!r||Mi(o,r))return this.getTileInternal(t,e,i,n,o||r);const a=[t,e,i],l=this.getKey(),h=this.getTileGridForProjection(o),u=this.getTileGridForProjection(r),c=this.getTileCoordForTileUrlFunction(a,r),d=new tf(o,h,r,u,a,c,this.getTilePixelRatio(n),this.getGutter(),(t,e,i,n)=>this.getTileInternal(t,e,i,n,o,s),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return d.key=l,d}getTileInternal(t,e,i,n,r,s){const o=this.getKey(),a=Nd(this,o,t,e,i);if(s&&s.containsKey(a))return s.get(a);const l=this.createTile_(t,e,i,n,r,o);return s?.set(a,l),l}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const i=_i(t);if(i){const t=z(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}},mf=class extends gf{constructor(t){const e=void 0!==(t=t||{}).projection?t.projection:"EPSG:3857",i=void 0!==t.tileGrid?t.tileGrid:$d({extent:Wd(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 yf(t,e){const i=(""+t).split("."),n=(""+e).split(".");for(let t=0;t<Math.max(i.length,n.length);t++){const e=parseInt(i[t]||"0",10),r=parseInt(n[t]||"0",10);if(e>r)return 1;if(r>e)return-1}return 0}const _f="1.3.0";function vf(t,e,i,n,r,s,o){s=Object.assign({REQUEST:"GetMap"},s);const a=e/i,l=[Mt(se(t)/a,4),Mt(ee(t)/a,4)];if(1!=i)switch(o){case"geoserver":const t=90*i+.5|0;"FORMAT_OPTIONS"in s?s.FORMAT_OPTIONS+=";dpi:"+t:s.FORMAT_OPTIONS="dpi:"+t;break;case"mapserver":s.MAP_RESOLUTION=90*i;break;case"carmentaserver":case"qgis":s.DPI=90*i;break;default:throw new Error("Unknown `serverType` configured")}return function(t,e,i,n,r){r.WIDTH=i[0],r.HEIGHT=i[1];const s=n.getAxisOrientation(),o=yf(r.VERSION,"1.3")>=0;r[o?"CRS":"SRS"]=n.getCode();const a=o&&s.startsWith("ne")?[e[1],e[0],e[3],e[2]]:e;return r.BBOX=a.join(","),ef(t,r)}(r,t,l,n,s)}function xf(t,e){return Object.assign({REQUEST:e,SERVICE:"WMS",VERSION:_f,FORMAT:"image/png",STYLES:"",TRANSPARENT:"TRUE"},t)}const wf=class extends gf{constructor(t){t=t||{};const e=Object.assign({},t.params);super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.gutter_=void 0!==t.gutter?t.gutter:0,this.params_=e,this.v13_=!0,this.serverType_=t.serverType,this.hidpi_=void 0===t.hidpi||t.hidpi,this.tmpExtent_=[1/0,1/0,-1/0,-1/0],this.updateV13_(),this.setKey(this.getKeyForParams_())}getFeatureInfoUrl(t,e,i,n){const r=_i(i),s=this.getProjection()||r;let o=this.getTileGrid();o||(o=this.getTileGridForProjection(s));const a=Ii(t,r,s),l=Jd(s,r,t,e),h=o.getZForResolution(l,this.zDirection),u=o.getResolution(h),c=o.getTileCoordForCoordAndZ(a,h);if(o.getResolutions().length<=c[0])return;let d=o.getTileCoordExtent(c,this.tmpExtent_);const f=this.gutter_;0!==f&&(d=Rt(d,u*f,d));const p={QUERY_LAYERS:this.params_.LAYERS};Object.assign(p,xf(this.params_,"GetFeatureInfo"),n);const g=Math.floor((a[0]-d[0])/u),m=Math.floor((d[3]-a[1])/u);return p[this.v13_?"I":"X"]=g,p[this.v13_?"J":"Y"]=m,this.getRequestUrl_(c,d,1,s||r,p)}getLegendUrl(t,e){if(void 0===this.urls[0])return;const i={SERVICE:"WMS",VERSION:_f,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){const t=this.params_.LAYERS;if(Array.isArray(t)&&1!==t.length)return;i.LAYER=t}if(void 0!==t){const e=this.getProjection()?this.getProjection().getMetersPerUnit():1,n=28e-5;i.SCALE=t*e/n}return Object.assign(i,e),ef(this.urls[0],i)}getGutter(){return this.gutter_}getParams(){return this.params_}getRequestUrl_(t,e,i,n,r){const s=this.urls;if(!s)return;let o;return o=1==s.length?s[0]:s[wt(Dd(t),s.length)],vf(e,(this.tileGrid||this.getTileGridForProjection(n)).getResolution(t[0]),i,n,o,r,this.serverType_)}getTilePixelRatio(t){return this.hidpi_&&void 0!==this.serverType_?t:1}getKeyForParams_(){let t=0;const e=[];for(const i in this.params_)e[t++]=i+"-"+this.params_[i];return e.join("/")}setParams_(t){this.params_=t,this.updateV13_(),this.setKey(this.getKeyForParams_())}setParams(t){this.setParams_(Object.assign({},t))}updateParams(t){this.setParams_(Object.assign(this.params_,t))}updateV13_(){const t=this.params_.VERSION||_f;this.v13_=yf(t,"1.3")>=0}tileUrlFunction(t,e,i){let n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(i)),n.getResolutions().length<=t[0])return;1==e||this.hidpi_&&void 0!==this.serverType_||(e=1);const r=n.getResolution(t[0]);let s=n.getTileCoordExtent(t,this.tmpExtent_);const o=this.gutter_;0!==o&&(s=Rt(s,r*o,s));const a=Object.assign({},xf(this.params_,"GetMap"));return this.getRequestUrl_(t,s,e,i,a)}},bf=[],Sf=class extends Xd{constructor(t,e,i,n,r){super(t,e,{transition:0}),this.context_=null,this.executorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=n.bind(void 0,this),this.removeSourceTiles_=r,this.wrappedTileCoord=i}getContext(){return this.context_||(this.context_=ur(1,1,bf)),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(t){const e=z(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedPixelRatio:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[e]}load(){this.getSourceTiles()}release(){this.context_&&(fr(this.context_),bf.push(this.context_.canvas),this.context_=null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}},Mf=class extends Xd{constructor(t,e,i,n,r,s){super(t,e,s),this.extent=null,this.format_=n,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=r,this.url_=i,this.key=i}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){0==this.state&&(this.setState(1),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(t,e){this.setFeatures(t)}onError(){this.setState(3)}setFeatures(t){this.features_=t,this.setState(2)}setLoader(t){this.loader_=t}};function Ef(t,e,i,n,r,s,o){const a=new XMLHttpRequest;a.open("GET","function"==typeof t?t(i,n,r):t,!0),"arraybuffer"==e.getType()&&(a.responseType="arraybuffer"),a.withCredentials=false,a.onload=function(t){if(!a.status||a.status>=200&&a.status<300){const t=e.getType();try{let n;"text"==t||"json"==t?n=a.responseText:"xml"==t?n=a.responseXML||a.responseText:"arraybuffer"==t&&(n=a.response),n?s(e.readFeatures(n,{extent:i,featureProjection:r}),e.readProjection(n)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function Cf(t,e){return function(i,n,r,s,o){Ef(t,e,i,n,r,(t,e)=>{this.addFeatures(t),void 0!==s&&s(t)},()=>{this.changed(),void 0!==o&&o()})}}const Pf=class extends ff{constructor(t){const e=t.projection||"EPSG:3857",i=t.extent||Wd(e),n=t.tileGrid||$d({extent:i,maxResolution:t.maxResolution,maxZoom:void 0!==t.maxZoom?t.maxZoom:22,minZoom:t.minZoom,tileSize:t.tileSize||512});super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,interpolate:!0,projection:e,state:t.state,tileGrid:n,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:If,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:void 0===t.zDirection?1:t.zDirection}),this.format_=t.format?t.format:null,this.tileKeysBySourceTileUrl_={},this.sourceTiles_={},this.overlaps_=null==t.overlaps||t.overlaps,this.tileClass=t.tileClass?t.tileClass:Mf,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceTiles(t,e,i,n){if(0===i.getState()){i.setState(1);const r=i.wrappedTileCoord,s=this.getTileGridForProjection(e);let o=s.getTileCoordExtent(r);const a=r[0],l=s.getResolution(a);Rt(o,-l,o);const h=this.projection;e&&this.projection&&!Mi(e,h)&&(o=Ti(o,e,h));const u=this.tileGrid,d=u.getExtent();d&&ie(o,d,o);let f=l;e&&h&&!Mi(e,h)&&(f=l/h.getMetersPerUnit()/e.getMetersPerUnit());const p=u.getZForResolution(f,this.zDirection),m=n||this.tileUrlFunction;u.forEachTileCoord(o,p,n=>{const r=m(n,t,e);this.sourceTiles_[r]||(this.sourceTiles_[r]=new this.tileClass(n,r?0:4,r,this.format_,this.tileLoadFunction));const s=this.sourceTiles_[r];i.sourceTiles.push(s),this.tileKeysBySourceTileUrl_[r]||(this.tileKeysBySourceTileUrl_[r]=[]),this.tileKeysBySourceTileUrl_[r].push(i.getKey());const o=s.getState();if(o<2){const t=e=>{this.handleTileChange(e);const n=s.getState();if(2===n||3===n){const e=s.getKey();e in i.errorTileKeys?2===s.getState()&&delete i.errorTileKeys[e]:i.loadingSourceTiles--,3===n?i.errorTileKeys[e]=!0:s.removeEventListener(g,t),0===i.loadingSourceTiles&&i.setState(c(i.errorTileKeys)?2:3)}};s.addEventListener(g,t),i.loadingSourceTiles++}0===o&&(s.extent=u.getTileCoordExtent(n),s.projection=this.projection,s.resolution=u.getResolution(n[0]),s.load())}),i.loadingSourceTiles||i.setState(i.sourceTiles.some(t=>3===t.getState())?3:2)}return i.sourceTiles}removeSourceTiles(t){const e=t.getKey(),i=t.sourceTiles;for(let t=0,n=i.length;t<n;++t){const n=i[t].getTileUrl();if(!this.tileKeysBySourceTileUrl_[n])return;const r=this.tileKeysBySourceTileUrl_[n].indexOf(e);-1!==r&&(this.tileKeysBySourceTileUrl_[n].splice(r,1),0===this.tileKeysBySourceTileUrl_[n].length&&(delete this.tileKeysBySourceTileUrl_[n],delete this.sourceTiles_[n]))}}getTile(t,e,i,n,r){const s=[t,e,i];let o=this.getTileCoordForTileUrlFunction(s,r);const a=this.getTileGrid().getExtent(),l=this.projection,h=this.getTileGridForProjection(r);if(o&&a){const e=h.getTileCoordExtent(o);Rt(e,-h.getResolution(t),e),oe(a,r&&l&&!Mi(r,l)?Ti(e,r,l):e)||(o=null)}let u=!0;if(null!==o){const e=this.tileGrid,i=h.getResolution(t);let s=i;r&&l&&!Mi(r,l)&&(s=i/l.getMetersPerUnit()/r.getMetersPerUnit());const a=e.getZForResolution(s,1),c=h.getTileCoordExtent(o);Rt(c,-i,c),e.forEachTileCoord(r&&l&&!Mi(r,l)?Ti(c,r,l):c,a,t=>{u=u&&!this.tileUrlFunction(t,n,l)})}const c=this.tileUrlFunction,d=new Sf(s,u?4:0,o,t=>this.getSourceTiles(n,r,t,c),this.removeSourceTiles.bind(this));return d.key=this.getKey(),d}getTileGridForProjection(t){const e=t.getCode();let i=this.tileGrids_[e];if(!i){const n=this.projection;if(null!==n&&!Mi(n,t))return Bd(t);const r=this.tileGrid,s=r.getResolutions().slice(),o=s.map(function(t,e){return r.getOrigin(e)}),a=s.map(function(t,e){return r.getTileSize(e)}),l=43;for(let t=s.length;t<l;++t)s.push(s[t-1]/2),o.push(o[t-1]),a.push(a[t-1]);i=new qd({extent:r.getExtent(),origins:o,resolutions:s,tileSizes:a}),this.tileGrids_[e]=i}return i}getTilePixelRatio(t){return t}getTilePixelSize(t,e,i){const n=ao(this.getTileGridForProjection(i).getTileSize(t),this.tmpSize);return[Math.round(n[0]*e),Math.round(n[1]*e)]}setOverlaps(t){this.overlaps_=t,this.changed()}};function If(t,e){t.setLoader(function(i,n,r){Ef(e,t.getFormat(),i,n,r,t.onLoad.bind(t),t.onError.bind(t))})}function Tf(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageBitmap?t:null}const kf=new Error("disposed"),Rf=[256,256],Af=class extends Xd{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=Tf(this.data_);return t?[t.width,t.height]:Rf}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(kf),this.controller_=null),super.disposeInternal()}},Of=class{constructor(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const t=this.pop();t instanceof b&&t.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return ct(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 ct(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){ct(!(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}},Gf=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(dr(),{get:(t,e)=>{if("function"==typeof dr()[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,n=e.length;i<n;++i){const n=e[i];if("function"==typeof n){n(t);continue}const r=e[++i];if("function"==typeof t[n])t[n](...r);else{if("function"==typeof r){t[n]=r(t);continue}t[n]=r}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},Ff=class extends j{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=5}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return N()}getData(t){return null}prepareFrame(t){return N()}renderFrame(t,e){return N()}forEachFeatureAtCoordinate(t,e,i,n,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;2!==e.getState()&&3!==e.getState()||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return 2!=e&&3!=e&&t.addEventListener(g,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()}},Lf=[];let jf=null;const Nf=class extends Ff{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 n;jf||(jf=ur(1,1,void 0,{willReadFrequently:!0})),jf.clearRect(0,0,1,1);try{jf.drawImage(t,e,i,1,1,0,0,1,1),n=jf.getImageData(0,0,1,1).data}catch{return jf=null,null}return n}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let r,s;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&I(ro(t.style.backgroundColor),ro(i)))){const e=t.firstElementChild;mr(e)&&(s=e.getContext("2d"))}if(s&&function(t,e){const i=Yi(t),n=Yi(e);for(let t=0;t<6;++t)if(0!==Math.round((i[t]-n[t])*Zi[t]))return!1;return!0}(s.canvas.style.transform,e)?(this.container=t,this.context=s,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=Q?gr():document.createElement("div"),r.className=n;let t=r.style;t.position="absolute",t.width="100%",t.height="100%",s=ur();const e=s.canvas;r.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=r,this.context=s}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=ne(i),r=re(i),s=Yt(i),o=Zt(i);Wi(e.coordinateToPixelTransform,n),Wi(e.coordinateToPixelTransform,r),Wi(e.coordinateToPixelTransform,s),Wi(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;Wi(a,n),Wi(a,r),Wi(a,s),Wi(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}prepareContainer(t,e){const i=t.extent,n=t.viewState.resolution,r=t.viewState.rotation,s=t.pixelRatio,o=Math.round(se(i)/n*s),a=Math.round(ee(i)/n*s);Vi(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/s,1/s,r,-o/2,-a/2),Ki(this.inversePixelTransform,this.pixelTransform);const l="matrix("+this.pixelTransform.join(", ")+")";if(this.useContainer(e,l,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),l!==t.style.transform&&(t.style.transform=l)}}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const r=new Jl(t,this.inversePixelTransform,i,e);n.dispatchEvent(r)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(ms,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(ys,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new Gf),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(ms,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(ys,this.context,t))}getRenderTransform(t,e,i,n,r,s,o){const a=r/2,l=s/2,h=n/e,u=-h,c=-t[0]+o,d=-t[1];return Vi(this.tempTransform,a,l,h,u,-i,c,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}};function Df(t,e,i){if(!(i in t))return t[i]=new Set([e]),!0;const n=t[i],r=n.has(e);return r||n.add(e),!r}function zf(t,e,i){const n=t[i];return!!n&&n.delete(e)}function qf(t,e){const i=t.layerStatesArray[t.layerIndex];i.extent&&(e=ie(e,Fi(i.extent,t.viewState.projection)));const n=i.layer.getRenderSource();if(!n.getWrapX()){const i=n.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=ie(e,i))}return e}const Bf=class extends Nf{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 Ld(0,0,0,0),this.tempTileCoord_=jd(0,0,0);const i=void 0!==e.cacheSize?e.cacheSize:512;this.tileCache_=new Of(i),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=.5*i}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Of(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,n){const r=this.tileCache_,s=this.getLayer().getSource(),o=Nd(s,s.getKey(),t,e,i);let a;if(r.containsKey(o))a=r.get(o);else{const l=n.viewState.projection,h=s.getProjection();if(a=s.getTile(t,e,i,n.pixelRatio,l,!h||Mi(h,l)?void 0:this.getSourceTileCache()),!a)return null;r.set(o,a)}return a}getTile(t,e,i,n){return this.getOrCreateTile(t,e,i,n)||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=Wi(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!Gt(r,n))return null;const s=e.viewState,o=i.getRenderSource(),a=o.getTileGridForProjection(s.projection),l=o.getTilePixelRatio(e.pixelRatio);for(let t=a.getZForResolution(s.resolution);t>=a.getMinZoom();--t){const i=a.getTileCoordForCoordAndZ(n,t),r=this.getTile(t,i[1],i[2],e);if(!r||2!==r.getState())continue;const h=a.getOrigin(t),u=ao(a.getTileSize(t)),c=a.getResolution(t);let d;if(r instanceof Vd||r instanceof tf)d=r.getImage();else{if(!(r instanceof Af))continue;if(d=Tf(r.getData()),!d)continue}const f=Math.floor(l*((n[0]-h[0])/c-i[1]*u[0])),p=Math.floor(l*((h[1]-n[1])/c-i[2]*u[1])),g=Math.round(l*o.getGutterForProjection(s.projection));return this.getImageData(d,f+g,p+g)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=i,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,i,n,r){const s=t.viewState,o=this.getLayer(),a=o.getRenderSource(),l=a.getTileGridForProjection(s.projection),h=z(a);h in t.wantedTiles||(t.wantedTiles[h]={});const u=t.wantedTiles[h],c=o.getMapInternal(),d=Math.max(i-r,l.getMinZoom(),l.getZForResolution(Math.min(o.getMaxResolution(),c?c.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):l.getResolution(0)),a.zDirection)),f=s.rotation,p=f?te(s.center,s.resolution,f,t.size):void 0;for(let r=i;r>=d;--r){const i=l.getTileRangeForExtentAndZ(e,r,this.tempTileRange_),s=l.getResolution(r);for(let e=i.minX;e<=i.maxX;++e)for(let o=i.minY;o<=i.maxY;++o){if(f&&!l.tileCoordIntersectsViewport([r,e,o],p))continue;const i=this.getTile(r,e,o,t);if(!i)continue;if(!Df(n,i,r))continue;const a=i.getKey();if(u[a]=!0,0===i.getState()&&!t.tileQueue.isKeyQueued(a)){const n=jd(r,e,o,this.tempTileCoord_);t.tileQueue.enqueue([i,h,l.getTileCoordCenter(n),s])}}}}findStaleTile_(t,e){const i=this.tileCache_,n=t[0],r=t[1],s=t[2],o=this.getStaleKeys();for(let t=0;t<o.length;++t){const a=Nd(this.getLayer().getSource(),o[t],n,r,s);if(i.containsKey(a)){const t=i.peek(a);if(2===t.getState())return t.endTransition(z(this)),Df(e,t,n),!0}}return!1}findAltTiles_(t,e,i,n){const r=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!r)return!1;let s=!0;const o=this.tileCache_,a=this.getLayer().getRenderSource(),l=a.getKey();for(let t=r.minX;t<=r.maxX;++t)for(let e=r.minY;e<=r.maxY;++e){const r=Nd(a,l,i,t,e);let h=!1;if(o.containsKey(r)){const t=o.peek(r);2===t.getState()&&(Df(n,t,i),h=!0)}h||(s=!1)}return s}renderFrame(t,e){this.renderComplete=!0;const i=t.layerStatesArray[t.layerIndex],n=t.viewState,r=n.projection,s=n.resolution,o=n.center,a=t.pixelRatio,l=this.getLayer(),h=l.getSource(),u=h.getTileGridForProjection(r),c=u.getZForResolution(s,h.zDirection),d=u.getResolution(c),f=h.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==f&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=f):this.renderedSourceKey_=f;let p=t.extent;const g=h.getTilePixelRatio(a);this.prepareContainer(t,e);const m=this.context.canvas.width,y=this.context.canvas.height;this.layerExtent=i.extent?Fi(i.extent):null,this.layerExtent&&(p=ie(p,this.layerExtent));const _=d*m/2/g,v=d*y/2/g,x=[o[0]-_,o[1]-v,o[0]+_,o[1]+v],w={};this.renderedTiles.length=0;const b=l.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const e=u.getZForResolution(n.nextResolution,h.zDirection),i=qf(t,t.nextExtent);this.enqueueTiles(t,i,e,w,b)}const M=qf(t,p);if(this.enqueueTiles(t,M,c,w,0),b>0&&setTimeout(()=>{this.enqueueTiles(t,M,c-1,w,b-1)},0),!(c in w))return this.container;const E=z(this),C=t.time;for(const e of w[c]){const i=e.getState();if(4===i)continue;const n=e.tileCoord;if(2===i&&1===e.getAlpha(E,C)){e.endTransition(E);continue}if(3!==i&&(this.renderComplete=!1),this.findStaleTile_(n,w)){zf(w,e,c),t.animate=!0;continue}if(this.findAltTiles_(u,n,c+1,w))continue;const r=u.getMinZoom();for(let t=c-1;t>=r&&!this.findAltTiles_(u,n,t,w);--t);}const P=d/s*a/g,I=this.getRenderContext(t);Vi(this.tempTransform,m/2,y/2,P,P,0,-m/2,-y/2),this.layerExtent&&this.clipUnrotated(I,t,this.layerExtent),h.getInterpolate()||(I.imageSmoothingEnabled=!1),this.preRender(I,t);const T=Object.keys(w).map(Number);let k;T.sort(S);const R=[],A=[];for(let e=T.length-1;e>=0;--e){const i=T[e],n=h.getTilePixelSize(i,a,r),s=u.getResolution(i)/d,o=n[0]*s*P,l=n[1]*s*P,c=u.getTileCoordForCoordAndZ(ne(x),i),f=u.getTileCoordExtent(c),p=Wi(this.tempTransform,[g*(f[0]-x[0])/d,g*(x[3]-f[3])/d]),m=g*h.getGutterForProjection(r);for(const e of w[i]){if(2!==e.getState())continue;const n=e.tileCoord,r=c[1]-n[1],s=Math.round(p[0]-(r-1)*o),a=c[2]-n[2],u=Math.round(p[1]-(a-1)*l),d=Math.round(p[0]-r*o),f=Math.round(p[1]-a*l),g=s-d,y=u-f,_=1===T.length;let v=!1;k=[d,f,d+g,f,d+g,f+y,d,f+y];for(let t=0,e=R.length;t<e;++t)if(!_&&i<A[t]){const e=R[t];oe([d,f,d+g,f+y],[e[0],e[3],e[4],e[7]])&&(v||(I.save(),v=!0),I.beginPath(),I.moveTo(k[0],k[1]),I.lineTo(k[2],k[3]),I.lineTo(k[4],k[5]),I.lineTo(k[6],k[7]),I.moveTo(e[6],e[7]),I.lineTo(e[4],e[5]),I.lineTo(e[2],e[3]),I.lineTo(e[0],e[1]),I.clip())}R.push(k),A.push(i),this.drawTile(e,t,d,f,g,y,m,_),v&&I.restore(),this.renderedTiles.unshift(e),this.updateUsedTiles(t.usedTiles,h,e)}}if(this.renderedResolution=d,this.extentChanged=!this.renderedExtent_||!Bt(this.renderedExtent_,x),this.renderedExtent_=x,this.renderedPixelRatio=a,this.postRender(this.context,t),this.layerExtent&&I.restore(),I.imageSmoothingEnabled=!0,this.renderComplete){const e=(t,e)=>{const i=z(h),n=e.wantedTiles[i],r=n?Object.keys(n).length:0;this.updateCacheSize(r),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(e)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,2*t)}drawTile(t,e,i,n,r,s,o,a){let l;if(t instanceof Af){if(l=Tf(t.getData()),!l)throw new Error("Rendering array data is not yet supported")}else l=this.getTileImage(t);if(!l)return;const h=this.getRenderContext(e),u=z(this),c=e.layerStatesArray[e.layerIndex],d=c.opacity*(a?t.getAlpha(u,e.time):1),f=d!==h.globalAlpha;f&&(h.save(),h.globalAlpha=d),h.drawImage(l,o,o,l.width-2*o,l.height-2*o,i,n,r,s),f&&h.restore(),d!==c.opacity?e.animate=!0:a&&t.endTransition(u)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,i){const n=z(e);n in t||(t[n]={}),t[n][i.getKey()]=!0}},$f="preload",Uf="useInterimTilesOnError",Wf=class extends ws{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($f)}setPreload(t){this.set($f,t)}getUseInterimTilesOnError(){return this.get(Uf)}setUseInterimTilesOnError(t){this.set(Uf,t)}getData(t){return super.getData(t)}},Xf=class extends Wf{constructor(t){super(t)}createRenderer(){return new Bf(this,{cacheSize:this.getCacheSize()})}},Vf=class{drawCustom(t,e,i,n,r){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}},Kf={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},Zf=[Kf.FILL],Yf=[Kf.STROKE],Hf=[Kf.BEGIN_PATH],Jf=[Kf.CLOSE_PATH],Qf=Kf,tp=class extends Vf{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return 1==e?t:t.map(function(t){return t*e})}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,r=this.coordinates;let s=r.length;for(let o=0,a=t.length;o<a;o+=e)n[0]=t[o],n[1]=t[o+1],Gt(i,n)&&(r[s++]=n[0],r[s++]=n[1]);return s}appendFlatLineCoordinates(t,e,i,n,r,s){const o=this.coordinates;let a=o.length;const l=this.getBufferedMaxExtent();s&&(e+=n);let h=t[e],u=t[e+1];const c=this.tmpCoordinate_;let d,f,p,g=!0;for(d=e+n;d<i;d+=n)c[0]=t[d],c[1]=t[d+1],p=jt(l,c),p!==f?(g&&(o[a++]=h,o[a++]=u,g=!1),o[a++]=c[0],o[a++]=c[1]):1===p?(o[a++]=c[0],o[a++]=c[1],g=!1):g=!0,h=c[0],u=c[1],f=p;return(r&&g||d===e+n)&&(o[a++]=h,o[a++]=u),a}drawCustomCoordinates_(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s],a=this.appendFlatLineCoordinates(t,e,o,n,!1,!1);r.push(a),e=o}return e}drawCustom(t,e,i,n,r){this.beginGeometry(t,e,r);const s=t.getType(),o=t.getStride(),a=this.coordinates.length;let l,h,u,c,d;switch(s){case"MultiPolygon":l=t.getOrientedFlatCoordinates(),c=[];const e=t.getEndss();d=0;for(let t=0,i=e.length;t<i;++t){const i=[];d=this.drawCustomCoordinates_(l,d,e[t],o,i),c.push(i)}this.instructions.push([Qf.CUSTOM,a,c,t,i,_n,r]),this.hitDetectionInstructions.push([Qf.CUSTOM,a,c,t,n||i,_n,r]);break;case"Polygon":case"MultiLineString":u=[],l="Polygon"==s?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(l,0,t.getEnds(),o,u),this.instructions.push([Qf.CUSTOM,a,u,t,i,yn,r]),this.hitDetectionInstructions.push([Qf.CUSTOM,a,u,t,n||i,yn,r]);break;case"LineString":case"Circle":l=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(l,0,l.length,o,!1,!1),this.instructions.push([Qf.CUSTOM,a,h,t,i,mn,r]),this.hitDetectionInstructions.push([Qf.CUSTOM,a,h,t,n||i,mn,r]);break;case"MultiPoint":l=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(l,o),h>a&&(this.instructions.push([Qf.CUSTOM,a,h,t,i,mn,r]),this.hitDetectionInstructions.push([Qf.CUSTOM,a,h,t,n||i,mn,r]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([Qf.CUSTOM,a,h,t,i,void 0,r]),this.hitDetectionInstructions.push([Qf.CUSTOM,a,h,t,n||i,void 0,r])}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[Qf.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[Qf.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let n,r,s=-1;for(e=0;e<i;++e)n=t[e],r=n[0],r==Qf.END_GEOMETRY?s=e:r==Qf.BEGIN_GEOMETRY&&(n[2]=e,C(this.hitDetectionInstructions,s,e),s=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&"object"==typeof i&&"src"in i?this.pixelRatio:1,e.fillStyle=Da(i||qa)??void 0}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=Da(i||Wa);const n=t.getLineCap();e.lineCap=void 0!==n?n:Ba;const r=t.getLineDash();e.lineDash=r?r.slice():$a;const s=t.getLineDashOffset();e.lineDashOffset=s||0;const o=t.getLineJoin();e.lineJoin=void 0!==o?o:Ua;const a=t.getWidth();e.lineWidth=void 0!==a?a:1;const l=t.getMiterLimit();e.miterLimit=void 0!==l?l:10;const h=t.getOffset();e.strokeOffset=h??0,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0,e.strokeOffset=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[Qf.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[Qf.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;(void 0!==i&&"string"!=typeof i||t.currentFillStyle!=i)&&(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,r=t.lineDash,s=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit,h=t.strokeOffset;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!I(t.currentLineDash,r)||t.currentLineDashOffset!=s||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l||t.currentStrokeOffset!=h)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=s,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l,t.currentStrokeOffset=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[Qf.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=At(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;Rt(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},ep=class extends tp{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinatess_(t,e,i,n,r){const s=this.state,o=void 0!==s.fillStyle,a=void 0!==s.strokeStyle,l=i.length;this.instructions.push(Hf),this.hitDetectionInstructions.push(Hf);for(let s=0;s<l;++s){const o=i[s],l=this.coordinates.length,h=this.appendFlatLineCoordinates(t,e,o,n,!0,!a);this.instructions.push([Qf.MOVE_TO_LINE_TO,l,h,r*this.pixelRatio,!0]),this.hitDetectionInstructions.push([Qf.MOVE_TO_LINE_TO,l,h,r,!0]),a&&(this.instructions.push(Jf),this.hitDetectionInstructions.push(Jf)),e=o}return o&&(this.instructions.push(Zf),this.hitDetectionInstructions.push(Zf)),a&&(this.instructions.push(Yf),this.hitDetectionInstructions.push(Yf)),e}drawCircle(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_(()=>this.drawCircle(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Qf.SET_FILL_STYLE,qa]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Qf.SET_STROKE_STYLE,Wa,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,$a,0]);const a=t.getFlatCoordinates(),l=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const u=[Qf.CIRCLE,h,o];this.instructions.push(Hf,u),this.hitDetectionInstructions.push(Hf,u),void 0!==n.fillStyle&&(this.instructions.push(Zf),this.hitDetectionInstructions.push(Zf)),void 0!==n.strokeStyle&&(this.instructions.push(Yf),this.hitDetectionInstructions.push(Yf)),this.endGeometry(e)}drawPolygon(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_(()=>this.drawPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Qf.SET_FILL_STYLE,qa]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Qf.SET_STROKE_STYLE,Wa,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,$a,0]);const a=t.getEnds(),l=t.getOrientedFlatCoordinates(),h=t.getStride();this.drawFlatCoordinatess_(l,0,a,h,o),this.endGeometry(e)}drawMultiPolygon(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_(()=>this.drawMultiPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Qf.SET_FILL_STYLE,qa]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Qf.SET_STROKE_STYLE,Wa,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,$a,0]);const a=t.getEndss(),l=t.getOrientedFlatCoordinates(),h=t.getStride();let u=0;for(let t=0,e=a.length;t<e;++t)u=this.drawFlatCoordinatess_(l,u,a[t],h,o);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(0!==t){const e=this.coordinates;for(let i=0,n=e.length;i<n;++i)e[i]=wn(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}handleStrokeOffset_(t){const e=this.state,i=e.fillStyle,n=e.strokeStyle,r=e.strokeOffset;return Math.abs(r)>0&&void 0!==i&&void 0!==n&&(e.strokeStyle=void 0,e.strokeOffset=0,t(),e.fillStyle=void 0,e.strokeStyle=n,e.strokeOffset=r,t(),e.fillStyle=i,!0)}};function ip(t,e,i,n,r){const s=[];let o=i,a=0,l=e.slice(i,2);for(;a<t&&o+r<n;){const[i,n]=l.slice(-2),h=e[o+r],u=e[o+r+1],c=Math.sqrt((h-i)*(h-i)+(u-n)*(u-n));if(a+=c,a>=t){const e=(t-a+c)/c,d=bt(i,h,e),f=bt(n,u,e);l.push(d,f),s.push(l),l=[d,f],a==t&&(o+=r),a=0}else if(a<t)l.push(e[o+r],e[o+r+1]),o+=r;else{const t=c-a,e=bt(i,h,t/c),d=bt(n,u,t/c);l.push(e,d),s.push(l),l=[e,d],a=0,o+=r}}return a>0&&s.push(l),s}function np(t,e,i,n,r){let s,o,a,l,h,u,c,d,f,p,g=i,m=i,y=0,_=0,v=i;for(o=i;o<n;o+=r){const i=e[o],n=e[o+1];void 0!==h&&(f=i-h,p=n-u,l=Math.sqrt(f*f+p*p),void 0!==c&&(_+=a,s=Math.acos((c*f+d*p)/(a*l)),s>t&&(_>y&&(y=_,g=v,m=o),_=0,v=o-r)),a=l,c=f,d=p),h=i,u=n}return _+=l,_>y?[v,o]:[g,m]}const rp={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},sp={Circle:ep,Default:tp,Image:class extends tp{constructor(t,e,i,n){super(t,e,i,n),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!Gt(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=t.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(n,r);this.instructions.push([Qf.DRAW_IMAGE,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([Qf.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=[];for(let e=0,i=n.length;e<i;e+=t.getStride())this.maxExtent&&!Gt(this.maxExtent,n.slice(e,e+2))||r.push(n[e],n[e+1]);const s=this.coordinates.length,o=this.appendFlatPointCoordinates(r,2);this.instructions.push([Qf.DRAW_IMAGE,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([Qf.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),n=t.getSize(),r=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}},LineString:class extends tp{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n,r){const s=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,n,!1,!1);return this.instructions.push([Qf.MOVE_TO_LINE_TO,s,o,r*this.pixelRatio]),this.hitDetectionInstructions.push([Qf.MOVE_TO_LINE_TO,s,o,r]),i}drawLineString(t,e,i){const n=this.state,r=n.strokeStyle,s=n.lineWidth,o=n.strokeOffset;if(void 0===r||void 0===s)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([Qf.SET_STROKE_STYLE,Wa,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,$a,0],Hf);const a=t.getFlatCoordinates(),l=t.getStride();this.drawFlatCoordinates_(a,0,a.length,l,o),this.hitDetectionInstructions.push(Yf),this.endGeometry(e)}drawMultiLineString(t,e,i){const n=this.state,r=n.strokeStyle,s=n.lineWidth,o=n.strokeOffset;if(void 0===r||void 0===s)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([Qf.SET_STROKE_STYLE,Wa,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,$a,0],Hf);const a=t.getEnds(),l=t.getFlatCoordinates(),h=t.getStride();let u=0;for(let t=0,e=a.length;t<e;++t)u=this.drawFlatCoordinates_(l,u,a[t],h,o);this.hitDetectionInstructions.push(Yf),this.endGeometry(e)}finish(){const t=this.state;return null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(Yf),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(Yf),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(Hf)}},Polygon:ep,Text:class extends tp{constructor(t,e,i,n){super(t,e,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[qa]={fillStyle:qa},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){const n=this.textFillState_,r=this.textStrokeState_,s=this.textState_;if(""===this.text_||!s||!n&&!r)return;const o=this.coordinates;let a=o.length;const l=t.getType();let h=null,u=t.getStride();if("line"!==s.placement||"LineString"!=l&&"MultiLineString"!=l&&"Polygon"!=l&&"MultiPolygon"!=l){let n=s.overflow?null:[];switch(l){case"Point":case"MultiPoint":h=t.getFlatCoordinates();break;case"LineString":h=t.getFlatMidpoint();break;case"Circle":h=t.getCenter();break;case"MultiLineString":h=t.getFlatMidpoints(),u=2;break;case"Polygon":h=t.getFlatInteriorPoint(),s.overflow||n.push(h[2]/this.resolution),u=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();h=[];for(let t=0,i=e.length;t<i;t+=3)s.overflow||n.push(e[t+2]/this.resolution),h.push(e[t],e[t+1]);if(0===h.length)return;u=2}const r=this.appendFlatPointCoordinates(h,u);if(r===a)return;if(n&&(r-a)/2!==h.length/u){let t=a/2;n=n.filter((e,i)=>{const n=o[2*(t+i)]===h[i*u]&&o[2*(t+i)+1]===h[i*u+1];return n||--t,n})}this.saveTextStates_();const c=s.backgroundFill?this.createFill(this.fillStyleToState(s.backgroundFill)):null,d=s.backgroundStroke?this.createStroke(this.strokeStyleToState(s.backgroundStroke)):null;this.beginGeometry(t,e,i);let f=s.padding;if(f!=Ka&&(s.scale[0]<0||s.scale[1]<0)){let t=s.padding[0],e=s.padding[1],i=s.padding[2],n=s.padding[3];s.scale[0]<0&&(e=-e,n=-n),s.scale[1]<0&&(t=-t,i=-i),f=[t,e,i,n]}const p=this.pixelRatio;this.instructions.push([Qf.DRAW_IMAGE,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,f==Ka?Ka:f.map(function(t){return t*p}),c,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]);const g=1/p,m=c?c.slice(0):null;m&&(m[1]=qa),this.hitDetectionInstructions.push([Qf.DRAW_IMAGE,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[g,g],NaN,this.declutterMode_,this.declutterImageWithText_,f,m,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?qa:this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]),this.endGeometry(e)}else{if(!oe(this.maxExtent,t.getExtent()))return;let n;if(h=t.getFlatCoordinates(),"LineString"==l)n=[h.length];else if("MultiLineString"==l)n=t.getEnds();else if("Polygon"==l)n=t.getEnds().slice(0,1);else if("MultiPolygon"==l){const e=t.getEndss();n=[];for(let t=0,i=e.length;t<i;++t)n.push(e[t][0])}this.beginGeometry(t,e,i);const r=s.repeat,c=r?void 0:s.textAlign;let d=0;for(let t=0,e=n.length;t<e;++t){let e;e=r?ip(r*this.resolution,h,d,n[t],u):[h.slice(d,n[t])];for(let i=0,r=e.length;i<r;++i){const r=e[i];let l=0,h=r.length;if(null==c){const t=np(s.maxAngle,r,0,r.length,2);l=t[0],h=t[1]}for(let t=l;t<h;t+=u)o.push(r[t],r[t+1]);const f=o.length;d=n[t],this.drawChars_(a,f),a=f}}this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,n=this.strokeKey_;t&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const r=this.textKey_;r in this.textStates||(this.textStates[r]={font:e.font,textAlign:e.textAlign||Xa,justify:e.justify,textBaseline:e.textBaseline||Va,scale:e.scale});const s=this.fillKey_;i&&(s in this.fillStates||(this.fillStates[s]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,n=this.textState_,r=this.strokeKey_,s=this.textKey_,o=this.fillKey_;this.saveTextStates_();const a=this.pixelRatio,l=rp[n.textBaseline],h=this.textOffsetY_*a,u=this.text_,c=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([Qf.DRAW_CHARS,t,e,l,n.overflow,o,n.maxAngle,a,h,r,c*a,u,s,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([Qf.DRAW_CHARS,t,e,l,n.overflow,o?qa:o,n.maxAngle,a,h,r,c*a,u,s,1/a,this.declutterMode_,this.textKeepUpright_])}setTextStyle(t,e){let i,n,r;if(t){const e=t.getFill();e?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=Da(e.getColor()||qa)):(n=null,this.textFillState_=n);const s=t.getStroke();if(s){r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const t=s.getLineDash(),e=s.getLineDashOffset(),i=s.getWidth(),n=s.getMiterLimit();r.lineCap=s.getLineCap()||Ba,r.lineDash=t?t.slice():$a,r.lineDashOffset=void 0===e?0:e,r.lineJoin=s.getLineJoin()||Ua,r.lineWidth=void 0===i?1:i,r.miterLimit=void 0===n?10:n,r.strokeStyle=Da(s.getColor()||Wa)}else r=null,this.textStrokeState_=r;i=this.textState_;const o=t.getFont()||za;el(o);const a=t.getScaleArray();i.overflow=t.getOverflow(),i.font=o,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||Va,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||Ka,i.scale=void 0===a?[1,1]:a;const l=t.getOffsetX(),h=t.getOffsetY(),u=t.getRotateWithView(),c=t.getKeepUpright(),d=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=void 0===l?0:l,this.textOffsetY_=void 0===h?0:h,this.textRotateWithView_=void 0!==u&&u,this.textKeepUpright_=void 0===c||c,this.textRotation_=void 0===d?0:d,this.strokeKey_=r?("string"==typeof r.strokeStyle?r.strokeStyle:z(r.strokeStyle))+r.lineCap+r.lineDashOffset+"|"+r.lineWidth+r.lineJoin+r.miterLimit+"["+r.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=n&&n.fillStyle?"string"==typeof n.fillStyle?n.fillStyle:"|"+z(n.fillStyle):""}else this.text_="";this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}},op=class{constructor(t,e,i,n){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=n,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const n in i){const r=i[n].finish();t[e][n]=r}}return t}getBuilder(t,e){const i=void 0!==t?t.toString():"0";let n=this.buildersByZIndex_[i];void 0===n&&(n={},this.buildersByZIndex_[i]=n);let r=n[e];return void 0===r&&(r=new(0,sp[e])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=r),r}};function ap(t,e,i,n){let r=t[e],s=t[e+1],o=0;for(let a=e+n;a<i;a+=n){const e=t[a],i=t[a+1];o+=Math.sqrt((e-r)*(e-r)+(i-s)*(i-s)),r=e,s=i}return o}function lp(t,e,i,n,r,s,o,a){o=o??[],a=a??n;const l=t[e+n],h=t[e+n+1],u=t[i-2*n],c=t[i-2*n+1];let d,f,p,g,m,y,_,v,x=0;for(let w=e;w<i;w+=n){p=d,g=f,m=void 0,y=void 0,w+n<i&&(m=t[w+n],y=t[w+n+1]),s&&w===e&&(p=u,g=c),s&&w===i-n&&(m=l,y=h),d=t[w],f=t[w+1],[_,v]=hp(d,f,p,g,m,y,r),o[x++]=_,o[x++]=v;for(let e=2;e<a;e++)o[x++]=t[w+e]}return o.length!=x&&(o.length=x),o}function hp(t,e,i,n,r,s,o){let a,l;void 0!==i&&void 0!==n?(a=t-i,l=e-n):void 0!==r&&void 0!==s?(a=r-t,l=s-e):(a=1,l=0);const h=Math.hypot(a,l),u=a/h,c=l/h;if(a=-c,l=u,void 0===i||void 0===n)return[t+a*o,e+l*o];if(void 0===r||void 0===s)return[t+a*o,e+l*o];const d=function(t,e,i){const n=Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),r=[(e[0]-t[0])/n,(e[1]-t[1])/n],s=[-r[1],r[0]],o=Math.sqrt((i[0]-t[0])*(i[0]-t[0])+(i[1]-t[1])*(i[1]-t[1])),a=[(i[0]-t[0])/o,(i[1]-t[1])/o];let l=0===n||0===o?0:Math.acos(mt(a[0]*r[0]+a[1]*r[1],-1,1));return l=Math.max(l,1e-5),a[0]*s[0]+a[1]*s[1]>0?l:2*Math.PI-l}([t,e],[i,n],[r,s]);if(Math.cos(d)>.998)return[t+u*o,e+c*o];const f=Math.cos(d/2),p=Math.sin(d/2);return[t+1/p*(p*a+f*l)*o,e+1/p*(-f*a+p*l)*o]}function up(t,e){for(let i=0,n=t.length-2;i<n;i+=e)for(let n=t.length-2*e;n>i+e;n-=e){const r=t[i],s=t[i+1],o=t[i+e],a=t[i+e+1],l=t[n],h=t[n+1],u=t[n+e],c=t[n+e+1],d=(c-h)*(o-r)-(u-l)*(a-s);if(0===d)continue;const f=((u-l)*(s-h)-(c-h)*(r-l))/d,p=((o-r)*(s-h)-(a-s)*(r-l))/d;if(f>0&&f<1&&p>0&&p<1){const l=r+f*(o-r),h=s+f*(a-s);t[i+e]=l,t[i+e+1]=h,t.splice(i+2*e,n-i-e);break}}return t}function cp(t,e,i,n,r,s,o,a,l,h,u,c,d=!0){let f=t[e],p=t[e+1],g=0,m=0,y=0,_=0;function v(){g=f,m=p,f=t[e+=n],p=t[e+1],_+=y,y=Math.sqrt((f-g)*(f-g)+(p-m)*(p-m))}do{v()}while(e<i-n&&_+y<s);let x=0===y?0:(s-_)/y;const w=bt(g,f,x),b=bt(m,p,x),S=e-n,M=_,E=s+a*l(h,r,u);for(;e<i-n&&_+y<E;)v();x=0===y?0:(E-_)/y;const C=bt(g,f,x),P=bt(m,p,x);let I=!1;if(d)if(c){const t=[w,b,C,P];Ji(t,0,4,2,c,t,t),I=t[0]>t[2]}else I=w>C;const T=Math.PI,k=[],R=S+n===e;let A;if(y=0,_=M,f=t[e=S],p=t[e+1],R){v(),A=Math.atan2(p-m,f-g),I&&(A+=A>0?-T:T);const t=(C+w)/2,e=(P+b)/2;return k[0]=[t,e,(E-s)/2,A,r],k}for(let t=0,c=(r=r.replace(/\n/g," ")).length;t<c;){v();let d=Math.atan2(p-m,f-g);if(I&&(d+=d>0?-T:T),void 0!==A){let t=d-A;if(t+=t>T?-2*T:t<-T?2*T:0,Math.abs(t)>o)return null}A=d;const w=t;let b=0;for(;t<c;++t){const o=a*l(h,r[I?c-t-1:t],u);if(e+n<i&&_+y<s+b+o/2)break;b+=o}if(t===w)continue;const S=I?r.substring(c-w,c-t):r.substring(w,t);x=0===y?0:(s+b/2-_)/y;const M=bt(g,f,x),E=bt(m,p,x);k.push([M,E,b/2,d,S]),s+=b}return k}const dp=[1/0,1/0,-1/0,-1/0],fp=[],pp=[],gp=[],mp=[];function yp(t){return t[3].declutterBox}const _p=new RegExp("["+String.fromCharCode(1425)+"-"+String.fromCharCode(2303)+String.fromCharCode(64285)+"-"+String.fromCharCode(65023)+String.fromCharCode(65136)+"-"+String.fromCharCode(65276)+String.fromCharCode(67584)+"-"+String.fromCharCode(69631)+String.fromCharCode(124928)+"-"+String.fromCharCode(126975)+"]");function vp(t,e){return"start"===e?e=_p.test(t)?"right":"left":"end"===e&&(e=_p.test(t)?"left":"right"),rp[e]}function xp(t,e,i){return i>0&&t.push("\n",""),t.push(e,""),t}function wp(t,e,i){return i%2==0&&(t+=e),t}const bp=class{constructor(t,e,i,n,r){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=[1,0,0,1,0,0],this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=r?new Gf:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,n){const r=t+e+i+n;if(this.labels_[r])return this.labels_[r];const s=n?this.strokeStates[n]:null,o=i?this.fillStates[i]:null,a=this.textStates[e],l=this.pixelRatio,h=[a.scale[0]*l,a.scale[1]*l],u=a.justify?rp[a.justify]:vp(Array.isArray(t)?t[0]:t,a.textAlign||Xa),c=n&&s.lineWidth?s.lineWidth:0,d=Array.isArray(t)?t:String(t).split("\n").reduce(xp,[]),{width:f,height:p,widths:g,heights:m,lineWidths:y}=function(t,e){const i=[],n=[],r=[];let s=0,o=0,a=0,l=0;for(let h=0,u=e.length;h<=u;h+=2){const c=e[h];if("\n"===c||h===u){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}const d=e[h+1]||t.font,f=rl(d,c);i.push(f),o+=f;const p=il(d);n.push(p),l=Math.max(l,p)}return{width:s,height:a,widths:i,heights:n,lineWidths:r}}(a,d),_=f+c,v=[],x=(_+2)*h[0],w=(p+c)*h[1],b={width:x<0?Math.floor(x):Math.ceil(x),height:w<0?Math.floor(w):Math.ceil(w),contextInstructions:v};1==h[0]&&1==h[1]||v.push("scale",h),n&&(v.push("strokeStyle",s.strokeStyle),v.push("lineWidth",c),v.push("lineCap",s.lineCap),v.push("lineJoin",s.lineJoin),v.push("miterLimit",s.miterLimit),v.push("setLineDash",[s.lineDash]),v.push("lineDashOffset",s.lineDashOffset)),i&&v.push("fillStyle",o.fillStyle),v.push("textBaseline","middle"),v.push("textAlign","center");const S=.5-u;let M=u*_+S*c;const E=[],C=[];let P,I=0,T=0,k=0,R=0;for(let t=0,e=d.length;t<e;t+=2){const e=d[t];if("\n"===e){T+=I,I=0,M=u*_+S*c,++R;continue}const r=d[t+1]||a.font;r!==P&&(n&&E.push("font",r),i&&C.push("font",r),P=r),I=Math.max(I,m[k]);const s=[e,M+S*g[k]+u*(g[k]-y[R]),.5*(c+I)+T];M+=g[k],n&&E.push("strokeText",s),i&&C.push("fillText",s),++k}return Array.prototype.push.apply(v,E),Array.prototype.push.apply(v,C),this.labels_[r]=b,b}replayTextBackground_(t,e,i,n,r,s,o){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,n),t.lineTo.apply(t,r),t.lineTo.apply(t,e),s&&(this.alignAndScaleFill_=s[2],t.fillStyle=s[1],this.fill_(t)),o&&(this.setStrokeStyle_(t,o),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,n,r,s,o,a,l,h,u,c,d,f,p,g){let m=i-(o*=c[0]),y=n-(a*=c[1]);const _=r+l>t?t-l:r,v=s+h>e?e-h:s,x=f[3]+_*c[0]+f[1],w=f[0]+v*c[1]+f[2],b=m-f[3],S=y-f[0];let M;return(p||0!==u)&&(fp[0]=b,mp[0]=b,fp[1]=S,pp[1]=S,pp[0]=b+x,gp[0]=pp[0],gp[1]=S+w,mp[1]=gp[1]),0!==u?(M=Vi([1,0,0,1,0,0],i,n,1,1,u,-i,-n),Wi(M,fp),Wi(M,pp),Wi(M,gp),Wi(M,mp),Nt(Math.min(fp[0],pp[0],gp[0],mp[0]),Math.min(fp[1],pp[1],gp[1],mp[1]),Math.max(fp[0],pp[0],gp[0],mp[0]),Math.max(fp[1],pp[1],gp[1],mp[1]),dp)):Nt(Math.min(b,b+x),Math.min(S,S+w),Math.max(b,b+x),Math.max(S,S+w),dp),d&&(m=Math.round(m),y=Math.round(y)),{drawImageX:m,drawImageY:y,drawImageW:_,drawImageH:v,originX:l,originY:h,declutterBox:{minX:dp[0],minY:dp[1],maxX:dp[2],maxY:dp[3],value:g},canvasTransform:M,scale:c}}replayImageOrLabel_(t,e,i,n,r,s,o){const a=!(!s&&!o),l=n.declutterBox,h=o?o[2]*n.scale[0]/2:0;return l.minX-h<=e[0]&&l.maxX+h>=0&&l.minY-h<=e[1]&&l.maxY+h>=0&&(a&&this.replayTextBackground_(t,fp,pp,gp,mp,s,o),function(t,e,i,n,r,s,o,a,l,h,u){t.save(),1!==i&&(void 0===t.globalAlpha?t.globalAlpha=t=>t.globalAlpha*=i:t.globalAlpha*=i),e&&t.transform.apply(t,e),n.contextInstructions?(t.translate(l,h),t.scale(u[0],u[1]),function(t,e){const i=t.contextInstructions;for(let t=0,n=i.length;t<n;t+=2)Array.isArray(i[t+1])?e[i[t]].apply(e,i[t+1]):e[i[t]]=i[t+1]}(n,t)):u[0]<0||u[1]<0?(t.translate(l,h),t.scale(u[0],u[1]),t.drawImage(n,r,s,o,a,0,0,o,a)):t.drawImage(n,r,s,o,a,l,h,o*u[0],a*u[1]),t.restore()}(t,n.canvasTransform,r,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=Wi(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(i[0]%n,i[1]%n),1!==e&&t.scale(e,e)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,n){const r=this.textStates[e],s=this.createLabel(t,e,n,i),o=this.strokeStates[i],a=this.pixelRatio,l=vp(Array.isArray(t)?t[0]:t,r.textAlign||Xa),h=rp[r.textBaseline||Va],u=o&&o.lineWidth?o.lineWidth:0;return{label:s,anchorX:l*(s.width/a-2*r.scale[0])+2*(.5-l)*u,anchorY:h*s.height/a+2*(.5-h)*u}}execute_(t,e,i,n,r,s,o,a){const l=this.zIndexContext_;let h;var u,c;this.pixelCoordinates_&&I(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=Hi(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),c=i,(u=this.renderedTransform_)[0]=c[0],u[1]=c[1],u[2]=c[2],u[3]=c[3],u[4]=c[4],u[5]=c[5]);let d=0;const f=n.length;let p,g=0;const m=[];let y,_,v,x,w,b,S,M,E,C,P,T,k,R=0,A=0;const O=this.coordinateCache_,G=this.viewRotation_,F=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,L={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:G},j=this.instructions!=n||this.overlaps?0:200;let N,D,z,q;for(;d<f;){const i=n[d];switch(i[0]){case Qf.BEGIN_GEOMETRY:N=i[1],q=i[3],N.getGeometry()?void 0===o||oe(o,q.getExtent())?++d:d=i[2]+1:d=i[2],l&&(l.zIndex=i[4]);break;case Qf.BEGIN_PATH:R>j&&(this.fill_(t),R=0),A>j&&(t.stroke(),A=0),R||A||(t.beginPath(),w=NaN,b=NaN),++d;break;case Qf.CIRCLE:g=i[1],v=i[2]??0;const n=h[g],u=h[g+1],c=h[g+2]-v-n,f=h[g+3]-v-u,I=Math.sqrt(c*c+f*f);t.moveTo(n+I,u),t.arc(n,u,I,0,2*Math.PI,!0),++d;break;case Qf.CLOSE_PATH:t.closePath(),++d;break;case Qf.CUSTOM:g=i[1],p=i[2];const B=i[3],$=i[4],U=i[5];L.geometry=B,L.feature=N,d in O||(O[d]=[]);const W=O[d];U?U(h,g,p,2,W):(W[0]=h[g],W[1]=h[g+1],W.length=2),l&&(l.zIndex=i[6]),$(W,L),++d;break;case Qf.DRAW_IMAGE:g=i[1],p=i[2],E=i[3],y=i[4],_=i[5];let X=i[6];const V=i[7],K=i[8],Z=i[9],Y=i[10];let H=i[11];const J=i[12];let Q=i[13];x=i[14]||"declutter";const tt=i[15];if(!E&&i.length>=20){C=i[19],P=i[20],T=i[21],k=i[22];const t=this.drawLabelWithPointPlacement_(C,P,T,k);E=t.label,i[3]=E;const e=i[23];y=(t.anchorX-e)*this.pixelRatio,i[4]=y;const n=i[24];_=(t.anchorY-n)*this.pixelRatio,i[5]=_,X=E.height,i[6]=X,Q=E.width,i[13]=Q}let et,it,nt,rt;i.length>25&&(et=i[25]),i.length>17?(it=i[16],nt=i[17],rt=i[18]):(it=Ka,nt=null,rt=null),Y&&F?H+=G:Y||F||(H-=G);let st=0;for(;g<p;g+=2){if(et&&et[st++]<Q/this.pixelRatio)continue;const i=this.calculateImageOrLabelDimensions_(E.width,E.height,h[g],h[g+1],Q,X,y,_,K,Z,H,J,r,it,!!nt||!!rt,N),n=[t,e,E,i,V,nt,rt];if(a){let t,e,r,s,o;if(tt){const i=p-g;if(!tt[i]){tt[i]={args:n,declutterMode:x};continue}const s=tt[i];t=s.args,e=s.declutterMode,delete tt[i],r=yp(t)}if(!t||"declutter"===e&&a.collides(r)||(s=!0),"declutter"===x&&a.collides(i.declutterBox)||(o=!0),"declutter"===e&&"declutter"===x){const t=s&&o;s=t,o=t}s&&("none"!==e&&a.insert(r),this.replayImageOrLabel_.apply(this,t)),o&&("none"!==x&&a.insert(i.declutterBox),this.replayImageOrLabel_.apply(this,n))}else this.replayImageOrLabel_.apply(this,n)}++d;break;case Qf.DRAW_CHARS:const ot=i[1],at=i[2],lt=i[3],ht=i[4];k=i[5];const ut=i[6],ct=i[7],dt=i[8];T=i[9];const ft=i[10];C=i[11],Array.isArray(C)&&(C=C.reduce(wp,"")),P=i[12];const pt=[i[13],i[13]];x=i[14]||"declutter";const gt=i[15],mt=this.textStates[P],yt=mt.font,_t=[mt.scale[0]*ct,mt.scale[1]*ct];let vt;yt in this.widths_?vt=this.widths_[yt]:(vt={},this.widths_[yt]=vt);const xt=ap(h,ot,at,2),wt=Math.abs(_t[0])*sl(yt,C,vt);if(ht||wt<=xt){const i=cp(h,ot,at,2,C,(xt-wt)*vp(C,this.textStates[P].textAlign),ut,Math.abs(_t[0]),sl,yt,vt,F?0:this.viewRotation_,gt);t:if(i){const n=[];let r,s,o,l,h;if(T)for(r=0,s=i.length;r<s;++r){h=i[r],o=h[4],l=this.createLabel(o,P,"",T),y=h[2]+(_t[0]<0?-ft:ft),_=lt*l.height+2*(.5-lt)*ft*_t[1]/_t[0]-dt;const s=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,y,_,0,0,h[3],pt,!1,Ka,!1,N);if(a&&"declutter"===x&&a.collides(s.declutterBox))break t;n.push([t,e,l,s,1,null,null])}if(k)for(r=0,s=i.length;r<s;++r){h=i[r],o=h[4],l=this.createLabel(o,P,k,""),y=h[2],_=lt*l.height-dt;const s=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,y,_,0,0,h[3],pt,!1,Ka,!1,N);if(a&&"declutter"===x&&a.collides(s.declutterBox))break t;n.push([t,e,l,s,1,null,null])}a&&"none"!==x&&a.load(n.map(yp));for(let t=0,e=n.length;t<e;++t)this.replayImageOrLabel_.apply(this,n[t])}}++d;break;case Qf.END_GEOMETRY:if(void 0!==s){N=i[1];const t=s(N,q,x);if(t)return t}++d;break;case Qf.FILL:j?R++:this.fill_(t),++d;break;case Qf.MOVE_TO_LINE_TO:let bt,St,Mt;g=i[1],p=i[2],v=i[3],v?(lp(h,g,p,2,v,i[4]??!1,m),up(m,2),bt=m,St=0,Mt=bt.length):(bt=h,St=g,Mt=p),D=bt[St],z=bt[St+1],t.moveTo(D,z),w=D+.5|0,b=z+.5|0;for(let e=St+2;e<Mt;e+=2)D=bt[e],z=bt[e+1],S=D+.5|0,M=z+.5|0,e!=Mt-2&&S===w&&M===b||(t.lineTo(D,z),w=S,b=M);++d;break;case Qf.SET_FILL_STYLE:this.alignAndScaleFill_=i[2],R?(this.fill_(t),R=0,A&&(t.stroke(),A=0)):A&&i[1]&&(t.stroke(),A=0),t.fillStyle=i[1],++d;break;case Qf.SET_STROKE_STYLE:R&&i[1]&&(this.fill_(t),R=0),A&&(t.stroke(),A=0),this.setStrokeStyle_(t,i),++d;break;case Qf.STROKE:j?A++:t.stroke(),++d;break;default:++d}}R&&this.fill_(t),A&&t.stroke()}execute(t,e,i,n,r,s){this.viewRotation_=n,this.execute_(t,e,i,this.instructions,r,void 0,void 0,s)}executeHitDetection(t,e,i,n,r){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,n,r)}},Sp=["Polygon","Circle","LineString","Image","Text","Default"],Mp=["Image","Text"],Ep=Sp.filter(t=>!Mp.includes(t));let Cp=!1,Pp=!1;const Ip={},Tp=class{constructor(t,e,i,n,r,s,o){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=s,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=[1,0,0,1,0,0],this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,o)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let n=this.executorsByZIndex_[i];void 0===n&&(n={},this.executorsByZIndex_[i]=n);const r=t[i];for(const t in r){const i=r[t];n[t]=new bp(this.resolution_,this.pixelRatio_,this.overlaps_,i,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let e=0,n=t.length;e<n;++e)if(t[e]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,n,r,s){!1===Pp&&function(){let t=0;const e=e=>{const i=ur(1,1,null,{willReadFrequently:e});let n=0;const r=performance.now();for(;performance.now()-r<50;++n)i.fillStyle=`rgba(255,0,${n%256},1)`,i.fillRect(0,0,1,1),i.getImageData(0,0,1,1);return t=n>t?n:t,n},i={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0};Cp=i[t],Pp=!0}();const o=2*(n=Math.round(n))+1,a=Vi(this.hitDetectionTransform_,n+.5,n+.5,1/e,-1/e,-i,-t[0],-t[1]),l=!this.hitDetectionContext_;l&&(this.hitDetectionContext_=ur(o,o,null,{willReadFrequently:Cp}));const h=this.hitDetectionContext_;let u;h.canvas.width!==o||h.canvas.height!==o?(h.canvas.width=o,h.canvas.height=o):l||h.clearRect(0,0,o,o),void 0!==this.renderBuffer_&&(u=[1/0,1/0,-1/0,-1/0],Ut(u,t),Rt(u,e*(this.renderBuffer_+n),u));const c=function(t){if(void 0!==Ip[t])return Ip[t];const e=2*t+1,i=t*t,n=new Array(i+1);for(let r=0;r<=t;++r)for(let s=0;s<=t;++s){const o=r*r+s*s;if(o>i)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+r)*e+(t+s))+3),r>0&&a.push(4*((t-r)*e+(t+s))+3),s>0&&(a.push(4*((t+r)*e+(t-s))+3),r>0&&a.push(4*((t-r)*e+(t-s))+3))}const r=[];for(let t=0,e=n.length;t<e;++t)n[t]&&r.push(...n[t]);return Ip[t]=r,r}(n);let d;function f(t,e,i){const a=h.getImageData(0,0,o,o).data;for(let l=0,u=c.length;l<u;l++)if(a[c[l]]>0){if(!s||"none"===i||"Image"!==d&&"Text"!==d||s.includes(t)){const i=(c[l]-3)/4,s=n-i%o,a=n-(i/o|0),h=r(t,e,s*s+a*a);if(h)return h}h.clearRect(0,0,o,o);break}}const p=Object.keys(this.executorsByZIndex_).map(Number);let g,m,y,_,v;for(p.sort(S),g=p.length-1;g>=0;--g){const t=p[g].toString();for(y=this.executorsByZIndex_[t],m=Sp.length-1;m>=0;--m)if(d=Sp[m],_=y[d],void 0!==_&&(v=_.executeHitDetection(h,a,i,f,u),v))return v}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],r=e[2],s=e[3],o=[i,n,i,s,r,s,r,n];return Hi(o,0,8,2,t,o),o}isEmpty(){return c(this.executorsByZIndex_)}execute(t,e,i,n,r,s,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?M:S),s=s||Sp;const l=Sp.length;for(let h=0,u=a.length;h<u;++h){const u=a[h].toString(),c=this.executorsByZIndex_[u];for(let u=0,d=s.length;u<d;++u){const d=s[u],f=c[d];if(void 0!==f){const s=null===o?void 0:f.getZIndexContext(),u=s?s.getContext():t,c=this.maxExtent_&&"Image"!==d&&"Text"!==d;if(c&&(u.save(),this.clip(u,i)),s&&"Text"!==d&&"Image"!==d?s.pushFunction(t=>f.execute(t,e,i,n,r,o)):f.execute(u,e,i,n,r,o),c&&u.restore(),s){s.offset();const t=a[h]*l+Sp.indexOf(d);this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(s)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(S);for(let i=0,n=e.length;i<n;++i)t[e[i]].forEach(t=>{t.draw(this.renderedContext_),t.clear()}),t[e[i]].length=0}},kp=class extends Vf{constructor(t,e,i,n,r,s,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?St(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=r,this.squaredTolerance_=s,this.userTransform_=o,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=[1,0,0,1,0,0]}drawImages_(t,e,i,n){if(!this.image_)return;const r=Hi(t,e,i,n,this.transform_,this.pixelCoordinates_),s=this.context_,o=this.tmpLocalTransform_,a=s.globalAlpha;1!=this.imageOpacity_&&(s.globalAlpha=a*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let t=0,e=r.length;t<e;t+=2){const e=r[t]-this.imageAnchorX_,i=r[t+1]-this.imageAnchorY_;if(0!==l||1!=this.imageScale_[0]||1!=this.imageScale_[1]){const t=e+this.imageAnchorX_,n=i+this.imageAnchorY_;Vi(o,t,n,1,1,l,-t,-n),s.save(),s.transform.apply(s,o),s.translate(t,n),s.scale(this.imageScale_[0],this.imageScale_[1]),s.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),s.restore()}else s.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,e,i,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(s.globalAlpha=a)}drawText_(t,e,i,n){if(!this.textState_||""===this.text_)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const r=Hi(t,e,i,n,this.transform_,this.pixelCoordinates_),s=this.context_;let o=this.textRotation_;for(0===this.transformRotation_&&(o-=this.viewRotation_),this.textRotateWithView_&&(o+=this.viewRotation_);e<i;e+=n){const t=r[e]+this.textOffsetX_,i=r[e+1]+this.textOffsetY_;0!==o||1!=this.textScale_[0]||1!=this.textScale_[1]?(s.save(),s.translate(t-this.textOffsetX_,i-this.textOffsetY_),s.rotate(o),s.translate(this.textOffsetX_,this.textOffsetY_),s.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&s.strokeText(this.text_,0,0),this.textFillState_&&s.fillText(this.text_,0,0),s.restore()):(this.textStrokeState_&&s.strokeText(this.text_,t,i),this.textFillState_&&s.fillText(this.text_,t,i))}}moveToLineTo_(t,e,i,n,r,s){const o=this.context_;let a=Hi(t,e,i,n,this.transform_,this.pixelCoordinates_);Math.abs(s)>0&&(a=lp(a,0,a.length,2,s,r,a),up(a,2)),o.moveTo(a[0],a[1]);let l=a.length;r&&(l-=2);for(let t=2;t<l;t+=2)o.lineTo(a[t],a[t+1]);return r&&o.closePath(),i}drawRings_(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s)e=this.moveToLineTo_(t,e,i[s],n,!0,r);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),oe(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=function(t,e,i){const n=t.getFlatCoordinates();if(!n)return null;const r=t.getStride();return Hi(n,0,n.length,r,e,i)}(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],n=e[3]-e[1],r=Math.sqrt(i*i+n*n),s=this.context_;s.beginPath(),s.arc(e[0],e[1],r,0,2*Math.PI),this.fillState_&&s.fill(),this.strokeState_&&s.stroke()}""!==this.text_&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t)}}drawFeature(t,e){const i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let t=0,i=e.length;t<i;++t)this.drawGeometry(e[t])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),oe(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1,this.strokeState_.strokeOffset),e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(oe(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();let n=0;const r=t.getEnds(),s=t.getStride();e.beginPath();for(let t=0,e=r.length;t<e;++t)n=this.moveToLineTo_(i,n,r[t],s,!1,this.strokeState_.strokeOffset);e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoints();this.drawText_(e,0,e.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),oe(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),oe(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let n=0;const r=t.getEndss(),s=t.getStride();e.beginPath();for(let t=0,e=r.length;t<e;++t){const e=r[t];n=this.drawRings_(i,n,e,s,this.strokeState_?.strokeOffset)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),I(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),i.lineJoin!=t.lineJoin&&(i.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,i=this.contextTextState_,n=t.textAlign?t.textAlign:Xa;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=n&&(i.textAlign=n,e.textAlign=n),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=n,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:n,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(t){const e=t.getColor();this.fillState_={fillStyle:Da(e||qa)}}else this.fillState_=null;if(e){const t=e.getColor(),i=e.getLineCap(),n=e.getLineDash(),r=e.getLineDashOffset(),s=e.getLineJoin(),o=e.getWidth(),a=e.getMiterLimit(),l=n||$a,h=e.getOffset();this.strokeState_={lineCap:void 0!==i?i:Ba,lineDash:1===this.pixelRatio_?l:l.map(t=>t*this.pixelRatio_),lineDashOffset:(r||0)*this.pixelRatio_,lineJoin:void 0!==s?s:Ua,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:Da(t||Wa),strokeOffset:(h??0)*this.pixelRatio_}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const s=t.getScaleArray();this.imageScale_=[s[0]*this.pixelRatio_/i,s[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:Da(t||qa)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),r=i.getLineDashOffset(),s=i.getLineJoin(),o=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:Ba,lineDash:n||$a,lineDashOffset:r||0,lineJoin:void 0!==s?s:Ua,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:Da(t||Wa)}}else this.textStrokeState_=null;const n=t.getFont(),r=t.getOffsetX(),s=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),l=t.getScaleArray(),h=t.getText(),u=t.getTextAlign(),c=t.getTextBaseline();this.textState_={font:void 0!==n?n:za,textAlign:void 0!==u?u:Xa,textBaseline:void 0!==c?c:Va},this.text_=void 0!==h?Array.isArray(h)?h.reduce((t,e,i)=>t+(i%2?" ":e),""):h:"",this.textOffsetX_=void 0!==r?this.pixelRatio_*r:0,this.textOffsetY_=void 0!==s?this.pixelRatio_*s:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*l[0],this.pixelRatio_*l[1]]}else this.text_=""}},Rp=.5;function Ap(t,e,i,n,r,s,o,a,l){const h=l?Gi(r):r,u=ur(t[0]*Rp,t[1]*Rp);u.imageSmoothingEnabled=!1;const c=u.canvas,d=new kp(u,Rp,r,null,o,a,l?Ei(Ri(),l):null),f=i.length,p=Math.floor(16777215/f),g={};for(let t=1;t<=f;++t){const e=i[t-1],r=e.getStyleFunction()||n;if(!r)continue;let o=r(e,s);if(!o)continue;Array.isArray(o)||(o=[o]);const a=(t*p).toString(16).padStart(7,"#00000");for(let t=0,i=o.length;t<i;++t){const i=o[t],n=i.getGeometryFunction()(e);if(!n||!oe(h,n.getExtent()))continue;const r=i.clone(),s=r.getFill();s&&s.setColor(a);const l=r.getStroke();l&&(l.setColor(a),l.setLineDash(null)),r.setText(void 0);const u=i.getImage();if(u){const t=u.getImageSize();if(!t)continue;const e=ur(t[0],t[1],void 0,{alpha:!1}),i=e.canvas;e.fillStyle=a,e.fillRect(0,0,i.width,i.height),r.setImage(new ml({img:i,anchor:u.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:u.getOrigin(),opacity:1,size:u.getSize(),scale:u.getScale(),rotation:u.getRotation(),rotateWithView:u.getRotateWithView()}))}const c=r.getZIndex()||0;let d=g[c];d||(d={},g[c]=d,d.Polygon=[],d.Circle=[],d.LineString=[],d.Point=[]);const f=n.getType();if("GeometryCollection"===f){const t=n.getGeometriesArrayRecursive();for(let e=0,i=t.length;e<i;++e){const i=t[e];d[i.getType().replace("Multi","")].push(i,r)}}else d[f.replace("Multi","")].push(n,r)}}const m=Object.keys(g).map(Number).sort(S);for(let t=0,i=m.length;t<i;++t){const i=g[m[t]];for(const t in i){const n=i[t];for(let t=0,i=n.length;t<i;t+=2){d.setStyle(n[t+1]);for(let i=0,r=e.length;i<r;++i)d.setTransform(e[i]),d.drawGeometry(n[t])}}}return u.getImageData(0,0,c.width,c.height)}function Op(t,e,i){const n=[];if(i){const r=Math.floor(Math.round(t[0])*Rp),s=Math.floor(Math.round(t[1])*Rp),o=4*(mt(r,0,i.width-1)+mt(s,0,i.height-1)*i.width),a=i.data[o],l=i.data[o+1],h=i.data[o+2]+256*(l+256*a),u=Math.floor(16777215/e.length);h&&h%u===0&&n.push(e[h/u-1])}return n}const Gp={Point:function(t,e,i,n,r,s){const o=i.getImage(),a=i.getText(),l=a&&a.getText(),h=s&&o&&l?{}:void 0;if(o){if(2!=o.getImageState())return;const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(o,h),s.drawPoint(e,n,r)}if(l){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a,h),s.drawText(e,n,r)}},LineString:function(t,e,i,n,r){const s=i.getStroke();if(s){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawLineString(e,n,r)}const o=i.getText();if(o&&o.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,n,r)}},Polygon:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(s||o){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawPolygon(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}},MultiPoint:function(t,e,i,n,r,s){const o=i.getImage(),a=o&&0!==o.getOpacity(),l=i.getText(),h=l&&l.getText(),u=s&&a&&h?{}:void 0;if(a){if(2!=o.getImageState())return;const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(o,u),s.drawMultiPoint(e,n,r)}if(h){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(l,u),s.drawText(e,n,r)}},MultiLineString:function(t,e,i,n,r){const s=i.getStroke();if(s){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawMultiLineString(e,n,r)}const o=i.getText();if(o&&o.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,n,r)}},MultiPolygon:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(o||s){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawMultiPolygon(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}},GeometryCollection:function(t,e,i,n,r,s){const o=e.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a)(0,Gp[o[a].getType()])(t,o[a],i,n,r,s)},Circle:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(s||o){const a=t.getBuilder(i.getZIndex(),"Circle");a.setFillStrokeStyle(s,o),a.drawCircle(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}}};function Fp(t,e){return parseInt(z(t),10)-parseInt(z(e),10)}function Lp(t,e){const i=jp(t,e);return i*i}function jp(t,e){return.5*t/e}function Np(t,e,i,n,r,s,o,a){const l=[],h=i.getImage();if(h){let t=!0;const e=h.getImageState();2==e||3==e?t=!1:0==e&&h.load(),t&&l.push(h.ready())}const u=i.getFill();u&&u.loading()&&l.push(u.ready());const c=l.length>0;return c&&Promise.all(l).then(()=>r(null)),function(t,e,i,n,r,s,o){const a=i.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(n,r);i.getRenderer()?Dp(t,l,i,e,o):(0,Gp[l.getType()])(t,l,i,e,o,s)}(t,e,i,n,s,o,a),c}function Dp(t,e,i,n,r){if("GeometryCollection"==e.getType()){const s=e.getGeometries();for(let e=0,o=s.length;e<o;++e)Dp(t,s[e],i,n,r);return}t.getBuilder(i.getZIndex(),"Default").drawCustom(e,n,i.getRenderer(),i.getHitDetectionRenderer(),r)}const zp={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},qp={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]},Bp=class extends Bf{constructor(t,e){super(t,e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=[1,0,0,1,0,0],this.tileClipContexts_=null}enqueueTilesForNextExtent(){return"vector"!==this.getLayer().getRenderMode()}drawTile(t,e,i,n,r,s,o,a){this.updateExecutorGroup_(t,e.pixelRatio,e.viewState.projection),this.tileImageNeedsRender_(t)&&this.renderTileImage_(t,e),super.drawTile(t,e,i,n,r,s,o,a)}getTile(t,e,i,n){const r=this.getOrCreateTile(t,e,i,n);if(!r)return null;const s=n.viewState,o=s.resolution,a=n.viewHints,l=this.getLayer().getSource(),h=l.getTileGridForProjection(s.projection),u=!(a[0]||a[1]),c=h.getZForResolution(o,l.zDirection)===t;return u&&c?r.wantedResolution=o:r.wantedResolution||(r.wantedResolution=h.getResolution(t)),r}prepareFrame(t){const e=this.getLayer().getRevision();return this.renderedLayerRevision_!==e&&(this.renderedLayerRevision_=e,this.renderedTiles.length=0),super.prepareFrame(t)}updateExecutorGroup_(t,e,i){const n=this.getLayer(),r=n.getRevision(),s=n.getRenderOrder()||null,o=t.wantedResolution,a=t.getReplayState(n);if(!a.dirty&&a.renderedResolution===o&&a.renderedRevision==r&&a.renderedPixelRatio===e&&a.renderedRenderOrder==s)return;const l=n.getSource(),h=!!n.getDeclutter(),u=l.getTileGrid(),c=l.getTileGridForProjection(i).getTileCoordExtent(t.wrappedTileCoord),d=l.getSourceTiles(e,i,t),f=z(n);delete t.hitDetectionImageData[f],t.executorGroups[f]=[],a.dirty=!1;for(let r=0,p=d.length;r<p;++r){const p=d[r];if(2!=p.getState())continue;const g=l.getProjection(),m=p.tileCoord;let y=u.getTileCoordExtent(m);i&&g&&!Mi(i,g)&&(y=Ti(y,g,i,32));const _=ie(c,y),v=Rt(_,n.getRenderBuffer()*o,this.tempExtent),x=Bt(y,_)?null:v,w=new op(0,_,o,e),b=Lp(o,e),S=function(t,e){let i;const r=t.getStyleFunction()||n.getStyleFunction();if(r&&(i=r(t,o)),i){const n=this.renderFeature(t,b,i,w,h,e);a.dirty=a.dirty||n}},M=p.getFeatures();s&&s!==a.renderedRenderOrder&&M.sort(s);for(let t=0,e=M.length;t<e;++t){let e=M[t];i&&p.projection&&!Mi(i,p.projection)&&(e=e.clone(),e.getGeometry().applyTransform(Pi(p.projection,i))),x&&!oe(x,e.getGeometry().getExtent())||S.call(this,e,t)}const E=w.finish(),C="vector"!==n.getRenderMode()&&h&&1===d.length?null:_,P=new Tp(C,o,e,l.getOverlaps(),E,n.getRenderBuffer(),!0);t.executorGroups[f].push(P)}a.renderedRevision=r,a.renderedPixelRatio=e,a.renderedRenderOrder=s,a.renderedResolution=o}forEachFeatureAtCoordinate(t,e,i,n,r){const s=e.viewState.resolution,o=e.viewState.rotation;i=null==i?0:i;const a=this.getLayer(),l=a.getSource().getTileGridForProjection(e.viewState.projection),h=a.getRenderBuffer(),u=kt([t]);Rt(u,s*(h+i),u);const c={},d=function(t,e,i){let s=t.getId();void 0===s&&(s=z(t));const o=c[s];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return c[s]=!0,r.splice(r.lastIndexOf(o),1),n(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return c[s]=!0,n(t,a,e);r.push(c[s]={feature:t,layer:a,geometry:e,distanceSq:i,callback:n})}},f=this.renderedTiles,p=z(a),g=a.getDeclutter(),m=g?e.declutter?.[g]?.all().map(t=>t.value):null;let y;t:for(let e=f.length-1;e>=0;--e){const n=f[e];if(!oe(l.getTileCoordExtent(n.wrappedTileCoord),u))continue;const r=n.executorGroups[p];for(let e=0,n=r.length;e<n;++e)if(y=r[e].forEachFeatureAtCoordinate(t,s,o,i,d,m),y)break t}return y}getFeatures(t){return 0===this.renderedTiles.length?Promise.resolve([]):new Promise((e,i)=>{const n=this.getLayer(),r=n.getSource(),s=this.renderedProjection,o=s.getExtent(),a=this.renderedResolution,l=r.getTileGridForProjection(s),h=Wi(this.renderedPixelToCoordinateTransform_,t.slice()),u=l.getTileCoordForCoordAndResolution(h,a).toString(),c=this.renderedTiles.find(t=>t.tileCoord.toString()===u&&2===t.getState());if(!c||c.loadingSourceTiles>0)return void e([]);r.getWrapX()&&s.canWrapX()&&!Ft(o,l.getTileCoordExtent(c.tileCoord))&&de(h,s);const d=z(n),f=ne(l.getTileCoordExtent(c.wrappedTileCoord)),p=[(h[0]-f[0])/a,(f[1]-h[1])/a],g=c.getSourceTiles().reduce((t,e)=>t.concat(e.getFeatures()),[]);let m=c.hitDetectionImageData[d];if(!m){const t=ao(l.getTileSize(l.getZForResolution(a,r.zDirection))),e=this.renderedRotation_;m=Ap(t,[this.getRenderTransform(l.getTileCoordCenter(c.wrappedTileCoord),a,0,Rp,t[0]*Rp,t[1]*Rp,0)],g,n.getStyleFunction(),l.getTileCoordExtent(c.wrappedTileCoord),c.getReplayState(n).renderedResolution,e),c.hitDetectionImageData[d]=m}e(Op(p,g,m))})}getFeaturesInExtent(t){const e=[],i=this.getTileCache();if(0===i.getCount())return e;const n=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),r=n.getZForResolution(this.renderedResolution),s={};return i.forEach(i=>{if(i.tileCoord[0]!==r||2!==i.getState())return;const o=i.getSourceTiles();for(let i=0,r=o.length;i<r;++i){const r=o[i],a=r.getKey();if(a in s)continue;s[a]=!0;const l=r.tileCoord;if(oe(t,n.getTileCoordExtent(l))){const i=r.getFeatures();if(i)for(let n=0,r=i.length;n<r;++n){const r=i[n],s=r.getGeometry();oe(t,s.getExtent())&&e.push(r)}}}}),e}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&void 0!==this.renderedLayerRevision_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}renderDeclutter(t,e){const i=this.context,n=i.globalAlpha;i.globalAlpha=e.opacity;const r=t.viewHints,s=!(r[0]||r[1]),o=[this.context.canvas.width,this.context.canvas.height],a=this.getLayer().getDeclutter(),l=a?t.declutter?.[a]:void 0,h=z(this.getLayer()),u=this.renderedTiles;for(let e=0,i=u.length;e<i;++e){const i=u[e],n=i.executorGroups[h];if(n)for(let e=n.length-1;e>=0;--e)n[e].execute(this.context,o,this.getTileRenderTransform(i,t),t.viewState.rotation,s,Mp,l)}i.globalAlpha=n}renderDeferredInternal(t){const e=this.renderedTiles,i=z(this.getLayer()),n=e.reduce((t,e,n)=>(e.executorGroups[i].forEach(e=>t.push({executorGroup:e,index:n})),t),[]),r=n.map(({executorGroup:t})=>t.getDeferredZIndexContexts()),s={};for(let t=0,e=n.length;t<e;++t){const e=n[t].executorGroup.getDeferredZIndexContexts();for(const t in e)s[t]=!0}const o=Object.keys(s).map(Number).sort(S);this.layerExtent&&this.clipUnrotated(this.context,t,this.layerExtent),o.forEach(t=>{r.forEach((e,i)=>{e[t]&&(e[t].forEach(t=>{const{executorGroup:e,index:r}=n[i],s=e.getRenderedContext(),o=s.globalAlpha;s.globalAlpha=this.renderedOpacity_;const a=this.tileClipContexts_[r];a&&a.draw(s),t.draw(s),a&&s.restore(),s.globalAlpha=o,t.clear()}),e[t].length=0)})}),this.layerExtent&&this.context.restore()}getTileRenderTransform(t,e){const i=e.pixelRatio,n=e.viewState,r=n.center,s=n.resolution,o=n.rotation,a=e.size,l=Math.round(a[0]*i),h=Math.round(a[1]*i),u=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),c=t.tileCoord,d=u.getTileCoordExtent(t.wrappedTileCoord),f=u.getTileCoordExtent(c,this.tempExtent)[0]-d[0];return $i(Xi(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(r,s,o,i,l,h,f))}postRender(t,e){const i=e.viewHints,n=!(i[0]||i[1]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation,this.renderedOpacity_=e.layerStatesArray[e.layerIndex].opacity;const r=this.getLayer(),s=r.getRenderMode(),o=t.globalAlpha;t.globalAlpha=this.renderedOpacity_;const a=r.getDeclutter(),l=a?qp[s].filter(t=>!Mp.includes(t)):qp[s],h=e.viewState,u=h.rotation;this.layerExtent&&this.clipUnrotated(t,e,this.layerExtent);const c=r.getSource(),d=c.getTileGridForProjection(h.projection).getZForResolution(h.resolution,c.zDirection),f=this.renderedTiles,p=[],g=[],m=[],y=z(r);let _=!0;for(let i=f.length-1;i>=0;--i){const s=f[i];_=_&&!s.getReplayState(r).dirty;const o=s.executorGroups[y].filter(t=>t.hasExecutors(l));if(0===o.length)continue;const h=this.getTileRenderTransform(s,e),c=s.tileCoord[0];let v=!1;const x=o[0].getClipCoords(h);let w,b=t;if(x){w=new Gf,b=w.getContext();for(let t=0,e=p.length;t<e;++t)if(d!==c&&c<g[t]){const e=p[t];oe([x[0],x[3],x[4],x[7]],[e[0],e[3],e[4],e[7]])&&(v||(b.save(),v=!0),b.beginPath(),b.moveTo(x[0],x[1]),b.lineTo(x[2],x[3]),b.lineTo(x[4],x[5]),b.lineTo(x[6],x[7]),b.moveTo(e[6],e[7]),b.lineTo(e[4],e[5]),b.lineTo(e[2],e[3]),b.lineTo(e[0],e[1]),b.clip())}p.push(x),g.push(c)}for(let i=0,r=o.length;i<r;++i)o[i].execute(t,[t.canvas.width,t.canvas.height],h,u,n,l,e.declutter?.[a]);v&&(b===t?b.restore():m[i]=w)}this.layerExtent&&t.restore(),t.globalAlpha=o,this.ready=_,this.tileClipContexts_=m,e.declutter||this.renderDeferredInternal(e),super.postRender(t,e)}renderFeature(t,e,i,n,r,s){if(!i)return!1;let o=!1;if(Array.isArray(i))for(let a=0,l=i.length;a<l;++a)o=Np(n,t,i[a],e,this.boundHandleStyleImageChange_,void 0,r,s)||o;else o=Np(n,t,i,e,this.boundHandleStyleImageChange_,void 0,r,s);return o}tileImageNeedsRender_(t){const e=this.getLayer();if("vector"===e.getRenderMode())return!1;const i=t.getReplayState(e),n=e.getRevision(),r=t.wantedResolution;return i.renderedTileResolution!==r||i.renderedTileRevision!==n}renderTileImage_(t,e){const i=this.getLayer(),n=t.getReplayState(i),r=i.getRevision(),s=t.executorGroups[z(i)];n.renderedTileRevision=r;const o=t.wrappedTileCoord,a=o[0],l=i.getSource();let h=e.pixelRatio;const u=e.viewState.projection,c=l.getTileGridForProjection(u),d=c.getResolution(t.tileCoord[0]),f=e.pixelRatio/t.wantedResolution*d,p=c.getResolution(a),g=t.getContext();h=Math.round(Math.max(h,f/h));const m=l.getTilePixelSize(a,h,u);g.canvas.width=m[0],g.canvas.height=m[1];const y=h/f;if(1!==y){const t=Bi(this.tmpTransform_);Xi(t,y,y),g.setTransform.apply(g,t)}const _=c.getTileCoordExtent(o,this.tempExtent),v=f/p,x=Bi(this.tmpTransform_);Xi(x,v,-v),function(t,e,i){$i(t,Ui(qi,1,0,0,1,e,i))}(x,-_[0],-_[3]);for(let t=0,e=s.length;t<e;++t)s[t].execute(g,[g.canvas.width*y,g.canvas.height*y],x,0,!0,zp[i.getRenderMode()],null);n.renderedTileResolution=t.wantedResolution}},$p=class extends Hl{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload;const i=void 0===t.cacheSize?0:t.cacheSize;delete t.cacheSize,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i;const n=t.renderMode||"hybrid";ct("hybrid"==n||"vector"==n,"`renderMode` must be `'hybrid'` or `'vector'`"),this.renderMode_=n,this.setPreload(t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError),this.getBackground,this.setBackground}createRenderer(){return new Bp(this,{cacheSize:this.cacheSize_})}getFeatures(t){return super.getFeatures(t)}getFeaturesInExtent(t){return this.getRenderer().getFeaturesInExtent(t)}getRenderMode(){return this.renderMode_}getPreload(){return this.get($f)}getUseInterimTilesOnError(){return this.get(Uf)}setPreload(t){this.set($f,t)}setUseInterimTilesOnError(t){this.set(Uf,t)}};class Up extends Error{constructor(t){super("Unexpected response status: "+t.status),this.name="ResponseError",this.response=t}}class Wp extends Error{constructor(t){super("Failed to issue request"),this.name="ClientError",this.client=t}}function Xp(t){return new Promise(function(e,i){const n=new XMLHttpRequest;n.addEventListener("load",function(t){const n=t.target;if(!n.status||n.status>=200&&n.status<300){let t;try{t=JSON.parse(n.responseText)}catch(t){const e="Error parsing response text as JSON: "+t.message;return void i(new Error(e))}return void e(t)}i(new Up(n))}),n.addEventListener("error",function(t){i(new Wp(t.target))}),n.open("GET",t),n.setRequestHeader("Accept","application/json"),n.send()})}function Vp(t,e){return e.includes("://")?e:new URL(e,t).href}const Kp=class extends qd{constructor(t){super({extent:t.extent,origin:t.origin,origins:t.origins,resolutions:t.resolutions,tileSize:t.tileSize,tileSizes:t.tileSizes,sizes:t.sizes}),this.matrixIds_=t.matrixIds}getMatrixId(t){return this.matrixIds_[t]}getMatrixIds(){return this.matrixIds_}},Zp={"image/png":!0,"image/jpeg":!0,"image/gif":!0,"image/webp":!0},Yp={"application/vnd.mapbox-vector-tile":!0,"application/geo+json":!0};function Hp(t,e){if(!e.length)return t;const i=new URL(t,"file:/");if(i.pathname.split("/").includes("collections"))return be('The "collections" query parameter cannot be added to collection endpoints'),t;const n=e.map(t=>encodeURIComponent(t)).join(",");return i.searchParams.append("collections",n),`${t.split("?")[0]}?${decodeURIComponent(i.searchParams.toString())}`}function Jp(t,e,i,n){let r=t.projection;if(!r&&("string"==typeof e.crs?r=_i(e.crs):"uri"in e.crs&&(r=_i(e.crs.uri)),!r))throw new Error(`Unsupported CRS: ${JSON.stringify(e.crs)}`);const s=e.orderedAxes,o=!(s?s.slice(0,2).map(t=>t.replace(/E|X|Lon/i,"e").replace(/N|Y|Lat/i,"n")).join(""):r.getAxisOrientation()).startsWith("en"),a=e.tileMatrices.sort(function(t,e){return e.cellSize-t.cellSize}),l={};for(let t=0;t<a.length;++t){const e=a[t];l[e.id]=e}const h={},u=[];if(n)for(let t=0;t<n.length;++t){const e=n[t],i=e.tileMatrix,r=l[i],s=a.indexOf(r);u[s]=i,h[i]=e}else for(let t=0;t<a.length;++t){const e=a[t].id;u.push(e)}const c=u.length,d=new Array(c),f=new Array(c),p=new Array(c),g=new Array(c),m=[-1/0,-1/0,1/0,1/0];for(let t=0;t<c;++t){const e=u[t],i=l[e],n=i.pointOfOrigin;d[t]=o?[n[1],n[0]]:n,f[t]=i.cellSize,p[t]=[i.matrixWidth,i.matrixHeight],g[t]=[i.tileWidth,i.tileHeight];const r=h[e];if(r){const e=i.cellSize*i.tileWidth,n=d[t][0]+r.minTileCol*e,s=d[t][0]+(r.maxTileCol+1)*e,o=i.cellSize*i.tileHeight;let a,l;"bottomLeft"===i.cornerOfOrigin?(a=d[t][1]+r.minTileRow*o,l=d[t][1]+(r.maxTileRow+1)*o):(a=d[t][1]-(r.maxTileRow+1)*o,l=d[t][1]-r.minTileRow*o),ie(m,[n,a,s,l],m)}}const y=new Kp({origins:d,resolutions:f,sizes:p,tileSizes:g,extent:n?m:void 0,matrixIds:u});if(!i)return{grid:y,projection:r};const _=t.context,v=t.url;return{grid:y,projection:r,urlTemplate:i,urlFunction:function(t,e,r){if(!t)return;const s=u[t[0]],o=l[s],a="bottomLeft"===o.cornerOfOrigin,c={tileMatrix:s,tileCol:t[1],tileRow:a?-t[2]-1:t[2]};if(n){const t=h[o.id];if(c.tileCol<t.minTileCol||c.tileCol>t.maxTileCol||c.tileRow<t.minTileRow||c.tileRow>t.maxTileRow)return}Object.assign(c,{z:c.tileMatrix,x:c.tileCol,y:c.tileRow},_);const d=i.replace(/\{(\w+?)\}/g,function(t,e){return c[e]});return Vp(v,d)}}}const Qp=class extends Pf{constructor(t){var e;super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,format:t.format,overlaps:t.overlaps,projection:t.projection,tileClass:t.tileClass,transition:t.transition,wrapX:t.wrapX,zDirection:t.zDirection,state:"loading"}),(e={url:t.url,projection:this.getProjection(),mediaType:t.mediaType,supportedMediaTypes:t.format.supportedMediaTypes,context:t.context||null,collections:t.collections},Xp(e.url).then(function(t){return function(t,e){const i=e.tileMatrixSetLimits;let n;if("map"===e.dataType)n=function(t,e,i){let n,r;for(let i=0;i<t.length;++i){const s=t[i];if("item"===s.rel){if(s.type===e){n=s.href;break}(Zp[s.type]||!r&&s.type.startsWith("image/"))&&(r=s.href)}}if(!n){if(!r)throw new Error('Could not find "item" link');n=r}return i&&(n=Hp(n,i)),n}(e.links,t.mediaType,t.collections);else{if("vector"!==e.dataType)throw new Error('Expected tileset data type to be "map" or "vector"');n=function(t,e,i,n){let r,s;const o={};for(let i=0;i<t.length;++i){const n=t[i];if(o[n.type]=n.href,"item"===n.rel){if(n.type===e){r=n.href;break}Yp[n.type]&&(s=n.href)}}if(!r&&i)for(let t=0;t<i.length;++t){const e=i[t];if(o[e]){r=o[e];break}}if(!r){if(!s)throw new Error('Could not find "item" link');r=s}return n&&(r=Hp(r,n)),r}(e.links,t.mediaType,t.supportedMediaTypes,t.collections)}if(e.tileMatrixSet)return Jp(t,e.tileMatrixSet,n,i);const r=e.links.find(t=>"http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme"===t.rel);if(!r)throw new Error("Expected http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme link or tileMatrixSet");const s=r.href;return Xp(Vp(t.url,s)).then(function(e){return Jp(t,e,n,i)})}(e,t)})).then(this.handleTileSetInfo_.bind(this)).catch(this.handleError_.bind(this))}handleTileSetInfo_(t){this.tileGrid=t.grid,this.projection=t.projection,this.setTileUrlFunction(t.urlFunction,t.urlTemplate),this.setState("ready")}handleError_(t){be(t),this.setState("error")}},tg=4294967296,eg=1/tg,ig="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class ng{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,e,i=this.length){for(;this.pos<i;){const i=this.readVarint(),n=i>>3,r=this.pos;this.type=7&i,t(n,e,this),this.pos===r&&this.skip(i)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*tg;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*tg;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let i,n;return n=e[this.pos++],i=127&n,n<128?i:(n=e[this.pos++],i|=(127&n)<<7,n<128?i:(n=e[this.pos++],i|=(127&n)<<14,n<128?i:(n=e[this.pos++],i|=(127&n)<<21,n<128?i:(n=e[this.pos],i|=(15&n)<<28,function(t,e,i){const n=i.buf;let r,s;if(s=n[i.pos++],r=(112&s)>>4,s<128)return rg(t,r,e);if(s=n[i.pos++],r|=(127&s)<<3,s<128)return rg(t,r,e);if(s=n[i.pos++],r|=(127&s)<<10,s<128)return rg(t,r,e);if(s=n[i.pos++],r|=(127&s)<<17,s<128)return rg(t,r,e);if(s=n[i.pos++],r|=(127&s)<<24,s<128)return rg(t,r,e);if(s=n[i.pos++],r|=(1&s)<<31,s<128)return rg(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(i,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&ig?ig.decode(this.buf.subarray(e,t)):function(t,e,i){let n="",r=e;for(;r<i;){const e=t[r];let s,o,a,l=null,h=e>239?4:e>223?3:e>191?2:1;if(r+h>i)break;1===h?e<128&&(l=e):2===h?(s=t[r+1],128==(192&s)&&(l=(31&e)<<6|63&s,l<=127&&(l=null))):3===h?(s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&(l=(15&e)<<12|(63&s)<<6|63&o,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===h&&(s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&e)<<18|(63&s)<<12|(63&o)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,h=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),r+=h}return n}(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(t){const e=7&t;if(0===e)for(;this.buf[this.pos++]>127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else{if(1!==e)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e<this.pos+t;)e*=2;if(e!==this.length){const t=new Uint8Array(e);t.set(this.buf),this.buf=t,this.dataView=new DataView(t.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*eg),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*eg),!0),this.pos+=8}writeVarint(t){(t=+t||0)>268435455||t<0?function(t,e){let i,n;if(t>=0?(i=t%4294967296|0,n=t/4294967296|0):(i=~(-t%4294967296),n=~(-t/4294967296),4294967295^i?i=i+1|0:(i=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,e),function(t,e){const i=(7&t)<<4;e.buf[e.pos++]|=i|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))}writeSVarint(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const e=this.pos;this.pos=function(t,e,i){for(let n,r,s=0;s<e.length;s++){if(n=e.charCodeAt(s),n>55295&&n<57344){if(!r){n>56319||s+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);const i=this.pos-e;i>=128&&sg(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let i=0;i<e;i++)this.buf[this.pos++]=t[i]}writeRawMessage(t,e){this.pos++;const i=this.pos;t(e,this);const n=this.pos-i;n>=128&&sg(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n}writeMessage(t,e,i){this.writeTag(t,2),this.writeRawMessage(e,i)}writePackedVarint(t,e){e.length&&this.writeMessage(t,og,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,ag,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,ug,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,lg,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,hg,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,cg,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,dg,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,fg,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,pg,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}}function rg(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function sg(t,e,i){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(let e=i.pos-1;e>=t;e--)i.buf[e+n]=i.buf[e]}function og(t,e){for(let i=0;i<t.length;i++)e.writeVarint(t[i])}function ag(t,e){for(let i=0;i<t.length;i++)e.writeSVarint(t[i])}function lg(t,e){for(let i=0;i<t.length;i++)e.writeFloat(t[i])}function hg(t,e){for(let i=0;i<t.length;i++)e.writeDouble(t[i])}function ug(t,e){for(let i=0;i<t.length;i++)e.writeBoolean(t[i])}function cg(t,e){for(let i=0;i<t.length;i++)e.writeFixed32(t[i])}function dg(t,e){for(let i=0;i<t.length;i++)e.writeSFixed32(t[i])}function fg(t,e){for(let i=0;i<t.length;i++)e.writeFixed64(t[i])}function pg(t,e){for(let i=0;i<t.length;i++)e.writeSFixed64(t[i])}function gg(t,e,i,n,r,s,o){let a,l;const h=(i-e)/n;if(1===h)a=e;else if(2===h)a=e,l=r;else if(0!==h){let s=t[e],o=t[e+1],h=0;const u=[0];for(let r=e+n;r<i;r+=n){const e=t[r],i=t[r+1];h+=Math.sqrt((e-s)*(e-s)+(i-o)*(i-o)),u.push(h),s=e,o=i}const c=r*h,d=function(t,e,i){let n,r;i=i||S;let s=0,o=t.length,a=!1;for(;s<o;)n=s+(o-s>>1),r=+i(t[n],e),r<0?s=n+1:(o=n,a=!r);return a?s:~s}(u,c);d<0?(l=(c-u[-d-2])/(u[-d-1]-u[-d-2]),a=e+(-d-2)*n):a=e+d*n}o=o>1?o:2,s=s||new Array(o);for(let e=0;e<o;++e)s[e]=void 0===a?NaN:void 0===l?t[a+e]:bt(t[a+e],t[a+n+e],l);return s}function mg(t,e,i,n,r,s){if(i==e)return null;let o;if(r<t[e+n-1])return s?(o=t.slice(e,e+n),o[n-1]=r,o):null;if(t[i-1]<r)return s?(o=t.slice(i-n,i),o[n-1]=r,o):null;if(r==t[e+n-1])return t.slice(e,e+n);let a=e/n,l=i/n;for(;a<l;){const e=a+l>>1;r<t[(e+1)*n-1]?l=e:a=e+1}const h=t[a*n-1];if(r==h)return t.slice((a-1)*n,(a-1)*n+n);const u=(r-h)/(t[(a+1)*n-1]-h);o=[];for(let e=0;e<n-1;++e)o.push(bt(t[(a-1)*n+e],t[a*n+e],u));return o.push(r),o}class yg extends sn{constructor(t,e){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}appendCoordinate(t){P(this.flatCoordinates,t),this.changed()}clone(){const t=new yg(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Ot(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(hn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),cn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,n))}forEachSegment(t){return On(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinateAtM(t,e){return"XYM"!=this.layout&&"XYZM"!=this.layout?null:(e=void 0!==e&&e,mg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return mn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return gg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return ap(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const e=[];return e.length=vn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new yg(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return Gn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,this.getExtent())}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=fn(this.flatCoordinates,0,t,this.stride),this.changed()}}const _g=yg;class vg extends sn{constructor(t,e,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(void 0!==e&&i)this.setFlatCoordinates(e,t),this.ends_=i;else{const e=t,i=[],n=[];for(let t=0,r=e.length;t<r;++t)P(i,e[t].getFlatCoordinates()),n.push(i.length);const r=0===e.length?this.getLayout():e[0].getLayout();this.setFlatCoordinates(r,i),this.ends_=n}}appendLineString(t){P(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new vg(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Ot(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(un(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),dn(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,i,n))}getCoordinateAtM(t,e,i){return"XYM"!=this.layout&&"XYZM"!=this.layout||0===this.flatCoordinates.length?null:(e=void 0!==e&&e,i=void 0!==i&&i,function(t,e,i,n,r,s,o){if(o)return mg(t,e,i[i.length-1],n,r,s);let a;if(r<t[n-1])return s?(a=t.slice(0,n),a[n-1]=r,a):null;if(t[t.length-1]<r)return s?(a=t.slice(t.length-n),a[n-1]=r,a):null;for(let s=0,o=i.length;s<o;++s){const o=i[s];if(e!=o){if(r<t[e+n-1])return null;if(r<=t[o-1])return mg(t,e,o,n,r,!1);e=o}}return null}(this.flatCoordinates,0,this.ends_,this.stride,t,e,i))}getCoordinates(){return yn(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new _g(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,e=this.ends_,i=this.layout,n=[];let r=0;for(let s=0,o=e.length;s<o;++s){const o=e[s],a=new _g(t.slice(r,o),i);n.push(a),r=o}return n}getLength(){const t=this.ends_;let e=0,i=0;for(let n=0,r=t.length;n<r;++n)i+=ap(this.flatCoordinates,e,t[n],this.stride),e=t[n];return i}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let i=0;const n=this.ends_,r=this.stride;for(let s=0,o=n.length;s<o;++s){const o=n[s];P(t,gg(e,i,o,r,.5)),i=o}return t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=xn(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,i),new vg(e,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(t){return function(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){if(Gn(t,e,i[s],n,r))return!0;e=i[s]}return!1}(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=pn(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}const xg=vg;class wg extends sn{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){P(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new wg(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<Ot(this.getExtent(),t,e))return n;const r=this.flatCoordinates,s=this.stride;for(let o=0,a=r.length;o<a;o+=s){const a=_t(t,e,r[o],r[o+1]);if(a<n){n=a;for(let t=0;t<s;++t)i[t]=r[o+t];i.length=s}}return n}getCoordinates(){return mn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new Pn(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,i=this.stride,n=[];for(let r=0,s=t.length;r<s;r+=i){const s=new Pn(t.slice(r,r+i),e);n.push(s)}return n}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,i=this.stride;for(let n=0,r=e.length;n<r;n+=i)if(Lt(t,e[n],e[n+1]))return!0;return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=fn(this.flatCoordinates,0,t,this.stride),this.changed()}}const bg=wg;function Sg(t,e,i,n){const r=[];let s=[1/0,1/0,-1/0,-1/0];for(let o=0,a=i.length;o<a;++o){const a=i[o];s=qt(t,e,a[0],n),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),e=a[a.length-1]}return r}class Mg extends sn{constructor(t,e,i){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!i&&!Array.isArray(t[0])){const n=t,r=[],s=[];for(let t=0,e=n.length;t<e;++t){const e=n[t],i=r.length,o=e.getEnds();for(let t=0,e=o.length;t<e;++t)o[t]+=i;P(r,e.getFlatCoordinates()),s.push(o)}e=0===n.length?this.getLayout():n[0].getLayout(),t=r,i=s}void 0!==e&&i?(this.setFlatCoordinates(e,t),this.endss_=i):this.setCoordinates(t,e)}appendPolygon(t){let e;if(this.flatCoordinates){const i=this.flatCoordinates.length;P(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let t=0,n=e.length;t<n;++t)e[t]+=i}else this.flatCoordinates=t.getFlatCoordinates().slice(),e=t.getEnds().slice(),this.endss_.push();this.endss_.push(e),this.changed()}clone(){const t=this.endss_.length,e=new Array(t);for(let i=0;i<t;++i)e[i]=this.endss_[i].slice();const i=new Mg(this.flatCoordinates.slice(),this.layout,e);return i.applyProperties(this),i}closestPointXY(t,e,i,n){return n<Ot(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(function(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];r=un(t,e,o,n,r),e=o[o.length-1]}return r}(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),function(t,e,i,n,r,s,o,a,l,h,u){u=u||[NaN,NaN];for(let s=0,c=i.length;s<c;++s){const c=i[s];h=dn(t,e,c,n,r,true,o,a,l,h,u),e=c[c.length-1]}return h}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,0,t,e,i,n))}containsXY(t,e){return function(t,e,i,n,r,s){if(0===i.length)return!1;for(let o=0,a=i.length;o<a;++o){const a=i[o];if(kn(t,e,a,n,r,s))return!0;e=a[a.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return function(t,e,i,n){let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s];r+=an(t,e,o,n),e=o[o.length-1]}return r}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),Bn(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,_n(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=Sg(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=An(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new bg(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;zn(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Bn(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=function(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l],u=[];o=Sn(t,e,h,n,r,s,o,u),a.push(u),e=h[h.length-1]}return o}(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new Mg(e,"XY",i)}getPolygon(t){if(t<0||this.endss_.length<=t)return null;let e;if(0===t)e=0;else{const i=this.endss_[t-1];e=i[i.length-1]}const i=this.endss_[t].slice(),n=i[i.length-1];if(0!==e)for(let t=0,n=i.length;t<n;++t)i[t]-=e;return new Wn(this.flatCoordinates.slice(e,n),this.layout,i)}getPolygons(){const t=this.layout,e=this.flatCoordinates,i=this.endss_,n=[];let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s].slice(),a=o[o.length-1];if(0!==r)for(let t=0,e=o.length;t<e;++t)o[t]-=r;const l=new Wn(e.slice(r,a),t,o);n.push(l),r=a}return n}getType(){return"MultiPolygon"}intersectsExtent(t){return function(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];if(Ln(t,e,o,n,r))return!0;e=o[o.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=gn(this.flatCoordinates,0,t,this.stride,this.endss_);if(0===i.length)this.flatCoordinates.length=0;else{const t=i[i.length-1];this.flatCoordinates.length=0===t.length?0:t[t.length-1]}this.changed()}}const Eg=Mg,Cg=[1,0,0,1,0,0];class Pg{constructor(t,e,i,n,r,s){this.styleFunction,this.extent_,this.id_=s,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=r,this.squaredTolerance_,this.stride_=n,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?zt(this.flatCoordinates_):qt(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=Ht(this.getExtent());this.flatInteriorPoints_=Rn(this.flatCoordinates_,0,this.ends_,this.stride_,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=$n(this.flatCoordinates_,this.ends_),e=Sg(this.flatCoordinates_,0,t,this.stride_);this.flatInteriorPoints_=An(this.flatCoordinates_,0,t,this.stride_,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=gg(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let n=0,r=i.length;n<r;++n){const r=i[n],s=gg(t,e,r,this.stride_,.5);P(this.flatMidpoints_,s),e=r}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){const e=(t=_i(t)).getExtent(),i=t.getWorldExtent();if(e&&i){const t=ee(i)/ee(e);Vi(Cg,i[0],i[3],t,-t,0,0,0),Hi(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,Cg,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new Pg(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=A((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let n;switch(this.type_){case"LineString":i.length=vn(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),n=[i.length];break;case"MultiLineString":n=[],i.length=xn(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,n);break;case"Polygon":n=[],i.length=Sn(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,n)}return n&&(this.simplifiedGeometry_=new Pg(this.type_,i,n,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}Pg.prototype.getFlatCoordinates=Pg.prototype.getOrientedFlatCoordinates;const Ig=Pg;class Tg extends B{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if("function"==typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new Tg,e=this.geometryName_;t.setGeometryName(e);const i=this.getPropertiesInternal();if(i){const n=this.getGeometry();for(const r in i)r===e&&n?t.set(r,n.clone()):t.set(r,i[r],!0)}const n=this.getStyle();return n&&t.setStyle(n),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(p(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=d(t,g,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?function(t){if("function"==typeof t)return t;let e;return Array.isArray(t)?e=t:(ct("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[t]),function(){return e}}(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){t!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}}const kg=Tg;class Rg extends en{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(p),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,i=t.length;e<i;++e)this.changeEventsKeys_.push(d(t[e],g,this.changed,this))}clone(){const t=new Rg(Ag(this.geometries_));return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<Ot(this.getExtent(),t,e))return n;const r=this.geometries_;for(let s=0,o=r.length;s<o;++s)n=r[s].closestPointXY(t,e,i,n);return n}containsXY(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)if(i[n].containsXY(t,e))return!0;return!1}computeExtent(t){Dt(t);const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)$t(t,e[i].getExtent());return t}getGeometries(){return Ag(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].getType()===this.getType()?t=t.concat(e[i].getGeometriesArrayRecursive()):t.push(e[i]);return t}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=[],i=this.geometries_;let n=!1;for(let r=0,s=i.length;r<s;++r){const s=i[r],o=s.getSimplifiedGeometry(t);e.push(o),o!==s&&(n=!0)}return n?new Rg(e):(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getType(){return"GeometryCollection"}intersectsExtent(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)if(e[i].intersectsExtent(t))return!0;return!1}isEmpty(){return 0===this.geometries_.length}rotate(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)i[n].rotate(t,e);this.changed()}scale(t,e,i){i||(i=Ht(this.getExtent()));const n=this.geometries_;for(let r=0,s=n.length;r<s;++r)n[r].scale(t,e,i);this.changed()}setGeometries(t){this.setGeometriesArray(Ag(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].applyTransform(t);this.changed()}translate(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)i[n].translate(t,e);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function Ag(t){return t.map(t=>t.clone())}const Og=Rg,Gg=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=kg,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let i=e.dataProjection?_i(e.dataProjection):this.readProjection(t);e.extent&&i&&"tile-pixels"===i.getUnits()&&(i=_i(i),i.setWorldExtent(e.extent)),e={dataProjection:i,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return N()}readFeature(t,e){return N()}readFeatures(t,e){return N()}readGeometry(t,e){return N()}readProjection(t){return N()}writeFeature(t,e){return N()}writeFeatures(t,e){return N()}writeGeometry(t,e){return N()}};function Fg(t,e,i){const n=i?_i(i.featureProjection):null,r=i?_i(i.dataProjection):null;let s=t;if(n&&r&&!Mi(n,r)){e&&(s=t.clone());const i=e?n:r,o=e?r:n;"tile-pixels"===i.getUnits()?s.transform(i,o):s.applyTransform(Pi(i,o))}if(e&&i&&void 0!==i.decimals){const e=Math.pow(10,i.decimals),n=function(t){for(let i=0,n=t.length;i<n;++i)t[i]=Math.round(t[i]*e)/e;return t};s===t&&(s=t.clone()),s.applyTransform(n)}return s}const Lg={Point:Pn,LineString:_g,Polygon:Wn,MultiPoint:bg,MultiLineString:xg,MultiPolygon:Eg};function jg(t,e){const i=t.geometry;if(!i)return[];if(Array.isArray(i))return i.map(e=>jg({...t,geometry:e})).flat();const n="MultiPolygon"===i.type?"Polygon":i.type;if("GeometryCollection"===n||"Circle"===n)throw new Error("Unsupported geometry type: "+n);const r=i.layout.length;return Fg(new Ig(n,"Polygon"===n?function(t,e,i){return Array.isArray(e[0])?(zn(t,0,e,i)||Bn(t=t.slice(),0,e,i),t):(Dn(t,0,e,i)||qn(t=t.slice(),0,e,i),t)}(i.flatCoordinates,i.ends,r):i.flatCoordinates,i.ends?.flat(),r,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function Ng(t,e){if(!t)return null;if(Array.isArray(t)){const i=t.map(t=>Ng(t,e));return new Og(i)}return Fg(new(0,Lg[t.type])(t.flatCoordinates,t.layout||"XY",t.ends),!1,e)}function Dg(t,e,i){if(3===t){const t={keys:[],values:[],features:[]},n=i.readVarint()+i.pos;i.readFields(zg,t,n),t.length=t.features.length,t.length&&(e[t.name]=t)}}function zg(t,e,i){if(15===t)e.version=i.readVarint();else if(1===t)e.name=i.readString();else if(5===t)e.extent=i.readVarint();else if(2===t)e.features.push(i.pos);else if(3===t)e.keys.push(i.readString());else if(4===t){let n=null;const r=i.readVarint()+i.pos;for(;i.pos<r;)n=1==(t=i.readVarint()>>3)?i.readString():2===t?i.readFloat():3===t?i.readDouble():4===t?i.readVarint64():5===t?i.readVarint():6===t?i.readSVarint():7===t?i.readBoolean():null;e.values.push(n)}}function qg(t,e,i){if(1==t)e.id=i.readVarint();else if(2==t){const t=i.readVarint()+i.pos;for(;i.pos<t;){const t=e.layer.keys[i.readVarint()],n=e.layer.values[i.readVarint()];e.properties[t]=n}}else 3==t?e.type=i.readVarint():4==t&&(e.geometry=i.pos)}function Bg(t,e,i){t.pos=e.features[i];const n=t.readVarint()+t.pos,r={layer:e,type:0,properties:{}};return t.readFields(qg,r,n),r}const $g=class extends Gg{constructor(t){super(),t=t||{},this.dataProjection=new Me({code:"",units:"tile-pixels"}),this.featureClass=t.featureClass?t.featureClass:Ig,this.geometryName_=t.geometryName,this.layerName_=t.layerName?t.layerName:"layer",this.layers_=t.layers?t.layers:null,this.idProperty_=t.idProperty,this.supportedMediaTypes=["application/vnd.mapbox-vector-tile","application/x-protobuf"]}readRawGeometry_(t,e,i,n){t.pos=e.geometry;const r=t.readVarint()+t.pos;let s=1,o=0,a=0,l=0,h=0,u=0;for(;t.pos<r;){if(!o){const e=t.readVarint();s=7&e,o=e>>3}if(o--,1===s||2===s)a+=t.readSVarint(),l+=t.readSVarint(),1===s&&h>u&&(n.push(h),u=h),i.push(a,l),h+=2;else{if(7!==s)throw new Error("Invalid command found in the PBF");h>u&&(i.push(i[u],i[u+1]),h+=2)}}h>u&&(n.push(h),u=h)}createFeature_(t,e,i){const n=e.type;if(0===n)return null;let r;const s=e.properties;let o;this.idProperty_?(o=s[this.idProperty_],delete s[this.idProperty_]):o=e.id,s[this.layerName_]=e.layer.name;const a=[],l=[];this.readRawGeometry_(t,e,a,l);const h=function(t,e){let i;return 1===t?i=1===e?"Point":"MultiPoint":2===t?i=1===e?"LineString":"MultiLineString":3===t&&(i="Polygon"),i}(n,l.length);if(this.featureClass===Ig)r=new this.featureClass(h,a,l,2,s,o),r.transform(i.dataProjection);else{let t;if("Polygon"==h){const e=$n(a,l);t=e.length>1?new Eg(a,"XY",e):new Wn(a,"XY",l)}else t="Point"===h?new Pn(a,"XY"):"LineString"===h?new _g(a,"XY"):"MultiPoint"===h?new bg(a,"XY"):"MultiLineString"===h?new xg(a,"XY",l):null;r=new(0,this.featureClass),this.geometryName_&&r.setGeometryName(this.geometryName_);const e=Fg(t,!1,i);r.setGeometry(e),void 0!==o&&r.setId(o),r.setProperties(s,!0)}return r}getType(){return"arraybuffer"}readFeatures(t,e){const i=this.layers_,n=_i((e=this.adaptOptions(e)).dataProjection);n.setWorldExtent(e.extent),e.dataProjection=n;const r=new ng(t),s=r.readFields(Dg,{}),o=[];for(const t in s){if(i&&!i.includes(t))continue;const a=s[t],l=a?[0,0,a.extent,a.extent]:null;n.setExtent(l);for(let t=0,i=a.length;t<i;++t){const i=Bg(r,a,t),n=this.createFeature_(r,i,e);null!==n&&o.push(n)}}return o}readProjection(t){return this.dataProjection}setLayers(t){this.layers_=t}};function Ug(t){if("string"==typeof t){return JSON.parse(t)||null}return null!==t?t:null}const Wg=class extends Gg{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(Ug(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(Ug(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return N()}readFeaturesFromObject(t,e){return N()}readGeometry(t,e){return this.readGeometryFromObject(Ug(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return N()}readProjection(t){return this.readProjectionFromObject(Ug(t))}readProjectionFromObject(t){return N()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return N()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return N()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return N()}};function Xg(t,e){if(!t)return null;let i;switch(t.type){case"Point":i=function(t){const e=t.coordinates;return{type:"Point",flatCoordinates:e,layout:nn(e.length)}}(t);break;case"LineString":i=function(t){const e=t.coordinates,i=e.flat();return{type:"LineString",flatCoordinates:i,ends:[i.length],layout:nn(e[0]?.length||2)}}(t);break;case"Polygon":i=function(t){const e=t.coordinates,i=[],n=e[0]?.[0]?.length;return{type:"Polygon",flatCoordinates:i,ends:pn(i,0,e,n),layout:nn(n)}}(t);break;case"MultiPoint":i=function(t){const e=t.coordinates;return{type:"MultiPoint",flatCoordinates:e.flat(),layout:nn(e[0]?.length||2)}}(t);break;case"MultiLineString":i=function(t){const e=t.coordinates,i=e[0]?.[0]?.length||2,n=[];return{type:"MultiLineString",flatCoordinates:n,ends:pn(n,0,e,i),layout:nn(i)}}(t);break;case"MultiPolygon":i=function(t){const e=t.coordinates,i=[],n=e[0]?.[0]?.[0].length||2;return{type:"MultiPolygon",flatCoordinates:i,ends:gn(i,0,e,n),layout:nn(n)}}(t);break;case"GeometryCollection":i=function(t){const e=t.geometries.map(function(t){return Xg(t)});return e}(t);break;default:throw new Error("Unsupported GeoJSON type: "+t.type)}return i}function Vg(t,e){const i=(t=Fg(t,!0,e)).getType();let n;switch(i){case"Point":n=function(t){return{type:"Point",coordinates:t.getCoordinates()}}(t);break;case"LineString":n=function(t){return{type:"LineString",coordinates:t.getCoordinates()}}(t);break;case"Polygon":n=function(t,e){let i;return e&&(i=e.rightHanded),{type:"Polygon",coordinates:t.getCoordinates(i)}}(t,e);break;case"MultiPoint":n=function(t){return{type:"MultiPoint",coordinates:t.getCoordinates()}}(t);break;case"MultiLineString":n=function(t){return{type:"MultiLineString",coordinates:t.getCoordinates()}}(t);break;case"MultiPolygon":n=function(t,e){let i;return e&&(i=e.rightHanded),{type:"MultiPolygon",coordinates:t.getCoordinates(i)}}(t,e);break;case"GeometryCollection":n=function(t,e){delete(e=Object.assign({},e)).featureProjection;return{type:"GeometryCollection",geometries:t.getGeometriesArray().map(function(t){return Vg(t,e)})}}(t,e);break;case"Circle":n={type:"GeometryCollection",geometries:[]};break;default:throw new Error("Unsupported geometry type: "+i)}return n}const Kg=class extends Wg{constructor(t){t=t||{},super(),this.dataProjection=_i(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=_i(t.featureProjection)),t.featureClass&&(this.featureClass=t.featureClass),this.geometryName_=t.geometryName,this.extractGeometryName_=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,e){let i=null;i="Feature"===t.type?t:{type:"Feature",geometry:t,properties:null};const n=Xg(i.geometry);if(this.featureClass===Ig)return jg({geometry:n,id:i.id,properties:i.properties},e);const r=new kg;return this.geometryName_?r.setGeometryName(this.geometryName_):this.extractGeometryName_&&i.geometry_name&&r.setGeometryName(i.geometry_name),r.setGeometry(Ng(n,e)),"id"in i&&r.setId(i.id),i.properties&&r.setProperties(i.properties,!0),r}readFeaturesFromObject(t,e){let i=null;if("FeatureCollection"===t.type){i=[];const n=t.features;for(let t=0,r=n.length;t<r;++t){const r=this.readFeatureFromObject(n[t],e);r&&i.push(r)}}else i=[this.readFeatureFromObject(t,e)];return i.flat()}readGeometryFromObject(t,e){return function(t,e){return Ng(Xg(t),e)}(t,e)}readProjectionFromObject(t){const e=t.crs;let i;if(e)if("name"==e.type)i=_i(e.properties.name);else{if("EPSG"!==e.type)throw new Error("Unknown SRS type");i=_i("EPSG:"+e.properties.code)}else i=this.dataProjection;return i}writeFeatureObject(t,e){e=this.adaptOptions(e);const i={type:"Feature",geometry:null,properties:null},n=t.getId();if(void 0!==n&&(i.id=n),!t.hasProperties())return i;const r=t.getProperties(),s=t.getGeometry();return s&&(i.geometry=Vg(s,e),delete r[t.getGeometryName()]),c(r)||(i.properties=r),i}writeFeaturesObject(t,e){e=this.adaptOptions(e);const i=[];for(let n=0,r=t.length;n<r;++n)i.push(this.writeFeatureObject(t[n],e));return{type:"FeatureCollection",features:i}}writeGeometryObject(t,e){return Vg(t,this.adaptOptions(e))}},Zg=class extends Nf{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=[1/0,1/0,-1/0,-1/0],this.wrappedRenderedExtent_=[1/0,1/0,-1/0,-1/0],this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,i){const n=e.extent,r=e.viewState,s=r.center,o=r.resolution,a=r.projection,l=r.rotation,h=a.getExtent(),u=this.getLayer().getSource(),c=this.getLayer().getDeclutter(),d=e.pixelRatio,f=e.viewHints,p=!(f[0]||f[1]),g=this.context,m=Math.round(se(n)/o*d),y=Math.round(ee(n)/o*d),_=u.getWrapX()&&a.canWrapX(),v=_?se(h):null,x=_?Math.ceil((n[2]-h[2])/v)+(this.extendX_?2:1):1;let w=_?Math.floor((n[0]-h[0])/v)-(this.extendX_?1:0):0;do{let n=this.getRenderTransform(s,o,0,d,m,y,w*v);e.declutter&&(n=n.slice(0)),t.execute(g,[g.canvas.width,g.canvas.height],n,l,p,void 0===i?Sp:i?Mp:Ep,i?c&&e.declutter[c]:void 0)}while(++w<x)}setDrawContext_(){1!==this.opacity_&&(this.targetContext_=this.context,this.context=ur(this.context.canvas.width,this.context.canvas.height,Lf))}resetDrawContext_(){if(1!==this.opacity_&&this.targetContext_){const t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,fr(this.context),Lf.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){this.replayGroup_&&this.getLayer().getDeclutter()&&this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,t,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex];this.opacity_=i.opacity;const n=t.viewState;this.prepareContainer(t,e);const r=this.context,s=this.replayGroup_;let o=s&&!s.isEmpty();if(!o&&!this.getLayer().hasListener(ms)&&!this.getLayer().hasListener(ys))return this.container;this.setDrawContext_(),this.preRender(r,t);n.projection;this.clipExtent_=null;let a=!1;if(o&&i.extent&&this.clipping){const e=Fi(i.extent);o=oe(e,t.extent),o&&!Ft(e,t.extent)&&(t.declutter?this.clipExtent_=e:(this.clipUnrotated(r,t,e),a=!0))}return o&&this.renderWorlds(s,t,!this.getLayer().getDeclutter()&&void 0),a&&r.restore(),this.postRender(r,t),this.renderedRotation_!==n.rotation&&(this.renderedRotation_=n.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=this.frameState.size.slice(),e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,r=this.renderedProjection_,s=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],l=t[0]*Rp,h=t[1]*Rp;a.push(this.getRenderTransform(e,i,n,Rp,l,h,0).slice());const u=o.getSource(),c=r.getExtent();if(u.getWrapX()&&r.canWrapX()&&!Ft(c,s)){let t=s[0];const r=se(c);let o,u=0;for(;t<c[0];)--u,o=r*u,a.push(this.getRenderTransform(e,i,n,Rp,l,h,o).slice()),t+=r;for(u=0,t=s[2];t>c[2];)++u,o=r*u,a.push(this.getRenderTransform(e,i,n,Rp,l,h,o).slice()),t-=r}const d=Ri();this.hitDetectionImageData_=Ap(t,a,this.renderedFeatures_,o.getStyleFunction(),s,i,n,Lp(i,this.renderedPixelRatio_),d?r:null)}e(Op(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,n,r){if(!this.replayGroup_)return;const s=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),l={},h=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,s,o,i,function(t,e,i){const s=z(t),o=l[s];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return l[s]=!0,r.splice(r.lastIndexOf(o),1),n(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return l[s]=!0,n(t,a,e);r.push(l[s]={feature:t,layer:a,geometry:e,distanceSq:i,callback:n})}},h?e.declutter?.[h]?.all().map(t=>t.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[0],r=t.viewHints[1],s=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!s&&n||!o&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,l=t.viewState,h=l.projection,u=l.resolution,c=t.pixelRatio,d=e.getRevision(),f=e.getRenderBuffer();let p=e.getRenderOrder();void 0===p&&(p=Fp);const g=l.center.slice(),m=Rt(a,f*u),y=m.slice(),_=[m.slice()],v=h.getExtent(),x=i.getWrapX()&&h.canWrapX();if(this.extendX_=!1,x){const t=i.getExtent();t&&!ae(t)&&(this.extendX_=t[0]<v[0]||t[2]>v[2])}if(x&&(!Ft(v,t.extent)||this.extendX_)){const t=se(v),e=Math.max(se(m)/2,t);let i=v[0],n=v[2];this.extendX_&&(i-=t,n+=t),m[0]=i-e,m[2]=n+e,de(g,h);const r=le(_[0],h);r[0]<v[0]&&r[2]<v[2]?_.push([r[0]+t,r[1],r[2]+t,r[3]]):r[0]>v[0]&&r[2]>v[2]&&_.push([r[0]-t,r[1],r[2]-t,r[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedPixelRatio_===c&&this.renderedRevision_==d&&this.renderedRenderOrder_==p&&this.renderedFrameDeclutter_===!!t.declutter&&Ft(this.wrappedRenderedExtent_,m))return I(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=g,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const w=new op(jp(u,c),m,u,c),b=Ri();let S;if(b){for(let t=0,e=_.length;t<e;++t){const e=Gi(_[t]);i.loadFeatures(e,Li(u),b)}S=Ei(b,h)}else for(let t=0,e=_.length;t<e;++t)i.loadFeatures(_[t],u,h);const M=Lp(u,c);let E=!0;const C=(t,i)=>{let n;const r=t.getStyleFunction()||e.getStyleFunction();if(r&&(n=r(t,u)),n){const e=this.renderFeature(t,M,n,w,S,this.getLayer().getDeclutter(),i);E=E&&!e}},P=Gi(m),T=i.getFeaturesInExtent(P);p&&T.sort(p);for(let t=0,e=T.length;t<e;++t)C(T[t],t);this.renderedFeatures_=T,this.ready=E;const k=w.finish(),R=new Tp(m,u,c,i.getOverlaps(),k,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=u,this.renderedRevision_=d,this.renderedRenderOrder_=p,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=y,this.wrappedRenderedExtent_=m,this.renderedCenter_=g,this.renderedProjection_=h,this.renderedPixelRatio_=c,this.replayGroup_=R,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,n,r,s,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let l=0,h=i.length;l<h;++l)a=Np(n,t,i[l],e,this.boundHandleStyleImageChange_,r,s,o)||a;else a=Np(n,t,i,e,this.boundHandleStyleImageChange_,r,s,o);return a}},Yg=class extends Hl{constructor(t){super(t)}createRenderer(){return new Zg(this)}};function Hg(t,e){return[[-1/0,-1/0,1/0,1/0]]}const Jg=class{constructor(t){this.rbush_=new Es(t),this.items_={}}insert(t,e){const i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[z(e)]=i}load(t,e){const i=new Array(e.length);for(let n=0,r=e.length;n<r;n++){const r=t[n],s=e[n],o={minX:r[0],minY:r[1],maxX:r[2],maxY:r[3],value:s};i[n]=o,this.items_[z(s)]=o}this.rbush_.load(i)}remove(t){const e=z(t),i=this.items_[e];return delete this.items_[e],null!==this.rbush_.remove(i)}update(t,e){const i=this.items_[z(e)];Bt([i.minX,i.minY,i.maxX,i.maxY],t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(t){return t.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let i;for(let n=0,r=t.length;n<r;n++)if(i=e(t[n]),i)return i;return i}isEmpty(){return c(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return Nt(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(const e in t.items_)this.items_[e]=t.items_[e]}},Qg="addfeature",tm="removefeature";class em extends G{constructor(t,e,i){super(t),this.feature=e,this.features=i}}const im=class extends hf{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.on,this.once,this.un,this.loader_=R,this.format_=t.format||null,this.overlaps_=void 0===t.overlaps||t.overlaps,this.url_=t.url,void 0!==t.loader?this.loader_=t.loader:void 0!==this.url_&&(ct(this.format_,"`format` must be set when `url` is set"),this.loader_=Cf(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:Hg;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,n;this.featuresRtree_=e?new Jg:null,this.loadedExtentsRtree_=new Jg,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(t.features)?n=t.features:t.features&&(i=t.features,n=i.getArray()),e||void 0!==i||(i=new W(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=z(t);if(!this.addToIndex_(e,t))return void(this.featuresCollection_&&this.featuresCollection_.remove(t));this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const e=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(e,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new em(Qg,t))}setupChangeEvents_(t,e){e instanceof Ig||(this.featureChangeKeys_[t]=[d(e,g,this.handleFeatureChange_,this),d(e,h,this.handleFeatureChange_,this)])}addToIndex_(t,e){let i=!0;if(void 0!==e.getId()){const t=String(e.getId());if(t in this.idIndex_)if(e instanceof Ig){const n=this.idIndex_[t];n instanceof Ig?Array.isArray(n)?n.push(e):this.idIndex_[t]=[n,e]:i=!1}else i=!1;else this.idIndex_[t]=e}return i&&(ct(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],n=[];for(let e=0,n=t.length;e<n;e++){const n=t[e],r=z(n);this.addToIndex_(r,n)&&i.push(n)}for(let t=0,r=i.length;t<r;t++){const r=i[t],s=z(r);this.setupChangeEvents_(s,r);const o=r.getGeometry();if(o){const t=o.getExtent();e.push(t),n.push(r)}else this.nullGeometryFeatures_[s]=r}if(this.featuresRtree_&&this.featuresRtree_.load(e,n),this.hasListener(Qg))for(let t=0,e=i.length;t<e;t++)this.dispatchEvent(new em(Qg,i[t]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(Qg,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(tm,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(a,t=>{e||(e=!0,this.addFeature(t.element),e=!1)}),t.addEventListener(l,t=>{e||(e=!0,this.removeFeature(t.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_)this.featureChangeKeys_[t].forEach(p);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(t=>{this.removeFeatureInternal(t)});for(const t in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[t])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new em("clear");this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,function(i){const n=i.getGeometry();if(n instanceof Ig||n.intersectsCoordinate(t))return e(i)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(i){const n=i.getGeometry();if(n instanceof Ig||n.intersectsExtent(t)){const t=e(i);if(t)return t}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),c(this.nullGeometryFeatures_)||P(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(t){e.push(t)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const i=he(t,e);return[].concat(...i.map(t=>this.featuresRtree_.getInExtent(t)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let r=null;const s=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||T,this.featuresRtree_.forEachInExtent(a,function(t){if(e(t)){const e=t.getGeometry(),l=o;if(o=e instanceof Ig?0:e.closestPointXY(i,n,s,o),o<l){r=t;const e=Math.sqrt(o);a[0]=i-e,a[1]=n-e,a[2]=i+e,a[3]=n+e}}}),r}getExtent(t){return this.featuresRtree_?.getExtent(t)??null}getFeatureById(t){const e=this.idIndex_[t.toString()];return void 0!==e?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return void 0!==e?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,i=z(e),n=e.getGeometry();if(n){const t=n.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(t,e)):this.featuresRtree_&&this.featuresRtree_.update(t,e)}else i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);const r=e.getId();if(void 0!==r){const t=r.toString();this.idIndex_[t]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[t]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new em("changefeature",e))}hasFeature(t){const e=t.getId();return void 0!==e?e in this.idIndex_:z(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&c(this.nullGeometryFeatures_):!this.featuresCollection_||0===this.featuresCollection_.getLength()}loadFeatures(t,e,i){const n=this.loadedExtentsRtree_,r=this.strategy_(t,e,i);for(let t=0,s=r.length;t<s;++t){const s=r[t];if(!n.forEachInExtent(s,function(t){return Ft(t.extent,s)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new em("featuresloadstart"));const t=t=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new em("featuresloadend",void 0,t))},r=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new em("featuresloaderror"))};let o=!1;const a=this.loader_.call(this,s,e,i,e=>o||t(e),()=>o||r());a instanceof Promise?(o=!0,a.then(e=>{this.addFeatures(e),t(e)}).catch(r)):this.loader_.length<4&&(this.loading=!1),n.insert(s,{extent:s.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,i=e.forEachInExtent(t,function(e){if(Bt(e.extent,t))return e});i&&e.remove(i)}removeFeatures(t){let e=!1;for(let i=0,n=t.length;i<n;++i)e=this.removeFeatureInternal(t[i])||e;e&&this.changed()}removeFeature(t){t&&this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=z(t);if(!(e in this.uidIndex_))return!1;e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t);const i=this.featureChangeKeys_[e];i?.forEach(p),delete this.featureChangeKeys_[e];const n=t.getId();if(void 0!==n){const e=n.toString(),i=this.idIndex_[e];i===t?delete this.idIndex_[e]:Array.isArray(i)&&(i.splice(i.indexOf(t),1),1===i.length&&(this.idIndex_[e]=i[0]))}return delete this.uidIndex_[e],this.hasListener(tm)&&this.dispatchEvent(new em(tm,t)),!0}removeFromIdIndex_(t){for(const e in this.idIndex_)if(this.idIndex_[e]===t){delete this.idIndex_[e];break}}setLoader(t){this.loader_=t}setUrl(t){ct(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(Cf(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}};var nm={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};const rm=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function sm(t,e){const i={};for(const e in t)"ref"!==e&&(i[e]=t[e]);return rm.forEach(t=>{t in e&&(i[t]=e[t])}),i}class om{constructor(t,e,i,n){this.message=(t?`${t}: `:"")+i,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)}}function am(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}class lm extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class hm{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,i]of e)this.bindings[t]=i}concat(t){return new hm(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const um={kind:"null"},cm={kind:"number"},dm={kind:"string"},fm={kind:"boolean"},pm={kind:"color"},gm={kind:"projectionDefinition"},mm={kind:"object"},ym={kind:"value"},_m={kind:"collator"},vm={kind:"formatted"},xm={kind:"padding"},wm={kind:"colorArray"},bm={kind:"numberArray"},Sm={kind:"resolvedImage"},Mm={kind:"variableAnchorOffsetCollection"};function Em(t,e){return{kind:"array",itemType:t,N:e}}function Cm(t){if("array"===t.kind){const e=Cm(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const Pm=[um,cm,dm,fm,pm,gm,vm,mm,Em(ym),xm,bm,wm,Sm,Mm];function Im(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Im(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of Pm)if(!Im(t,e))return null}return`Expected ${Cm(t)} but found ${Cm(e)} instead.`}function Tm(t,e){return e.some(e=>e.kind===t.kind)}function km(t,e){return e.some(e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t)}function Rm(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const Am=.96422,Om=.82521,Gm=4/29,Fm=6/29,Lm=3*Fm*Fm,jm=Fm*Fm*Fm,Nm=Math.PI/180,Dm=180/Math.PI;function zm(t){return(t%=360)<0&&(t+=360),t}function qm([t,e,i,n]){let r,s;const o=$m((.2225045*(t=Bm(t))+.7168786*(e=Bm(e))+.0606169*(i=Bm(i)))/1);t===e&&e===i?r=s=o:(r=$m((.4360747*t+.3850649*e+.1430804*i)/Am),s=$m((.0139322*t+.0971045*e+.7141733*i)/Om));const a=116*o-16;return[a<0?0:a,500*(r-o),200*(o-s),n]}function Bm(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function $m(t){return t>jm?Math.pow(t,1/3):t/Lm+Gm}function Um([t,e,i,n]){let r=(t+16)/116,s=isNaN(e)?r:r+e/500,o=isNaN(i)?r:r-i/200;return r=1*Xm(r),s=Am*Xm(s),o=Om*Xm(o),[Wm(3.1338561*s-1.6168667*r-.4906146*o),Wm(-.9787684*s+1.9161415*r+.033454*o),Wm(.0719453*s-.2289914*r+1.4052427*o),n]}function Wm(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function Xm(t){return t>Fm?t*t*t:Lm*(t-Gm)}const Vm=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function Km(t,e){return Vm(t,e)?t[e]:void 0}function Zm(t){return parseInt(t.padEnd(2,t),16)/255}function Ym(t,e){return Hm(e?t/100:t,0,1)}function Hm(t,e,i){return Math.min(Math.max(e,t),i)}function Jm(t){return!t.some(Number.isNaN)}const Qm={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function ty(t,e,i){return t+i*(e-t)}function ey(t,e,i){return t.map((t,n)=>ty(t,e[n],i))}class iy{constructor(t,e,i,n=1,r=!0){this.r=t,this.g=e,this.b=i,this.a=n,r||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[t,e,i,n]))}static parse(t){if(t instanceof iy)return t;if("string"!=typeof t)return;const e=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];const e=Km(Qm,t);if(e){const[t,i,n]=e;return[t/255,i/255,n/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){const e=t.length<6?1:2;let i=1;return[Zm(t.slice(i,i+=e)),Zm(t.slice(i,i+=e)),Zm(t.slice(i,i+=e)),Zm(t.slice(i,i+e)||"ff")]}if(t.startsWith("rgb")){const e=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,i=t.match(e);if(i){const[t,e,n,r,s,o,a,l,h,u,c,d]=i,f=[r||" ",a||" ",u].join("");if(" "===f||" /"===f||",,"===f||",,,"===f){const t=[n,o,h].join(""),i="%%%"===t?100:""===t?255:0;if(i){const t=[Hm(+e/i,0,1),Hm(+s/i,0,1),Hm(+l/i,0,1),c?Ym(+c,d):1];if(Jm(t))return t}}return}}const i=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){const[t,e,n,r,s,o,a,l,h]=i,u=[n||" ",s||" ",a].join("");if(" "===u||" /"===u||",,"===u||",,,"===u){const t=[+e,Hm(+r,0,100),Hm(+o,0,100),l?Ym(+l,h):1];if(Jm(t))return function([t,e,i,n]){function r(n){const r=(n+t/30)%12,s=e*Math.min(i,1-i);return i-s*Math.max(-1,Math.min(r-3,9-r,1))}return t=zm(t),e/=100,i/=100,[r(0),r(8),r(4),n]}(t)}}}(t);return e?new iy(...e,!1):void 0}get rgb(){const{r:t,g:e,b:i,a:n}=this,r=n||1/0;return this.overwriteGetter("rgb",[t/r,e/r,i/r,n])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,i,n,r]=qm(t),s=Math.sqrt(i*i+n*n);return[Math.round(1e4*s)?zm(Math.atan2(n,i)*Dm):NaN,s,e,r]}(this.rgb))}get lab(){return this.overwriteGetter("lab",qm(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,i,n]=this.rgb;return`rgba(${[t,e,i].map(t=>Math.round(255*t)).join(",")},${n})`}static interpolate(t,e,i,n="rgb"){switch(n){case"rgb":{const[n,r,s,o]=ey(t.rgb,e.rgb,i);return new iy(n,r,s,o,!1)}case"hcl":{const[n,r,s,o]=t.hcl,[a,l,h,u]=e.hcl;let c,d;if(isNaN(n)||isNaN(a))isNaN(n)?isNaN(a)?c=NaN:(c=a,1!==s&&0!==s||(d=l)):(c=n,1!==h&&0!==h||(d=r));else{let t=a-n;a>n&&t>180?t-=360:a<n&&n-a>180&&(t+=360),c=n+i*t}const[f,p,g,m]=function([t,e,i,n]){return t=isNaN(t)?0:t*Nm,Um([i,Math.cos(t)*e,Math.sin(t)*e,n])}([c,null!=d?d:ty(r,l,i),ty(s,h,i),ty(o,u,i)]);return new iy(f,p,g,m,!1)}case"lab":{const[n,r,s,o]=Um(ey(t.lab,e.lab,i));return new iy(n,r,s,o,!1)}}}}iy.black=new iy(0,0,0,1),iy.white=new iy(1,1,1,1),iy.transparent=new iy(0,0,0,0),iy.red=new iy(1,0,0,1);class ny{constructor(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const ry=["bottom","center","top"];class sy{constructor(t,e,i,n,r,s){this.text=t,this.image=e,this.scale=i,this.fontStack=n,this.textColor=r,this.verticalAlign=s}}class oy{constructor(t){this.sections=t}static fromString(t){return new oy([new sy(t,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(t=>0!==t.text.length||t.image&&0!==t.image.name.length)}static factory(t){return t instanceof oy?t:oy.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map(t=>t.text).join("")}}class ay{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ay)return t;if("number"==typeof t)return new ay([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if("number"!=typeof e)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new ay(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){return new ay(ey(t.values,e.values,i))}}class ly{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ly)return t;if("number"==typeof t)return new ly([t]);if(Array.isArray(t)){for(const e of t)if("number"!=typeof e)return;return new ly(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){return new ly(ey(t.values,e.values,i))}}class hy{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof hy)return t;if("string"==typeof t){const e=iy.parse(t);if(!e)return;return new hy([e])}if(!Array.isArray(t))return;const e=[];for(const i of t){if("string"!=typeof i)return;const t=iy.parse(i);if(!t)return;e.push(t)}return new hy(e)}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i,n="rgb"){const r=[];if(t.values.length!=e.values.length)throw new Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${e.values.length}), cannot interpolate.`);for(let s=0;s<t.values.length;s++)r.push(iy.interpolate(t.values[s],e.values[s],i,n));return new hy(r)}}class uy extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}}const cy=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class dy{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof dy)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){const i=t[e],n=t[e+1];if("string"!=typeof i||!cy.has(i))return;if(!Array.isArray(n)||2!==n.length||"number"!=typeof n[0]||"number"!=typeof n[1])return}return new dy(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){const n=t.values,r=e.values;if(n.length!==r.length)throw new uy(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);const s=[];for(let t=0;t<n.length;t+=2){if(n[t]!==r[t])throw new uy(`Cannot interpolate values containing mismatched anchors. from[${t}]: ${n[t]}, to[${t}]: ${r[t]}`);s.push(n[t]);const[e,o]=n[t+1],[a,l]=r[t+1];s.push([ty(e,a,i),ty(o,l,i)])}return new dy(s)}}class fy{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new fy({name:t,available:!1}):null}}class py{constructor(t,e,i){this.from=t,this.to=e,this.transition=i}static interpolate(t,e,i){return new py(t,e,i)}static parse(t){return t instanceof py?t:Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]?new py(t[0],t[1],t[2]):"object"==typeof t&&"string"==typeof t.from&&"string"==typeof t.to&&"number"==typeof t.transition?new py(t.from,t.to,t.transition):"string"==typeof t?new py(t,t,1):void 0}}function gy(t,e,i,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[t,e,i,n]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function my(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof py||t instanceof iy||t instanceof ny||t instanceof oy||t instanceof ay||t instanceof ly||t instanceof hy||t instanceof dy||t instanceof fy)return!0;if(Array.isArray(t)){for(const e of t)if(!my(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!my(t[e]))return!1;return!0}return!1}function yy(t){if(null===t)return um;if("string"==typeof t)return dm;if("boolean"==typeof t)return fm;if("number"==typeof t)return cm;if(t instanceof iy)return pm;if(t instanceof py)return gm;if(t instanceof ny)return _m;if(t instanceof oy)return vm;if(t instanceof ay)return xm;if(t instanceof ly)return bm;if(t instanceof hy)return wm;if(t instanceof dy)return Mm;if(t instanceof fy)return Sm;if(Array.isArray(t)){const e=t.length;let i;for(const e of t){const t=yy(e);if(i){if(i===t)continue;i=ym;break}i=t}return Em(i||ym,e)}return mm}function _y(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof iy||t instanceof py||t instanceof oy||t instanceof ay||t instanceof ly||t instanceof hy||t instanceof dy||t instanceof fy?t.toString():JSON.stringify(t)}class vy{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!my(t[1]))return e.error("invalid value");const i=t[1];let n=yy(i);const r=e.expectedType;return"array"!==n.kind||0!==n.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(n=r),new vy(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const xy={string:dm,number:cm,boolean:fm,object:mm};class wy{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i,n=1;const r=t[0];if("array"===r){let r,s;if(t.length>2){const i=t[1];if("string"!=typeof i||!(i in xy)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=xy[i],n++}else r=ym;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);s=t[2],n++}i=Em(r,s)}else{if(!xy[r])throw new Error(`Types doesn't contain name = ${r}`);i=xy[r]}const s=[];for(;n<t.length;n++){const i=e.parse(t[n],n,ym);if(!i)return null;s.push(i)}return new wy(i,s)}evaluate(t){for(let e=0;e<this.args.length;e++){const i=this.args[e].evaluate(t);if(!Im(this.type,yy(i)))return i;if(e===this.args.length-1)throw new uy(`Expected value to be of type ${Cm(this.type)}, but found ${Cm(yy(i))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const by={"to-boolean":fm,"to-color":pm,"to-number":cm,"to-string":dm};class Sy{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[0];if(!by[i])throw new Error(`Can't parse ${i} as it is not part of the known types`);if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return e.error("Expected one argument.");const n=by[i],r=[];for(let i=1;i<t.length;i++){const n=e.parse(t[i],i,ym);if(!n)return null;r.push(n)}return new Sy(n,r)}evaluate(t){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(t));case"color":{let e,i;for(const n of this.args){if(e=n.evaluate(t),i=null,e instanceof iy)return e;if("string"==typeof e){const i=t.parseColor(e);if(i)return i}else if(Array.isArray(e)&&(i=e.length<3||e.length>4?`Invalid rgba value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:gy(e[0],e[1],e[2],e[3]),!i))return new iy(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new uy(i||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"padding":{let e;for(const i of this.args){e=i.evaluate(t);const n=ay.parse(e);if(n)return n}throw new uy(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"numberArray":{let e;for(const i of this.args){e=i.evaluate(t);const n=ly.parse(e);if(n)return n}throw new uy(`Could not parse numberArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"colorArray":{let e;for(const i of this.args){e=i.evaluate(t);const n=hy.parse(e);if(n)return n}throw new uy(`Could not parse colorArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"variableAnchorOffsetCollection":{let e;for(const i of this.args){e=i.evaluate(t);const n=dy.parse(e);if(n)return n}throw new uy(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"number":{let e=null;for(const i of this.args){if(e=i.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new uy(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return oy.fromString(_y(this.args[0].evaluate(t)));case"resolvedImage":return fy.fromString(_y(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return _y(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const My=["Unknown","Point","LineString","Polygon"];class Ey{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?My[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache.get(t);return e||(e=iy.parse(t),this._parseColorCache.set(t,e)),e}}class Cy{constructor(t,e,i=[],n,r=new hm,s=[]){this.registry=t,this.path=i,this.key=i.map(t=>`[${t}]`).join(""),this.scope=r,this.errors=s,this.expectedType=n,this._isConstant=e}parse(t,e,i,n,r={}){return e?this.concat(e,i,n)._parse(t,r):this._parse(t,r)}_parse(t,e){function i(t,e,i){return"assert"===i?new wy(e,[t]):"coerce"===i?new Sy(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=t[0];if("string"!=typeof n)return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const r=this.registry[n];if(r){let n=r.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,r=n.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==r.kind){if("projectionDefinition"===t.kind&&["string","array"].includes(r.kind)||["color","formatted","resolvedImage"].includes(t.kind)&&["value","string"].includes(r.kind)||["padding","numberArray"].includes(t.kind)&&["value","number","array"].includes(r.kind)||"colorArray"===t.kind&&["value","string","array"].includes(r.kind)||"variableAnchorOffsetCollection"===t.kind&&["value","array"].includes(r.kind))n=i(n,t,e.typeAnnotation||"coerce");else if(this.checkSubtype(t,r))return null}else n=i(n,t,e.typeAnnotation||"assert")}if(!(n instanceof vy)&&"resolvedImage"!==n.type.kind&&this._isConstant(n)){const t=new Ey;try{n=new vy(n.type,n.evaluate(t))}catch(t){return this.error(t.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return void 0===t?this.error("'undefined' value invalid. Use null instead."):"object"==typeof t?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof t} instead.`)}concat(t,e,i){const n="number"==typeof t?this.path.concat(t):this.path,r=i?this.scope.concat(i):this.scope;return new Cy(this.registry,this._isConstant,n,e||null,r,this.errors)}error(t,...e){const i=`${this.key}${e.map(t=>`[${t}]`).join("")}`;this.errors.push(new lm(i,t))}checkSubtype(t,e){const i=Im(t,e);return i&&this.error(i),i}}class Py{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const i=[];for(let n=1;n<t.length-1;n+=2){const r=t[n];if("string"!=typeof r)return e.error(`Expected string, but found ${typeof r} instead.`,n);if(/[^a-zA-Z0-9_]/.test(r))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);const s=e.parse(t[n+1],n+1);if(!s)return null;i.push([r,s])}const n=e.parse(t[t.length-1],t.length-1,e.expectedType,i);return n?new Py(i,n):null}outputDefined(){return this.result.outputDefined()}}class Iy{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const i=t[1];return e.scope.has(i)?new Iy(i,e.scope.get(i)):e.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class Ty{constructor(t,e,i){this.type=t,this.index=e,this.input=i}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,cm),n=e.parse(t[2],2,Em(e.expectedType||ym));if(!i||!n)return null;const r=n.type;return new Ty(r.itemType,i,n)}evaluate(t){const e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new uy(`Array index out of bounds: ${e} < 0.`);if(e>=i.length)throw new uy(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new uy(`Array index must be an integer, but found ${e} instead.`);return i[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class ky{constructor(t,e){this.type=fm,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ym),n=e.parse(t[2],2,ym);return i&&n?Tm(i.type,[fm,dm,cm,um,ym])?new ky(i,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Cm(i.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!km(e,["boolean","string","number","null"]))throw new uy(`Expected first argument to be of type boolean, string, number or null, but found ${Cm(yy(e))} instead.`);if(!km(i,["string","array"]))throw new uy(`Expected second argument to be of type array or string, but found ${Cm(yy(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class Ry{constructor(t,e,i){this.type=cm,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ym),n=e.parse(t[2],2,ym);if(!i||!n)return null;if(!Tm(i.type,[fm,dm,cm,um,ym]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Cm(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,cm);return r?new Ry(i,n,r):null}return new Ry(i,n)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!km(e,["boolean","string","number","null"]))throw new uy(`Expected first argument to be of type boolean, string, number or null, but found ${Cm(yy(e))} instead.`);let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(t)),km(i,["string"])){const t=i.indexOf(e,n);return-1===t?-1:[...i.slice(0,t)].length}if(km(i,["array"]))return i.indexOf(e,n);throw new uy(`Expected second argument to be of type array or string, but found ${Cm(yy(i))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Ay{constructor(t,e,i,n,r,s){this.inputType=t,this.type=e,this.input=i,this.cases=n,this.outputs=r,this.otherwise=s}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let i,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const r={},s=[];for(let o=2;o<t.length-1;o+=2){let a=t[o];const l=t[o+1];Array.isArray(a)||(a=[a]);const h=e.concat(o);if(0===a.length)return h.error("Expected at least one branch label.");for(const t of a){if("number"!=typeof t&&"string"!=typeof t)return h.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return h.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return h.error("Numeric branch labels must be integer values.");if(i){if(h.checkSubtype(i,yy(t)))return null}else i=yy(t);if(void 0!==r[String(t)])return h.error("Branch labels must be unique.");r[String(t)]=s.length}const u=e.parse(l,o,n);if(!u)return null;n=n||u.type,s.push(u)}const o=e.parse(t[1],1,ym);if(!o)return null;const a=e.parse(t[t.length-1],t.length-1,n);return a?"value"!==o.type.kind&&e.concat(1).checkSubtype(i,o.type)?null:new Ay(i,n,o,r,s,a):null}evaluate(t){const e=this.input.evaluate(t);return(yy(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class Oy{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const n=[];for(let r=1;r<t.length-1;r+=2){const s=e.parse(t[r],r,fm);if(!s)return null;const o=e.parse(t[r+1],r+1,i);if(!o)return null;n.push([s,o]),i=i||o.type}const r=e.parse(t[t.length-1],t.length-1,i);if(!r)return null;if(!i)throw new Error("Can't infer output type");return new Oy(i,n,r)}evaluate(t){for(const[e,i]of this.branches)if(e.evaluate(t))return i.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,i]of this.branches)t(e),t(i);t(this.otherwise)}outputDefined(){return this.branches.every(([t,e])=>e.outputDefined())&&this.otherwise.outputDefined()}}class Gy{constructor(t,e,i,n){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ym),n=e.parse(t[2],2,cm);if(!i||!n)return null;if(!Tm(i.type,[Em(ym),dm,ym]))return e.error(`Expected first argument to be of type array or string, but found ${Cm(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,cm);return r?new Gy(i.type,i,n,r):null}return new Gy(i.type,i,n)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);let n;if(this.endIndex&&(n=this.endIndex.evaluate(t)),km(e,["string"]))return[...e].slice(i,n).join("");if(km(e,["array"]))return e.slice(i,n);throw new uy(`Expected first argument to be of type array or string, but found ${Cm(yy(e))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function Fy(t,e){const i=t.length-1;let n,r,s=0,o=i,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),n=t[a],r=t[a+1],n<=e){if(a===i||e<r)return a;s=a+1}else{if(!(n>e))throw new uy("Input is not a number.");o=a-1}return 0}class Ly{constructor(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const i=e.parse(t[1],1,cm);if(!i)return null;const n=[];let r=null;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(let i=1;i<t.length;i+=2){const s=1===i?-1/0:t[i],o=t[i+1],a=i,l=i+1;if("number"!=typeof s)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(n.length&&n[n.length-1][0]>=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const h=e.parse(o,l,r);if(!h)return null;r=r||h.type,n.push([s,h])}return new Ly(r,i,n)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;return n>=e[r-1]?i[r-1].evaluate(t):i[Fy(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function jy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ny,Dy,zy=function(){if(Dy)return Ny;function t(t,e,i,n){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=i,this.p2y=n}return Dy=1,Ny=t,t.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var i=t,n=0;n<8;n++){var r=this.sampleCurveX(i)-t;if(Math.abs(r)<e)return i;var s=this.sampleCurveDerivativeX(i);if(Math.abs(s)<1e-6)break;i-=r/s}var o=0,a=1;for(i=t,n=0;n<20&&(r=this.sampleCurveX(i),!(Math.abs(r-t)<e));n++)t>r?o=i:a=i,i=.5*(a-o)+o;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},Ny}(),qy=jy(zy);class By{constructor(t,e,i,n,r){this.type=t,this.operator=e,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,i,n){let r=0;if("exponential"===t.name)r=$y(e,t.base,i,n);else if("linear"===t.name)r=$y(e,1,i,n);else if("cubic-bezier"===t.name){const s=t.controlPoints;r=new qy(s[0],s[1],s[2],s[3]).solve($y(e,1,i,n))}return r}static parse(t,e){let[i,n,r,...s]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t}}else{if("cubic-bezier"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.slice(1);if(4!==t.length||t.some(t=>"number"!=typeof t||t<0||t>1))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(r=e.parse(r,2,cm),!r)return null;const o=[];let a=null;"interpolate-hcl"!==i&&"interpolate-lab"!==i||e.expectedType==wm?e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType):a=pm;for(let t=0;t<s.length;t+=2){const i=s[t],n=s[t+1],r=t+3,l=t+4;if("number"!=typeof i)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',r);if(o.length&&o[o.length-1][0]>=i)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const h=e.parse(n,l,a);if(!h)return null;a=a||h.type,o.push([i,h])}return Rm(a,cm)||Rm(a,gm)||Rm(a,pm)||Rm(a,xm)||Rm(a,bm)||Rm(a,wm)||Rm(a,Mm)||Rm(a,Em(cm))?new By(a,i,n,r,o):e.error(`Type ${Cm(a)} is not interpolatable.`)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;if(n>=e[r-1])return i[r-1].evaluate(t);const s=Fy(e,n),o=e[s],a=e[s+1],l=By.interpolationFactor(this.interpolation,n,o,a),h=i[s].evaluate(t),u=i[s+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return ty(h,u,l);case"color":return iy.interpolate(h,u,l);case"padding":return ay.interpolate(h,u,l);case"colorArray":return hy.interpolate(h,u,l);case"numberArray":return ly.interpolate(h,u,l);case"variableAnchorOffsetCollection":return dy.interpolate(h,u,l);case"array":return ey(h,u,l);case"projectionDefinition":return py.interpolate(h,u,l)}case"interpolate-hcl":switch(this.type.kind){case"color":return iy.interpolate(h,u,l,"hcl");case"colorArray":return hy.interpolate(h,u,l,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return iy.interpolate(h,u,l,"lab");case"colorArray":return hy.interpolate(h,u,l,"lab")}}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function $y(t,e,i,n){const r=n-i,s=t-i;return 0===r?0:1===e?s/r:(Math.pow(e,s)-1)/(Math.pow(e,r)-1)}iy.interpolate,ay.interpolate,ly.interpolate,hy.interpolate,dy.interpolate;class Uy{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i=null;const n=e.expectedType;n&&"value"!==n.kind&&(i=n);const r=[];for(const n of t.slice(1)){const t=e.parse(n,1+r.length,i,void 0,{typeAnnotation:"omit"});if(!t)return null;i=i||t.type,r.push(t)}if(!i)throw new Error("No output type");const s=n&&r.some(t=>Im(n,t.type));return new Uy(s?ym:i,r)}evaluate(t){let e,i=null,n=0;for(const r of this.args)if(n++,i=r.evaluate(t),i&&i instanceof fy&&!i.available&&(e||(e=i.name),i=null,n===this.args.length&&(i=e)),null!==i)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function Wy(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function Xy(t,e,i,n){return 0===n.compare(e,i)}function Vy(t,e,i){const n="=="!==t&&"!="!==t;return class r{constructor(t,e,i){this.type=fm,this.lhs=t,this.rhs=e,this.collator=i,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const i=t[0];let s=e.parse(t[1],1,ym);if(!s)return null;if(!Wy(i,s.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${Cm(s.type)}'.`);let o=e.parse(t[2],2,ym);if(!o)return null;if(!Wy(i,o.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${Cm(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${Cm(s.type)}' and '${Cm(o.type)}'.`);n&&("value"===s.type.kind&&"value"!==o.type.kind?s=new wy(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new wy(s.type,[o])));let a=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,_m),!a)return null}return new r(s,o,a)}evaluate(r){const s=this.lhs.evaluate(r),o=this.rhs.evaluate(r);if(n&&this.hasUntypedArgument){const e=yy(s),i=yy(o);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new uy(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${i.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=yy(s),i=yy(o);if("string"!==t.kind||"string"!==i.kind)return e(r,s,o)}return this.collator?i(r,s,o,this.collator.evaluate(r)):e(r,s,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const Ky=Vy("==",function(t,e,i){return e===i},Xy),Zy=Vy("!=",function(t,e,i){return e!==i},function(t,e,i,n){return!Xy(0,e,i,n)}),Yy=Vy("<",function(t,e,i){return e<i},function(t,e,i,n){return n.compare(e,i)<0}),Hy=Vy(">",function(t,e,i){return e>i},function(t,e,i,n){return n.compare(e,i)>0}),Jy=Vy("<=",function(t,e,i){return e<=i},function(t,e,i,n){return n.compare(e,i)<=0}),Qy=Vy(">=",function(t,e,i){return e>=i},function(t,e,i,n){return n.compare(e,i)>=0});class t_{constructor(t,e,i){this.type=_m,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const i=t[1];if("object"!=typeof i||Array.isArray(i))return e.error("Collator options argument must be an object.");const n=e.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,fm);if(!n)return null;const r=e.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,fm);if(!r)return null;let s=null;return i.locale&&(s=e.parse(i.locale,1,dm),!s)?null:new t_(n,r,s)}evaluate(t){return new ny(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class e_{constructor(t,e,i,n,r,s){this.type=dm,this.number=t,this.locale=e,this.currency=i,this.unit=n,this.minFractionDigits=r,this.maxFractionDigits=s}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,cm);if(!i)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let r=null;if(n.locale&&(r=e.parse(n.locale,1,dm),!r))return null;let s=null;if(n.currency&&(s=e.parse(n.currency,1,dm),!s))return null;let o=null;if(n.unit&&(o=e.parse(n.unit,1,dm),!o))return null;if(s&&o)return e.error("NumberFormat options `currency` and `unit` are mutually exclusive");let a=null;if(n["min-fraction-digits"]&&(a=e.parse(n["min-fraction-digits"],1,cm),!a))return null;let l=null;return n["max-fraction-digits"]&&(l=e.parse(n["max-fraction-digits"],1,cm),!l)?null:new e_(i,r,s,o,a,l)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class i_{constructor(t){this.type=vm,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");const n=[];let r=!1;for(let i=1;i<=t.length-1;++i){const s=t[i];if(r&&"object"==typeof s&&!Array.isArray(s)){r=!1;let t=null;if(s["font-scale"]&&(t=e.parse(s["font-scale"],1,cm),!t))return null;let i=null;if(s["text-font"]&&(i=e.parse(s["text-font"],1,Em(dm)),!i))return null;let o=null;if(s["text-color"]&&(o=e.parse(s["text-color"],1,pm),!o))return null;let a=null;if(s["vertical-align"]){if("string"==typeof s["vertical-align"]&&!ry.includes(s["vertical-align"]))return e.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${s["vertical-align"]}' instead.`);if(a=e.parse(s["vertical-align"],1,dm),!a)return null}const l=n[n.length-1];l.scale=t,l.font=i,l.textColor=o,l.verticalAlign=a}else{const s=e.parse(t[i],1,ym);if(!s)return null;const o=s.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,n.push({content:s,scale:null,font:null,textColor:null,verticalAlign:null})}}return new i_(n)}evaluate(t){return new oy(this.sections.map(e=>{const i=e.content.evaluate(t);return yy(i)===Sm?new sy("",i,null,null,null,e.verticalAlign?e.verticalAlign.evaluate(t):null):new sy(_y(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null,e.verticalAlign?e.verticalAlign.evaluate(t):null)}))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor),e.verticalAlign&&t(e.verticalAlign)}outputDefined(){return!1}}class n_{constructor(t){this.type=Sm,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,dm);return i?new n_(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=fy.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}}class r_{constructor(t){this.type=cm,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const i=e.parse(t[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?e.error(`Expected argument of type string or array, but found ${Cm(i.type)} instead.`):new r_(i):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return[...e].length;if(Array.isArray(e))return e.length;throw new uy(`Expected value to be of type string or array, but found ${Cm(yy(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const s_=8192;function o_(t,e){const i=(180+t[0])/360,n=(r=t[1],(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360);var r;const s=Math.pow(2,e.z);return[Math.round(i*s*s_),Math.round(n*s*s_)]}function a_(t,e){const i=Math.pow(2,e.z);return[(r=(t[0]/s_+e.x)/i,360*r-180),(n=(t[1]/s_+e.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180))-90)];var n,r}function l_(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function h_(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function u_(t,e,i){return e[1]>t[1]!=i[1]>t[1]&&t[0]<(i[0]-e[0])*(t[1]-e[1])/(i[1]-e[1])+e[0]}function c_(t,e,i){const n=t[0]-e[0],r=t[1]-e[1],s=t[0]-i[0],o=t[1]-i[1];return n*o-s*r===0&&n*s<=0&&r*o<=0}function d_(t,e,i,n){const r=[e[0]-t[0],e[1]-t[1]];return 0!==(s=[n[0]-i[0],n[1]-i[1]])[0]*(o=r)[1]-s[1]*o[0]&&!(!__(t,e,i,n)||!__(i,n,t,e));var s,o}function f_(t,e,i){for(const n of i)for(let i=0;i<n.length-1;++i)if(d_(t,e,n[i],n[i+1]))return!0;return!1}function p_(t,e,i=!1){let n=!1;for(const r of e)for(let e=0;e<r.length-1;e++){if(c_(t,r[e],r[e+1]))return i;u_(t,r[e],r[e+1])&&(n=!n)}return n}function g_(t,e){for(const i of e)if(p_(t,i))return!0;return!1}function m_(t,e){for(const i of t)if(!p_(i,e))return!1;for(let i=0;i<t.length-1;++i)if(f_(t[i],t[i+1],e))return!1;return!0}function y_(t,e){for(const i of e)if(m_(t,i))return!0;return!1}function __(t,e,i,n){const r=t[0]-i[0],s=t[1]-i[1],o=e[0]-i[0],a=e[1]-i[1],l=n[0]-i[0],h=n[1]-i[1],u=r*h-l*s,c=o*h-l*a;return u>0&&c<0||u<0&&c>0}function v_(t,e,i){const n=[];for(let r=0;r<t.length;r++){const s=[];for(let n=0;n<t[r].length;n++){const o=o_(t[r][n],i);l_(e,o),s.push(o)}n.push(s)}return n}function x_(t,e,i){const n=[];for(let r=0;r<t.length;r++){const s=v_(t[r],e,i);n.push(s)}return n}function w_(t,e,i,n){if(t[0]<i[0]||t[0]>i[2]){const e=.5*n;let r=t[0]-i[0]>e?-n:i[0]-t[0]>e?n:0;0===r&&(r=t[0]-i[2]>e?-n:i[2]-t[0]>e?n:0),t[0]+=r}l_(e,t)}function b_(t,e,i,n){const r=Math.pow(2,n.z)*s_,s=[n.x*s_,n.y*s_],o=[];for(const n of t)for(const t of n){const n=[t.x+s[0],t.y+s[1]];w_(n,e,i,r),o.push(n)}return o}function S_(t,e,i,n){const r=Math.pow(2,n.z)*s_,s=[n.x*s_,n.y*s_],o=[];for(const i of t){const t=[];for(const n of i){const i=[n.x+s[0],n.y+s[1]];l_(e,i),t.push(i)}o.push(t)}if(e[2]-e[0]<=r/2){(a=e)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const t of o)for(const n of t)w_(n,e,i,r)}var a;return o}class M_{constructor(t,e){this.type=fm,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(my(t[1])){const e=t[1];if("FeatureCollection"===e.type){const t=[];for(const i of e.features){const{type:e,coordinates:n}=i.geometry;"Polygon"===e&&t.push(n),"MultiPolygon"===e&&t.push(...n)}if(t.length)return new M_(e,{type:"MultiPolygon",coordinates:t})}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new M_(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new M_(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if("Polygon"===e.type){const s=v_(e.coordinates,n,r),o=b_(t.geometry(),i,n,r);if(!h_(i,n))return!1;for(const t of o)if(!p_(t,s))return!1}if("MultiPolygon"===e.type){const s=x_(e.coordinates,n,r),o=b_(t.geometry(),i,n,r);if(!h_(i,n))return!1;for(const t of o)if(!g_(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if("Polygon"===e.type){const s=v_(e.coordinates,n,r),o=S_(t.geometry(),i,n,r);if(!h_(i,n))return!1;for(const t of o)if(!m_(t,s))return!1}if("MultiPolygon"===e.type){const s=x_(e.coordinates,n,r),o=S_(t.geometry(),i,n,r);if(!h_(i,n))return!1;for(const t of o)if(!y_(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class E_{constructor(t=[],e=(t,e)=>t<e?-1:t>e?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:i}=this,n=e[t];for(;t>0;){const r=t-1>>1,s=e[r];if(i(n,s)>=0)break;e[t]=s,t=r}e[t]=n}_down(t){const{data:e,compare:i}=this,n=this.length>>1,r=e[t];for(;t<n;){let n=1+(t<<1);const s=n+1;if(s<this.length&&i(e[s],e[n])<0&&(n=s),i(e[n],r)>=0)break;e[t]=e[n],t=n}e[t]=r}}function C_(t){let e=0;for(let i,n,r=0,s=t.length,o=s-1;r<s;o=r++)i=t[r],n=t[o],e+=(n.x-i.x)*(i.y+n.y);return e}const P_=1/298.257223563,I_=P_*(2-P_),T_=Math.PI/180;class k_{constructor(t){const e=6378.137*T_*1e3,i=Math.cos(t*T_),n=1/(1-I_*(1-i*i)),r=Math.sqrt(n);this.kx=e*r*i,this.ky=e*r*n*(1-I_)}distance(t,e){const i=this.wrap(t[0]-e[0])*this.kx,n=(t[1]-e[1])*this.ky;return Math.sqrt(i*i+n*n)}pointOnLine(t,e){let i,n,r,s,o=1/0;for(let a=0;a<t.length-1;a++){let l=t[a][0],h=t[a][1],u=this.wrap(t[a+1][0]-l)*this.kx,c=(t[a+1][1]-h)*this.ky,d=0;0===u&&0===c||(d=(this.wrap(e[0]-l)*this.kx*u+(e[1]-h)*this.ky*c)/(u*u+c*c),d>1?(l=t[a+1][0],h=t[a+1][1]):d>0&&(l+=u/this.kx*d,h+=c/this.ky*d)),u=this.wrap(e[0]-l)*this.kx,c=(e[1]-h)*this.ky;const f=u*u+c*c;f<o&&(o=f,i=l,n=h,r=a,s=d)}return{point:[i,n],index:r,t:Math.max(0,Math.min(1,s))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function R_(t,e){return e[0]-t[0]}function A_(t){return t[1]-t[0]+1}function O_(t,e){return t[1]>=t[0]&&t[1]<e}function G_(t,e){if(t[0]>t[1])return[null,null];const i=A_(t);if(e){if(2===i)return[t,null];const e=Math.floor(i/2);return[[t[0],t[0]+e],[t[0]+e,t[1]]]}if(1===i)return[t,null];const n=Math.floor(i/2)-1;return[[t[0],t[0]+n],[t[0]+n+1,t[1]]]}function F_(t,e){if(!O_(e,t.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)l_(i,t[n]);return i}function L_(t){const e=[1/0,1/0,-1/0,-1/0];for(const i of t)for(const t of i)l_(e,t);return e}function j_(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function N_(t,e,i){if(!j_(t)||!j_(e))return NaN;let n=0,r=0;return t[2]<e[0]&&(n=e[0]-t[2]),t[0]>e[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(r=t[1]-e[3]),t[3]<e[1]&&(r=e[1]-t[3]),i.distance([0,0],[n,r])}function D_(t,e,i){const n=i.pointOnLine(e,t);return i.distance(t,n.point)}function z_(t,e,i,n,r){const s=Math.min(D_(t,[i,n],r),D_(e,[i,n],r)),o=Math.min(D_(i,[t,e],r),D_(n,[t,e],r));return Math.min(s,o)}function q_(t,e,i,n,r){if(!O_(e,t.length)||!O_(n,i.length))return 1/0;let s=1/0;for(let o=e[0];o<e[1];++o){const e=t[o],a=t[o+1];for(let t=n[0];t<n[1];++t){const n=i[t],o=i[t+1];if(d_(e,a,n,o))return 0;s=Math.min(s,z_(e,a,n,o,r))}}return s}function B_(t,e,i,n,r){if(!O_(e,t.length)||!O_(n,i.length))return NaN;let s=1/0;for(let o=e[0];o<=e[1];++o)for(let e=n[0];e<=n[1];++e)if(s=Math.min(s,r.distance(t[o],i[e])),0===s)return s;return s}function $_(t,e,i){if(p_(t,e,!0))return 0;let n=1/0;for(const r of e){const e=r[0],s=r[r.length-1];if(e!==s&&(n=Math.min(n,D_(t,[s,e],i)),0===n))return n;const o=i.pointOnLine(r,t);if(n=Math.min(n,i.distance(t,o.point)),0===n)return n}return n}function U_(t,e,i,n){if(!O_(e,t.length))return NaN;for(let n=e[0];n<=e[1];++n)if(p_(t[n],i,!0))return 0;let r=1/0;for(let s=e[0];s<e[1];++s){const e=t[s],o=t[s+1];for(const t of i)for(let i=0,s=t.length,a=s-1;i<s;a=i++){const s=t[a],l=t[i];if(d_(e,o,s,l))return 0;r=Math.min(r,z_(e,o,s,l,n))}}return r}function W_(t,e){for(const i of t)for(const t of i)if(p_(t,e,!0))return!0;return!1}function X_(t,e,i,n=1/0){const r=L_(t),s=L_(e);if(n!==1/0&&N_(r,s,i)>=n)return n;if(h_(r,s)){if(W_(t,e))return 0}else if(W_(e,t))return 0;let o=1/0;for(const n of t)for(let t=0,r=n.length,s=r-1;t<r;s=t++){const r=n[s],a=n[t];for(const t of e)for(let e=0,n=t.length,s=n-1;e<n;s=e++){const n=t[s],l=t[e];if(d_(r,a,n,l))return 0;o=Math.min(o,z_(r,a,n,l,i))}}return o}function V_(t,e,i,n,r,s){if(!s)return;const o=N_(F_(n,s),r,i);o<e&&t.push([o,s,[0,0]])}function K_(t,e,i,n,r,s,o){if(!s||!o)return;const a=N_(F_(n,s),F_(r,o),i);a<e&&t.push([a,s,o])}function Z_(t,e,i,n,r=1/0){let s=Math.min(n.distance(t[0],i[0][0]),r);if(0===s)return s;const o=new E_([[0,[0,t.length-1],[0,0]]],R_),a=L_(i);for(;o.length>0;){const r=o.pop();if(r[0]>=s)continue;const l=r[1],h=e?50:100;if(A_(l)<=h){if(!O_(l,t.length))return NaN;if(e){const e=U_(t,l,i,n);if(isNaN(e)||0===e)return e;s=Math.min(s,e)}else for(let e=l[0];e<=l[1];++e){const r=$_(t[e],i,n);if(s=Math.min(s,r),0===s)return 0}}else{const i=G_(l,e);V_(o,s,n,t,a,i[0]),V_(o,s,n,t,a,i[1])}}return s}function Y_(t,e,i,n,r,s=1/0){let o=Math.min(s,r.distance(t[0],i[0]));if(0===o)return o;const a=new E_([[0,[0,t.length-1],[0,i.length-1]]],R_);for(;a.length>0;){const s=a.pop();if(s[0]>=o)continue;const l=s[1],h=s[2],u=e?50:100,c=n?50:100;if(A_(l)<=u&&A_(h)<=c){if(!O_(l,t.length)&&O_(h,i.length))return NaN;let s;if(e&&n)s=q_(t,l,i,h,r),o=Math.min(o,s);else if(e&&!n){const e=t.slice(l[0],l[1]+1);for(let t=h[0];t<=h[1];++t)if(s=D_(i[t],e,r),o=Math.min(o,s),0===o)return o}else if(!e&&n){const e=i.slice(h[0],h[1]+1);for(let i=l[0];i<=l[1];++i)if(s=D_(t[i],e,r),o=Math.min(o,s),0===o)return o}else s=B_(t,l,i,h,r),o=Math.min(o,s)}else{const s=G_(l,e),u=G_(h,n);K_(a,o,r,t,i,s[0],u[0]),K_(a,o,r,t,i,s[0],u[1]),K_(a,o,r,t,i,s[1],u[0]),K_(a,o,r,t,i,s[1],u[1])}}return o}function H_(t){return"MultiPolygon"===t.type?t.coordinates.map(t=>({type:"Polygon",coordinates:t})):"MultiLineString"===t.type?t.coordinates.map(t=>({type:"LineString",coordinates:t})):"MultiPoint"===t.type?t.coordinates.map(t=>({type:"Point",coordinates:t})):[t]}class J_{constructor(t,e){this.type=cm,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(my(t[1])){const e=t[1];if("FeatureCollection"===e.type)return new J_(e,e.features.map(t=>H_(t.geometry)).flat());if("Feature"===e.type)return new J_(e,H_(e.geometry));if("type"in e&&"coordinates"in e)return new J_(e,H_(e))}return e.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const i=t.geometry(),n=i.flat().map(e=>a_([e.x,e.y],t.canonical));if(0===i.length)return NaN;const r=new k_(n[0][1]);let s=1/0;for(const t of e){switch(t.type){case"Point":s=Math.min(s,Y_(n,!1,[t.coordinates],!1,r,s));break;case"LineString":s=Math.min(s,Y_(n,!1,t.coordinates,!0,r,s));break;case"Polygon":s=Math.min(s,Z_(n,!1,t.coordinates,r,s))}if(0===s)return s}return s}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=t.geometry(),n=i.flat().map(e=>a_([e.x,e.y],t.canonical));if(0===i.length)return NaN;const r=new k_(n[0][1]);let s=1/0;for(const t of e){switch(t.type){case"Point":s=Math.min(s,Y_(n,!0,[t.coordinates],!1,r,s));break;case"LineString":s=Math.min(s,Y_(n,!0,t.coordinates,!0,r,s));break;case"Polygon":s=Math.min(s,Z_(n,!0,t.coordinates,r,s))}if(0===s)return s}return s}(t,this.geometries);if("Polygon"===t.geometryType())return function(t,e){const i=t.geometry();if(0===i.length||0===i[0].length)return NaN;const n=function(t){if(t.length<=1)return[t];const e=[];let i,n;for(const r of t){const t=C_(r);0!==t&&(r.area=Math.abs(t),void 0===n&&(n=t<0),n===t<0?(i&&e.push(i),i=[r]):i.push(r))}return i&&e.push(i),e}(i).map(e=>e.map(e=>e.map(e=>a_([e.x,e.y],t.canonical)))),r=new k_(n[0][0][0][1]);let s=1/0;for(const t of e)for(const e of n){switch(t.type){case"Point":s=Math.min(s,Z_([t.coordinates],!1,e,r,s));break;case"LineString":s=Math.min(s,Z_(t.coordinates,!0,e,r,s));break;case"Polygon":s=Math.min(s,X_(e,t.coordinates,r,s))}if(0===s)return s}return s}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Q_{constructor(t){this.type=ym,this.key=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const i=t[1];return null==i?e.error("Global state property must be defined."):"string"!=typeof i?e.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new Q_(i)}evaluate(t){var e;const i=null===(e=t.globals)||void 0===e?void 0:e.globalState;return i&&0!==Object.keys(i).length?Km(i,this.key):null}eachChild(){}outputDefined(){return!1}}const tv={"==":Ky,"!=":Zy,">":Hy,"<":Yy,">=":Qy,"<=":Jy,array:wy,at:Ty,boolean:wy,case:Oy,coalesce:Uy,collator:t_,format:i_,image:n_,in:ky,"index-of":Ry,interpolate:By,"interpolate-hcl":By,"interpolate-lab":By,length:r_,let:Py,literal:vy,match:Ay,number:wy,"number-format":e_,object:wy,slice:Gy,step:Ly,string:wy,"to-boolean":Sy,"to-color":Sy,"to-number":Sy,"to-string":Sy,var:Iy,within:M_,distance:J_,"global-state":Q_};class ev{constructor(t,e,i,n){this.name=t,this.type=e,this._evaluate=i,this.args=n}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,e){const i=t[0],n=ev.definitions[i];if(!n)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,o=s.filter(([e])=>!Array.isArray(e)||e.length===t.length-1);let a=null;for(const[n,s]of o){a=new Cy(e.registry,ov,e.path,null,e.scope);const o=[];let l=!1;for(let e=1;e<t.length;e++){const i=t[e],r=Array.isArray(n)?n[e-1]:n.type,s=a.parse(i,1+o.length,r);if(!s){l=!0;break}o.push(s)}if(!l)if(Array.isArray(n)&&n.length!==o.length)a.error(`Expected ${n.length} arguments, but found ${o.length} instead.`);else{for(let t=0;t<o.length;t++){const e=Array.isArray(n)?n[t]:n.type,i=o[t];a.concat(t+1).checkSubtype(e,i.type)}if(0===a.errors.length)return new ev(i,r,s,o)}}if(1===o.length)e.errors.push(...a.errors);else{const i=(o.length?o:s).map(([t])=>{return e=t,Array.isArray(e)?`(${e.map(Cm).join(", ")})`:`(${Cm(e.type)}...)`;var e}).join(" | "),n=[];for(let i=1;i<t.length;i++){const r=e.parse(t[i],1+n.length);if(!r)return null;n.push(Cm(r.type))}e.error(`Expected arguments of type ${i}, but found (${n.join(", ")}) instead.`)}return null}static register(t,e){ev.definitions=e;for(const i in e)t[i]=ev}}function iv(t,[e,i,n,r]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);const s=r?r.evaluate(t):1,o=gy(e,i,n,s);if(o)throw new uy(o);return new iy(e/255,i/255,n/255,s,!1)}function nv(t,e){return t in e}function rv(t,e){const i=e[t];return void 0===i?null:i}function sv(t){return{type:t}}function ov(t){if(t instanceof Iy)return ov(t.boundExpression);if(t instanceof ev&&"error"===t.name)return!1;if(t instanceof t_)return!1;if(t instanceof M_)return!1;if(t instanceof J_)return!1;if(t instanceof Q_)return!1;const e=t instanceof Sy||t instanceof wy;let i=!0;return t.eachChild(t=>{i=e?i&&ov(t):i&&t instanceof vy}),!!i&&av(t)&&hv(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function av(t){if(t instanceof ev){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof M_)return!1;if(t instanceof J_)return!1;let e=!0;return t.eachChild(t=>{e&&!av(t)&&(e=!1)}),e}function lv(t){if(t instanceof ev&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild(t=>{e&&!lv(t)&&(e=!1)}),e}function hv(t,e){if(t instanceof ev&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild(t=>{i&&!hv(t,e)&&(i=!1)}),i}function uv(t){return{result:"success",value:t}}function cv(t){return{result:"error",value:t}}function dv(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function fv(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function pv(t){return!!t.expression&&t.expression.interpolated}function gv(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function mv(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)&&yy(t)===mm}ev.register(tv,{error:[{kind:"error"},[dm],(t,[e])=>{throw new uy(e.evaluate(t))}],typeof:[dm,[ym],(t,[e])=>Cm(yy(e.evaluate(t)))],"to-rgba":[Em(cm,4),[pm],(t,[e])=>{const[i,n,r,s]=e.evaluate(t).rgb;return[255*i,255*n,255*r,s]}],rgb:[pm,[cm,cm,cm],iv],rgba:[pm,[cm,cm,cm,cm],iv],has:{type:fm,overloads:[[[dm],(t,[e])=>nv(e.evaluate(t),t.properties())],[[dm,mm],(t,[e,i])=>nv(e.evaluate(t),i.evaluate(t))]]},get:{type:ym,overloads:[[[dm],(t,[e])=>rv(e.evaluate(t),t.properties())],[[dm,mm],(t,[e,i])=>rv(e.evaluate(t),i.evaluate(t))]]},"feature-state":[ym,[dm],(t,[e])=>rv(e.evaluate(t),t.featureState||{})],properties:[mm,[],t=>t.properties()],"geometry-type":[dm,[],t=>t.geometryType()],id:[ym,[],t=>t.id()],zoom:[cm,[],t=>t.globals.zoom],"heatmap-density":[cm,[],t=>t.globals.heatmapDensity||0],elevation:[cm,[],t=>t.globals.elevation||0],"line-progress":[cm,[],t=>t.globals.lineProgress||0],accumulated:[ym,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[cm,sv(cm),(t,e)=>{let i=0;for(const n of e)i+=n.evaluate(t);return i}],"*":[cm,sv(cm),(t,e)=>{let i=1;for(const n of e)i*=n.evaluate(t);return i}],"-":{type:cm,overloads:[[[cm,cm],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[cm],(t,[e])=>-e.evaluate(t)]]},"/":[cm,[cm,cm],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[cm,[cm,cm],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[cm,[],()=>Math.LN2],pi:[cm,[],()=>Math.PI],e:[cm,[],()=>Math.E],"^":[cm,[cm,cm],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[cm,[cm],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[cm,[cm],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[cm,[cm],(t,[e])=>Math.log(e.evaluate(t))],log2:[cm,[cm],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[cm,[cm],(t,[e])=>Math.sin(e.evaluate(t))],cos:[cm,[cm],(t,[e])=>Math.cos(e.evaluate(t))],tan:[cm,[cm],(t,[e])=>Math.tan(e.evaluate(t))],asin:[cm,[cm],(t,[e])=>Math.asin(e.evaluate(t))],acos:[cm,[cm],(t,[e])=>Math.acos(e.evaluate(t))],atan:[cm,[cm],(t,[e])=>Math.atan(e.evaluate(t))],min:[cm,sv(cm),(t,e)=>Math.min(...e.map(e=>e.evaluate(t)))],max:[cm,sv(cm),(t,e)=>Math.max(...e.map(e=>e.evaluate(t)))],abs:[cm,[cm],(t,[e])=>Math.abs(e.evaluate(t))],round:[cm,[cm],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[cm,[cm],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[cm,[cm],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[fm,[dm,ym],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[fm,[ym],(t,[e])=>t.id()===e.value],"filter-type-==":[fm,[dm],(t,[e])=>t.geometryType()===e.value],"filter-<":[fm,[dm,ym],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<r}],"filter-id-<":[fm,[ym],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<n}],"filter->":[fm,[dm,ym],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>r}],"filter-id->":[fm,[ym],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[fm,[dm,ym],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<=r}],"filter-id-<=":[fm,[ym],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[fm,[dm,ym],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>=r}],"filter-id->=":[fm,[ym],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[fm,[ym],(t,[e])=>e.value in t.properties()],"filter-has-id":[fm,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[fm,[Em(dm)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[fm,[Em(ym)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[fm,[dm,Em(ym)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[fm,[dm,Em(ym)],(t,[e,i])=>function(t,e,i,n){for(;i<=n;){const r=i+n>>1;if(e[r]===t)return!0;e[r]>t?n=r-1:i=r+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:fm,overloads:[[[fm,fm],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[sv(fm),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:fm,overloads:[[[fm,fm],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[sv(fm),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[fm,[fm],(t,[e])=>!e.evaluate(t)],"is-supported-script":[fm,[dm],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[dm,[dm],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[dm,[dm],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[dm,sv(ym),(t,e)=>e.map(e=>_y(e.evaluate(t))).join("")],split:[Em(dm),[dm,dm],(t,[e,i])=>e.evaluate(t).split(i.evaluate(t))],join:[dm,[Em(dm),dm],(t,[e,i])=>e.evaluate(t).join(i.evaluate(t))],"resolved-locale":[dm,[_m],(t,[e])=>e.evaluate(t).resolvedLocale()]});class yv{constructor(t,e,i){this.expression=t,this._warningHistory={},this._evaluator=new Ey,this._defaultValue=e?function(t){if("color"===t.type&&mv(t.default))return new iy(0,0,0,0);switch(t.type){case"color":return iy.parse(t.default)||null;case"padding":return ay.parse(t.default)||null;case"numberArray":return ly.parse(t.default)||null;case"colorArray":return hy.parse(t.default)||null;case"variableAnchorOffsetCollection":return dy.parse(t.default)||null;case"projectionDefinition":return py.parse(t.default)||null;default:return void 0===t.default?null:t.default}}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null,this._globalState=i}evaluateWithoutErrorHandling(t,e,i,n,r,s){return this._globalState&&(t=Ev(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=n,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=s,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,n,r,s){this._globalState&&(t=Ev(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=s||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new uy(`Expected value to be one of ${Object.keys(this._enumValues).map(t=>JSON.stringify(t)).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function _v(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in tv}function vv(t,e,i){const n=new Cy(tv,ov,[],e?function(t){const e={color:pm,string:dm,number:cm,enum:dm,boolean:fm,formatted:vm,padding:xm,numberArray:bm,colorArray:wm,projectionDefinition:gm,resolvedImage:Sm,variableAnchorOffsetCollection:Mm};return"array"===t.type?Em(e[t.value]||ym,t.length):e[t.type]}(e):void 0),r=n.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return r?uv(new yv(r,e,i)):cv(n.errors)}class xv{constructor(t,e,i){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!lv(e.expression),this.globalStateRefs=Mv(e.expression),this._globalState=i}evaluateWithoutErrorHandling(t,e,i,n,r,s){return this._globalState&&(t=Ev(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,s)}evaluate(t,e,i,n,r,s){return this._globalState&&(t=Ev(t,this._globalState)),this._styleExpression.evaluate(t,e,i,n,r,s)}}class wv{constructor(t,e,i,n,r){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!lv(e.expression),this.globalStateRefs=Mv(e.expression),this.interpolationType=n,this._globalState=r}evaluateWithoutErrorHandling(t,e,i,n,r,s){return this._globalState&&(t=Ev(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,s)}evaluate(t,e,i,n,r,s){return this._globalState&&(t=Ev(t,this._globalState)),this._styleExpression.evaluate(t,e,i,n,r,s)}interpolationFactor(t,e,i){return this.interpolationType?By.interpolationFactor(this.interpolationType,t,e,i):0}}function bv(t,e,i){const n=vv(t,e,i);if("error"===n.result)return n;const r=n.value.expression,s=av(r);if(!s&&!dv(e))return cv([new lm("","data expressions not supported")]);const o=hv(r,["zoom"]);if(!o&&!fv(e))return cv([new lm("","zoom expressions not supported")]);const a=Sv(r);if(!a&&!o)return cv([new lm("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof lm)return cv([a]);if(a instanceof By&&!pv(e))return cv([new lm("",'"interpolate" expressions cannot be used with this property')]);if(!a)return uv(new xv(s?"constant":"source",n.value,i));const l=a instanceof By?a.interpolation:void 0;return uv(new wv(s?"camera":"composite",n.value,a.labels,l,i))}function Sv(t){let e=null;if(t instanceof Py)e=Sv(t.result);else if(t instanceof Uy){for(const i of t.args)if(e=Sv(i),e)break}else(t instanceof Ly||t instanceof By)&&t.input instanceof ev&&"zoom"===t.input.name&&(e=t);return e instanceof lm||t.eachChild(t=>{const i=Sv(t);i instanceof lm?e=i:!e&&i?e=new lm("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new lm("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Mv(t,e=new Set){return t instanceof Q_&&e.add(t.key),t.eachChild(t=>{Mv(t,e)}),e}function Ev(t,e){const{zoom:i,heatmapDensity:n,elevation:r,lineProgress:s,isSupportedScript:o,accumulated:a}=null!=t?t:{};return{zoom:i,heatmapDensity:n,elevation:r,lineProgress:s,isSupportedScript:o,accumulated:a,globalState:e}}function Cv(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!Cv(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const Pv={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Iv(t,e){return t<e?-1:t>e?1:0}function Tv(t){if(!Array.isArray(t))return!1;if("within"===t[0]||"distance"===t[0])return!0;for(let e=1;e<t.length;e++)if(Tv(t[e]))return!0;return!1}function kv(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?Rv(t[1],t[2],"=="):"!="===e?Gv(Rv(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?Rv(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map(kv))):"all"===e?["all"].concat(t.slice(1).map(kv)):"none"===e?["all"].concat(t.slice(1).map(kv).map(Gv)):"in"===e?Av(t[1],t.slice(2)):"!in"===e?Gv(Av(t[1],t.slice(2))):"has"===e?Ov(t[1]):"!has"!==e||Gv(Ov(t[1]));var i}function Rv(t,e,i){switch(t){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,t,e]}}function Av(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",t,["literal",e.sort(Iv)]]:["filter-in-small",t,["literal",e]]}}function Ov(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Gv(t){return["!",t]}function Fv(t){return"object"==typeof t?["literal",t]:t}function Lv(t,e){let i=t.stops;if(!i)return function(t,e){const i=["get",t.property];if(void 0===t.default)return"string"===e.type?["string",i]:i;if("enum"===e.type)return["match",i,Object.keys(e.values),i,t.default];{const n=["color"===e.type?"to-color":e.type,i,Fv(t.default)];return"array"===e.type&&n.splice(1,0,e.value,e.length||null),n}}(t,e);const n=i&&"object"==typeof i[0][0],r=n||void 0!==t.property,s=n||!r;return i=i.map(t=>!r&&e.tokens&&"string"==typeof t[1]?[t[0],$v(t[1])]:[t[0],Fv(t[1])]),n?function(t,e,i){const n={},r={},s=[];for(let e=0;e<i.length;e++){const o=i[e],a=o[0].zoom;void 0===n[a]&&(n[a]={zoom:a,type:t.type,property:t.property,default:t.default},r[a]=[],s.push(a)),r[a].push([o[0].value,o[1]])}if("exponential"===Bv({},e)){const i=[jv(t),["linear"],["zoom"]];for(const t of s)qv(i,t,Dv(n[t],e,r[t]),!1);return i}{const t=["step",["zoom"]];for(const i of s)qv(t,i,Dv(n[i],e,r[i]),!0);return zv(t),t}}(t,e,i):s?function(t,e,i,n=["zoom"]){const r=Bv(t,e);let s,o=!1;if("interval"===r)s=["step",n],o=!0;else{if("exponential"!==r)throw new Error(`Unknown zoom function type "${r}"`);{const e=void 0!==t.base?t.base:1;s=[jv(t),1===e?["linear"]:["exponential",e],n]}}for(const t of i)qv(s,t[0],t[1],o);return zv(s),s}(t,e,i):Dv(t,e,i)}function jv(t){switch(t.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function Nv(t,e){const i=Fv((n=t.default,r=e.default,void 0!==n?n:void 0!==r?r:void 0));var n,r;return void 0===i&&"resolvedImage"===e.type?"":i}function Dv(t,e,i){const n=Bv(t,e),r=["get",t.property];if("categorical"===n&&"boolean"==typeof i[0][0]){const n=["case"];for(const t of i)n.push(["==",r,t[0]],t[1]);return n.push(Nv(t,e)),n}if("categorical"===n){const n=["match",r];for(const t of i)qv(n,t[0],t[1],!1);return n.push(Nv(t,e)),n}if("interval"===n){const e=["step",["number",r]];for(const t of i)qv(e,t[0],t[1],!0);return zv(e),void 0===t.default?e:["case",["==",["typeof",r],"number"],e,Fv(t.default)]}if("exponential"===n){const e=void 0!==t.base?t.base:1,n=[jv(t),1===e?["linear"]:["exponential",e],["number",r]];for(const t of i)qv(n,t[0],t[1],!1);return void 0===t.default?n:["case",["==",["typeof",r],"number"],n,Fv(t.default)]}throw new Error(`Unknown property function type ${n}`)}function zv(t){"step"===t[0]&&3===t.length&&(t.push(0),t.push(t[3]))}function qv(t,e,i,n){t.length>3&&e===t[t.length-2]||(n&&2===t.length||t.push(e),t.push(i))}function Bv(t,e){return t.type?t.type:e.expression.interpolated?"exponential":"interval"}function $v(t){const e=["concat"],i=/{([^{}]+)}/g;let n=0;for(let r=i.exec(t);null!==r;r=i.exec(t)){const s=t.slice(n,i.lastIndex-r[0].length);n=i.lastIndex,s.length>0&&e.push(s),e.push(["get",r[1]])}if(1===e.length)return t;if(n<t.length)e.push(t.slice(n));else if(2===e.length)return["to-string",e[1]];return e}function Uv(t){const e=t.key,i=t.value;return i?[new om(e,i,"constants have been deprecated as of v8")]:[]}function Wv(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Xv(t){if(Array.isArray(t))return t.map(Xv);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=Xv(t[i]);return e}return Wv(t)}function Vv(t){const e=t.key,i=t.value,n=t.valueSpec||{},r=t.objectElementValidators||{},s=t.style,o=t.styleSpec,a=t.validateSpec;let l=[];const h=gv(i);if("object"!==h)return[new om(e,i,`object expected, ${h} found`)];for(const t in i){const h=t.split(".")[0],u=Km(n,h)||n["*"];let c;if(Km(r,h))c=r[h];else if(Km(n,h)){if(void 0===i[t])continue;c=a}else if(r["*"])c=r["*"];else{if(!n["*"]){l.push(new om(e,i[t],`unknown property "${t}"`));continue}c=a}l=l.concat(c({key:(e?`${e}.`:e)+t,value:i[t],valueSpec:u,style:s,styleSpec:o,object:i,objectKey:t,validateSpec:a},i))}for(const t in n)r[t]||n[t].required&&void 0===n[t].default&&void 0===i[t]&&l.push(new om(e,i,`missing required property "${t}"`));return l}function Kv(t){const e=t.value,i=t.valueSpec,n=t.validateSpec,r=t.style,s=t.styleSpec,o=t.key,a=t.arrayElementValidator||n;if("array"!==gv(e))return[new om(o,e,`array expected, ${gv(e)} found`)];if(i.length&&e.length!==i.length)return[new om(o,e,`array length ${i.length} expected, length ${e.length} found`)];let l={type:i.value,values:i.values};s.$version<7&&(l.function=i.function),"object"===gv(i.value)&&(l=i.value);let h=[];for(let i=0;i<e.length;i++)h=h.concat(a({array:e,arrayIndex:i,value:e[i],valueSpec:l,validateSpec:t.validateSpec,style:r,styleSpec:s,key:`${o}[${i}]`}));return h}function Zv(t){const e=t.key,i=t.value,n=t.valueSpec;let r=gv(i);return"number"===r&&i!=i&&(r="NaN"),"number"!==r?[new om(e,i,`number expected, ${r} found`)]:"minimum"in n&&i<n.minimum?[new om(e,i,`${i} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&i>n.maximum?[new om(e,i,`${i} is greater than the maximum value ${n.maximum}`)]:[]}function Yv(t){const e=t.valueSpec,i=Wv(t.value.type);let n,r,s,o={};const a="categorical"!==i&&void 0===t.value.property,l=!a,h="array"===gv(t.value.stops)&&"array"===gv(t.value.stops[0])&&"object"===gv(t.value.stops[0][0]),u=Vv({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===i)return[new om(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const n=t.value;return e=e.concat(Kv({key:t.key,value:n,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:c})),"array"===gv(n)&&0===n.length&&e.push(new om(t.key,n,"array must have at least one stop")),e},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===i&&a&&u.push(new om(t.key,t.value,'missing required property "property"')),"identity"===i||t.value.stops||u.push(new om(t.key,t.value,'missing required property "stops"')),"exponential"===i&&t.valueSpec.expression&&!pv(t.valueSpec)&&u.push(new om(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!dv(t.valueSpec)?u.push(new om(t.key,t.value,"property functions not supported")):a&&!fv(t.valueSpec)&&u.push(new om(t.key,t.value,"zoom functions not supported"))),"categorical"!==i&&!h||void 0!==t.value.property||u.push(new om(t.key,t.value,'"property" property is required')),u;function c(t){let i=[];const n=t.value,a=t.key;if("array"!==gv(n))return[new om(a,n,`array expected, ${gv(n)} found`)];if(2!==n.length)return[new om(a,n,`array length 2 expected, length ${n.length} found`)];if(h){if("object"!==gv(n[0]))return[new om(a,n,`object expected, ${gv(n[0])} found`)];if(void 0===n[0].zoom)return[new om(a,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new om(a,n,"object stop key must have value")];if(s&&s>Wv(n[0].zoom))return[new om(a,n[0].zoom,"stop zoom values must appear in ascending order")];Wv(n[0].zoom)!==s&&(s=Wv(n[0].zoom),r=void 0,o={}),i=i.concat(Vv({key:`${a}[0]`,value:n[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Zv,value:d}}))}else i=i.concat(d({key:`${a}[0]`,value:n[0],validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},n));return _v(Xv(n[1]))?i.concat([new om(`${a}[1]`,n[1],"expressions are not allowed in function stops.")]):i.concat(t.validateSpec({key:`${a}[1]`,value:n[1],valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function d(t,s){const a=gv(t.value),l=Wv(t.value),h=null!==t.value?t.value:s;if(n){if(a!==n)return[new om(t.key,h,`${a} stop domain type must match previous stop domain type ${n}`)]}else n=a;if("number"!==a&&"string"!==a&&"boolean"!==a)return[new om(t.key,h,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==i){let n=`number expected, ${a} found`;return dv(e)&&void 0===i&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new om(t.key,h,n)]}return"categorical"!==i||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===a&&void 0!==r&&l<r?[new om(t.key,h,"stop domain values must appear in ascending order")]:(r=l,"categorical"===i&&l in o?[new om(t.key,h,"stop domain values must be unique")]:(o[l]=!0,[])):[new om(t.key,h,`integer expected, found ${l}`)]}}function Hv(t){const e=("property"===t.expressionContext?bv:vv)(Xv(t.value),t.valueSpec);if("error"===e.result)return e.value.map(e=>new om(`${t.key}${e.key}`,t.value,e.message));const i=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!i.outputDefined())return[new om(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!lv(i))return[new om(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!lv(i))return[new om(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!hv(i,["zoom","feature-state"]))return[new om(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!av(i))return[new om(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Jv(t){const e=t.key,i=t.value,n=gv(i);return"string"!==n?[new om(e,i,`color expected, ${n} found`)]:iy.parse(String(i))?[]:[new om(e,i,`color expected, "${i}" found`)]}function Qv(t){const e=t.key,i=t.value,n=t.valueSpec,r=[];return Array.isArray(n.values)?-1===n.values.indexOf(Wv(i))&&r.push(new om(e,i,`expected one of [${n.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(n.values).indexOf(Wv(i))&&r.push(new om(e,i,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(i)} found`)),r}function tx(t){return Cv(Xv(t.value))?Hv(am({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):ex(t)}function ex(t){const e=t.value,i=t.key;if("array"!==gv(e))return[new om(i,e,`array expected, ${gv(e)} found`)];const n=t.styleSpec;let r,s=[];if(e.length<1)return[new om(i,e,"filter array must have at least 1 element")];switch(s=s.concat(Qv({key:`${i}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),Wv(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===Wv(e[1])&&s.push(new om(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&s.push(new om(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(r=gv(e[1]),"string"!==r&&s.push(new om(`${i}[1]`,e[1],`string expected, ${r} found`)));for(let o=2;o<e.length;o++)r=gv(e[o]),"$type"===Wv(e[1])?s=s.concat(Qv({key:`${i}[${o}]`,value:e[o],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==r&&"number"!==r&&"boolean"!==r&&s.push(new om(`${i}[${o}]`,e[o],`string, number, or boolean expected, ${r} found`));break;case"any":case"all":case"none":for(let n=1;n<e.length;n++)s=s.concat(ex({key:`${i}[${n}]`,value:e[n],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":r=gv(e[1]),2!==e.length?s.push(new om(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==r&&s.push(new om(`${i}[1]`,e[1],`string expected, ${r} found`))}return s}function ix(t,e){const i=t.key,n=t.validateSpec,r=t.style,s=t.styleSpec,o=t.value,a=t.objectKey,l=s[`${e}_${t.layerType}`];if(!l)return[];const h=a.match(/^(.*)-transition$/);if("paint"===e&&h&&l[h[1]]&&l[h[1]].transition)return n({key:i,value:o,valueSpec:s.transition,style:r,styleSpec:s});const u=t.valueSpec||l[a];if(!u)return[new om(i,o,`unknown property "${a}"`)];let c;if("string"===gv(o)&&dv(u)&&!u.tokens&&(c=/^{([^}]+)}$/.exec(o)))return[new om(i,o,`"${a}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(c[1])} }\`.`)];const d=[];return"symbol"===t.layerType&&"text-font"===a&&mv(Xv(o))&&"identity"===Wv(o.type)&&d.push(new om(i,o,'"text-font" does not support identity functions')),d.concat(n({key:t.key,value:o,valueSpec:u,style:r,styleSpec:s,expressionContext:"property",propertyType:e,propertyKey:a}))}function nx(t){return ix(t,"paint")}function rx(t){return ix(t,"layout")}function sx(t){var e,i;let n=[];const r=t.value,s=t.key,o=t.style,a=t.styleSpec;if("object"!==gv(r))return[new om(s,r,`object expected, ${gv(r)} found`)];r.type||r.ref||n.push(new om(s,r,'either "type" or "ref" is required'));let l=Wv(r.type);const h=Wv(r.ref);if(r.id){const e=Wv(r.id);for(let i=0;i<t.arrayIndex;i++){const t=o.layers[i];Wv(t.id)===e&&n.push(new om(s,r.id,`duplicate layer id "${r.id}", previously used at line ${t.id.__line__}`))}}if("ref"in r){let t;["type","source","source-layer","filter","layout"].forEach(t=>{t in r&&n.push(new om(s,r[t],`"${t}" is prohibited for ref layers`))}),o.layers.forEach(e=>{Wv(e.id)===h&&(t=e)}),t?t.ref?n.push(new om(s,r.ref,"ref cannot reference another ref layer")):l=Wv(t.type):n.push(new om(s,r.ref,`ref layer "${h}" not found`))}else if("background"!==l)if(r.source){const t=o.sources&&o.sources[r.source],e=t&&Wv(t.type);t?"vector"===e&&"raster"===l?n.push(new om(s,r.source,`layer "${r.id}" requires a raster source`)):"raster-dem"!==e&&"hillshade"===l||"raster-dem"!==e&&"color-relief"===l?n.push(new om(s,r.source,`layer "${r.id}" requires a raster-dem source`)):"raster"===e&&"raster"!==l?n.push(new om(s,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==e||r["source-layer"]?"raster-dem"===e&&"hillshade"!==l&&"color-relief"!==l?n.push(new om(s,r.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"!==l||!r.paint||!r.paint["line-gradient"]||"geojson"===e&&t.lineMetrics||n.push(new om(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):n.push(new om(s,r,`layer "${r.id}" must specify a "source-layer"`)):n.push(new om(s,r.source,`source "${r.source}" not found`))}else n.push(new om(s,r,'missing required property "source"'));return"raster"===l&&(null===(e=r.paint)||void 0===e?void 0:e.resampling)&&(null===(i=r.paint)||void 0===i?void 0:i["raster-resampling"])&&n.push(new om(s,r.paint,`layer "${r.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),n=n.concat(Vv({key:s,value:r,valueSpec:a.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${s}.type`,value:r.type,valueSpec:a.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"}),filter:tx,layout:t=>Vv({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>rx(am({layerType:l},t))}}),paint:t=>Vv({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>nx(am({layerType:l},t))}})}})),n}function ox(t){const e=t.value,i=t.key,n=gv(e);return"string"!==n?[new om(i,e,`string expected, ${n} found`)]:[]}const ax={promoteId:function({key:t,value:e}){if("string"===gv(e))return ox({key:t,value:e});{const i=[];for(const n in e)i.push(...ox({key:`${t}.${n}`,value:e[n]}));return i}}};function lx(t){const e=t.value,i=t.key,n=t.styleSpec,r=t.style,s=t.validateSpec;if(!e.type)return[new om(i,e,'"type" is required')];const o=Wv(e.type);let a;switch(o){case"vector":case"raster":return a=Vv({key:i,value:e,valueSpec:n[`source_${o.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:ax,validateSpec:s}),a;case"raster-dem":return a=function(t){var e;const i=null!==(e=t.sourceName)&&void 0!==e?e:"",n=t.value,r=t.styleSpec,s=r.source_raster_dem,o=t.style;let a=[];const l=gv(n);if(void 0===n)return a;if("object"!==l)return a.push(new om("source_raster_dem",n,`object expected, ${l} found`)),a;const h="custom"===Wv(n.encoding),u=["redFactor","greenFactor","blueFactor","baseShift"],c=t.value.encoding?`"${t.value.encoding}"`:"Default";for(const e in n)!h&&u.includes(e)?a.push(new om(e,n[e],`In "${i}": "${e}" is only valid when "encoding" is set to "custom". ${c} encoding found`)):s[e]?a=a.concat(t.validateSpec({key:e,value:n[e],valueSpec:s[e],validateSpec:t.validateSpec,style:o,styleSpec:r})):a.push(new om(e,n[e],`unknown property "${e}"`));return a}({sourceName:i,value:e,style:t.style,styleSpec:n,validateSpec:s}),a;case"geojson":if(a=Vv({key:i,value:e,valueSpec:n.source_geojson,style:r,styleSpec:n,validateSpec:s,objectElementValidators:ax}),e.cluster)for(const t in e.clusterProperties){const[n,r]=e.clusterProperties[t],s="string"==typeof n?[n,["accumulated"],["get",t]]:n;a.push(...Hv({key:`${i}.${t}.map`,value:r,expressionContext:"cluster-map"})),a.push(...Hv({key:`${i}.${t}.reduce`,value:s,expressionContext:"cluster-reduce"}))}return a;case"video":return Vv({key:i,value:e,valueSpec:n.source_video,style:r,validateSpec:s,styleSpec:n});case"image":return Vv({key:i,value:e,valueSpec:n.source_image,style:r,validateSpec:s,styleSpec:n});case"canvas":return[new om(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Qv({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function hx(t){const e=t.value,i=t.styleSpec,n=i.light,r=t.style;let s=[];const o=gv(e);if(void 0===e)return s;if("object"!==o)return s=s.concat([new om("light",e,`object expected, ${o} found`)]),s;for(const o in e){const a=o.match(/^(.*)-transition$/);s=a&&n[a[1]]&&n[a[1]].transition?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:i.transition,validateSpec:t.validateSpec,style:r,styleSpec:i})):n[o]?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:n[o],validateSpec:t.validateSpec,style:r,styleSpec:i})):s.concat([new om(o,e[o],`unknown property "${o}"`)])}return s}function ux(t){const e=t.value,i=t.styleSpec,n=i.sky,r=t.style,s=gv(e);if(void 0===e)return[];if("object"!==s)return[new om("sky",e,`object expected, ${s} found`)];let o=[];for(const s in e)o=n[s]?o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:r,styleSpec:i})):o.concat([new om(s,e[s],`unknown property "${s}"`)]);return o}function cx(t){const e=t.value,i=t.styleSpec,n=i.terrain,r=t.style;let s=[];const o=gv(e);if(void 0===e)return s;if("object"!==o)return s=s.concat([new om("terrain",e,`object expected, ${o} found`)]),s;for(const o in e)s=n[o]?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:n[o],validateSpec:t.validateSpec,style:r,styleSpec:i})):s.concat([new om(o,e[o],`unknown property "${o}"`)]);return s}function dx(t){let e=[];const i=t.value,n=t.key;if(Array.isArray(i)){const r=[],s=[];for(const o in i){i[o].id&&r.includes(i[o].id)&&e.push(new om(n,i,`all the sprites' ids must be unique, but ${i[o].id} is duplicated`)),r.push(i[o].id),i[o].url&&s.includes(i[o].url)&&e.push(new om(n,i,`all the sprites' URLs must be unique, but ${i[o].url} is duplicated`)),s.push(i[o].url);const a={id:{type:"string",required:!0},url:{type:"string",required:!0}};e=e.concat(Vv({key:`${n}[${o}]`,value:i[o],valueSpec:a,validateSpec:t.validateSpec}))}return e}return ox({key:n,value:i})}function fx(t){return Boolean(t)&&t.constructor===Object}function px(t){return fx(t.value)?[]:[new om(t.key,t.value,`object expected, ${gv(t.value)} found`)]}const gx={"*":()=>[],array:Kv,boolean:function(t){const e=t.value,i=t.key,n=gv(e);return"boolean"!==n?[new om(i,e,`boolean expected, ${n} found`)]:[]},number:Zv,color:Jv,constants:Uv,enum:Qv,filter:tx,function:Yv,layer:sx,object:Vv,source:lx,light:hx,sky:ux,terrain:cx,projection:function(t){const e=t.value,i=t.styleSpec,n=i.projection,r=t.style,s=gv(e);if(void 0===e)return[];if("object"!==s)return[new om("projection",e,`object expected, ${s} found`)];let o=[];for(const s in e)o=n[s]?o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:r,styleSpec:i})):o.concat([new om(s,e[s],`unknown property "${s}"`)]);return o},projectionDefinition:function(t){const e=t.key;let i=t.value;i=i instanceof String?i.valueOf():i;const n=gv(i);return"array"!==n||function(t){return Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]}(i)||function(t){return!!["interpolate","step","literal"].includes(t[0])}(i)?["array","string"].includes(n)?[]:[new om(e,i,`projection expected, invalid type "${n}" found`)]:[new om(e,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:ox,formatted:function(t){return 0===ox(t).length?[]:Hv(t)},resolvedImage:function(t){return 0===ox(t).length?[]:Hv(t)},padding:function(t){const e=t.key,i=t.value;if("array"===gv(i)){if(i.length<1||i.length>4)return[new om(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];const n={type:"number"};let r=[];for(let s=0;s<i.length;s++)r=r.concat(t.validateSpec({key:`${e}[${s}]`,value:i[s],validateSpec:t.validateSpec,valueSpec:n}));return r}return Zv({key:e,value:i,valueSpec:{}})},numberArray:function(t){const e=t.key,i=t.value;if("array"===gv(i)){const n={type:"number"};if(i.length<1)return[new om(e,i,"array length at least 1 expected, length 0 found")];let r=[];for(let s=0;s<i.length;s++)r=r.concat(t.validateSpec({key:`${e}[${s}]`,value:i[s],validateSpec:t.validateSpec,valueSpec:n}));return r}return Zv({key:e,value:i,valueSpec:{}})},colorArray:function(t){const e=t.key,i=t.value;if("array"===gv(i)){if(i.length<1)return[new om(e,i,"array length at least 1 expected, length 0 found")];let t=[];for(let n=0;n<i.length;n++)t=t.concat(Jv({key:`${e}[${n}]`,value:i[n]}));return t}return Jv({key:e,value:i})},variableAnchorOffsetCollection:function(t){const e=t.key,i=t.value,n=gv(i),r=t.styleSpec;if("array"!==n||i.length<1||i.length%2!=0)return[new om(e,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let s=[];for(let n=0;n<i.length;n+=2)s=s.concat(Qv({key:`${e}[${n}]`,value:i[n],valueSpec:r.layout_symbol["text-anchor"]})),s=s.concat(Kv({key:`${e}[${n+1}]`,value:i[n+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:r}));return s},sprite:dx,state:px,fontFaces:function(t){const e=t.key,i=t.value,n=t.validateSpec,r=t.styleSpec,s=t.style;if(!fx(i))return[new om(e,i,`object expected, ${gv(i)} found`)];const o=[];for(const t in i){const a=i[t],l=gv(a);if("string"===l)o.push(...ox({key:`${e}.${t}`,value:a}));else if("array"===l){const i={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(const[l,h]of a.entries())o.push(...Vv({key:`${e}.${t}[${l}]`,value:h,valueSpec:i,styleSpec:r,style:s,validateSpec:n}))}else o.push(new om(`${e}.${t}`,a,`string or array expected, ${l} found`))}return o}};function mx(t){const e=t.value,i=t.valueSpec,n=t.styleSpec;return t.validateSpec=mx,i.expression&&mv(Wv(e))?Yv(t):i.expression&&_v(Xv(e))?Hv(t):i.type&&gx[i.type]?gx[i.type](t):Vv(am({},t,{valueSpec:i.type?n[i.type]:i}))}function yx(t){const e=t.value,i=t.key,n=ox(t);return n.length||(-1===e.indexOf("{fontstack}")&&n.push(new om(i,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&n.push(new om(i,e,'"glyphs" url must include a "{range}" token'))),n}function _x(t,e=nm){let i=[];return i=i.concat(mx({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:mx,objectElementValidators:{glyphs:yx,"*":()=>[]}})),t.constants&&(i=i.concat(Uv({key:"constants",value:t.constants}))),xx(i)}function vx(t){return function(e){return t(Object.assign({},e,{validateSpec:mx}))}}function xx(t){return[].concat(t).sort((t,e)=>t.line-e.line)}function wx(t){return function(...e){return xx(t.apply(this,e))}}_x.source=wx(vx(lx)),_x.sprite=wx(vx(dx)),_x.glyphs=wx(vx(yx)),_x.light=wx(vx(hx)),_x.sky=wx(vx(ux)),_x.terrain=wx(vx(cx)),_x.state=wx(vx(px)),_x.layer=wx(vx(sx)),_x.filter=wx(vx(tx)),_x.paintProperty=wx(vx(nx)),_x.layoutProperty=wx(vx(rx));const bx=nm;function Sx(t,e){const i=e[0].evaluate(t),n=e[1].evaluate(t),r=e[2].evaluate(t),s=e[3]?e[3].evaluate(t):1;return iy.parse(`hsla(${i}, ${n}%, ${r}%, ${s})`)}function Mx(t){if(Array.isArray(t)){if(0===t.length)return t;const e=t[0];if("literal"===e)return t;if("image"===e&&3===t.length&&"object"==typeof t[2]&&null!==t[2]&&!Array.isArray(t[2]))return["image-config",Mx(t[1]),["literal",t[2]]];const i=t.length;for(let n=1;n<i;++n){const r=t[n],s=Mx(r);if(s!==r){const r=[e];for(let e=1;e<n;++e)r.push(t[e]);r.push(s);for(let e=n+1;e<i;++e)r.push(Mx(t[e]));return r}}}return t}const Ex={},Cx={zoom:0,distanceFromCenter:0};ev.register(tv,{...ev.definitions,pitch:[{kind:"number"},[],t=>Cx.pitch||0],"distance-from-center":[{kind:"number"},[],t=>Cx.distanceFromCenter||0],"to-hsla":[{kind:"array",itemType:{kind:"number"},N:4},[{kind:"string"}],(t,[e])=>function(t){const e=t[0]/255,i=t[1]/255,n=t[2]/255,r=t[3],s=Math.max(e,i,n),o=Math.min(e,i,n),a=(s+o)/2;let l,h;if(s===o)l=0,h=0;else{const t=s-o;switch(h=a>.5?t/(2-s-o):t/(s+o),s){case e:l=(i-n)/t+(i<n?6:0);break;case i:l=(n-e)/t+2;break;case n:l=(e-i)/t+4;break;default:l=0}l/=6}return[360*l,100*h,100*a,r]}(no(e.evaluate(t)))],hsl:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"}],Sx],hsla:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"},{kind:"number"}],Sx],"image-config":[{kind:"value"},[{kind:"string"},{kind:"value"}],(t,[e,i])=>e.evaluate(t)],"measure-light":[{kind:"number"},[{kind:"value"}],()=>1],config:[{kind:"value"},[{kind:"string"}],(t,[e])=>{const i=Ex[e.evaluate(t)];return void 0===i?{}:i}]});var Px={thin:100,hairline:100,"ultra-light":200,"extra-light":200,light:300,book:300,regular:400,normal:400,plain:400,roman:400,standard:400,medium:500,"semi-bold":600,"demi-bold":600,bold:700,"extra-bold":800,"ultra-bold":800,heavy:900,black:900,"heavy-black":900,fat:900,poster:900,"ultra-black":950,"extra-black":950},Ix=" ",Tx=/(italic|oblique)$/i,kx={};function Rx(t,e,i){var n=kx[t];if(!n){Array.isArray(t)||(t=[t]);for(var r,s,o=400,a="normal",l=[],h=0,u=t.length;h<u;++h){var c=t[h].split(" "),d=c[c.length-1].toLowerCase();for(var f in"normal"==d||"italic"==d||"oblique"==d?(a=s?a:d,s=!0,c.pop(),d=c[c.length-1].toLowerCase()):Tx.test(d)&&(d=d.replace(Tx,""),a=s?a:c[c.length-1].replace(d,""),s=!0),Px){var p=c.length>1?c[c.length-2].toLowerCase():"";if(d==f||d==f.replace("-","")||p+"-"+d==f){o=r?o:Px[f],c.pop(),p&&f.startsWith(p)&&c.pop();break}}r||"number"!=typeof d||(o=d,r=!0);var g=c.join(Ix).replace("Klokantech Noto Sans","Noto Sans").replace("DIN Pro","Barlow").replace("Arial Unicode MS","Arial");-1!==g.indexOf(Ix)&&(g='"'+g+'"'),l.push(g)}n=kx[t]=[a,o,l]}return n[0]+Ix+n[1]+Ix+e+"px"+(i?"/"+i:"")+Ix+n[2]}const Ax=Object.freeze({}),Ox={},Gx={};let Fx=0;function Lx(t){return t.id||(t.id=Fx++),t.id}function jx(t){return t*Math.PI/180}const Nx=function(){const t=[];for(let e=78271.51696402048;t.length<=24;e/=2)t.push(e);return t}();function Dx(t,e){if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(t,e);const i=document.createElement("canvas");return i.width=t,i.height=e,i}function zx(t,e,i,n){const r=[2*i*e.pixelRatio+e.width,2*i*e.pixelRatio+e.height],s=Dx(r[0],r[1]),o=s.getContext("2d");o.drawImage(t,e.x,e.y,e.width,e.height,i*e.pixelRatio,i*e.pixelRatio,e.width,e.height);const a=o.getImageData(0,0,r[0],r[1]);o.globalCompositeOperation="destination-over",o.fillStyle=`rgba(${255*n.r},${255*n.g},${255*n.b},${n.a})`;const l=a.data;for(let t=0,n=a.width;t<n;++t)for(let r=0,s=a.height;r<s;++r)l[4*(r*n+t)+3]>0&&o.arc(t,r,i*e.pixelRatio,0,2*Math.PI);return o.fill(),s}function qx(t,e,i){const n=Math.max(0,Math.min(1,(i-t)/(e-t)));return n*n*(3-2*n)}function Bx(t,e,i){const n=Dx(e.width,e.height),r=n.getContext("2d");r.drawImage(t,e.x,e.y,e.width,e.height,0,0,e.width,e.height);const s=r.getImageData(0,0,e.width,e.height),o=s.data;for(let t=0,e=s.width;t<e;++t)for(let n=0,r=s.height;n<r;++n){const r=4*(n*e+t),s=.75,a=.1,l=qx(s-a,s+a,o[r+3]/255);l>0?(o[r+0]=Math.round(255*i.r*l),o[r+1]=Math.round(255*i.g*l),o[r+2]=Math.round(255*i.b*l),o[r+3]=Math.round(255*l)):o[r+3]=0}return r.putImageData(s,0,0),n}const $x=Array(256).join(" ");function Ux(t,e){if(e>=.05){let i="";const n=t.split("\n"),r=$x.slice(0,Math.round(e/.1));for(let t=0,e=n.length;t<e;++t)t>0&&(i+="\n"),i+=n[t].split("").join(r);return i}return t}let Wx;function Xx(){return Wx||(Wx=Dx(1,1).getContext("2d")),Wx}function Vx(t,e){return Xx().measureText(t).width+(t.length-1)*e}const Kx={};function Zx(t,e,i,n){if(-1!==t.indexOf("\n")){const r=t.split("\n"),s=[];for(let t=0,o=r.length;t<o;++t)s.push(Zx(r[t],e,i,n));return s.join("\n")}const r=i+","+e+","+t+","+n;let s=Kx[r];if(!s){const o=t.split(" ");if(o.length>1){const t=Xx();t.font=e;const r=t.measureText("M").width*i;let a="";const l=[];for(let t=0,e=o.length;t<e;++t){const e=o[t],i=a+(a?" ":"")+e;Vx(i,n)<=r?a=i:(a&&l.push(a),a=e)}a&&l.push(a);for(let t=0,e=l.length;t<e&&e>1;++t){const i=l[t];if(Vx(i,n)<.35*r){const r=t>0?Vx(l[t-1],n):1/0,s=t<e-1?Vx(l[t+1],n):1/0;l.splice(t,1),e-=1,r<s?(l[t-1]+=" "+i,t-=1):l[t]=i+" "+l[t]}}for(let t=0,e=l.length-1;t<e;++t){const i=l[t],s=l[t+1];if(Vx(i,n)>.7*r&&Vx(s,n)<.6*r){const o=i.split(" "),a=o.pop();Vx(a,n)<.2*r&&(l[t]=o.join(" "),l[t+1]=a+" "+s),e-=1}}s=l.join("\n")}else s=t;s=Ux(s,n),Kx[r]=s}return s}Za.on("propertychange",()=>{for(const t in Kx)delete Kx[t]});const Yx={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},Hx={center:[.5,.5],left:[0,.5],right:[1,.5],top:[.5,0],bottom:[.5,1],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},Jx=function(t,e){let i=bv(t,e);if("error"===i.result){const n=Mx(t);n!==t&&(i=bv(n,e))}if("error"===i.result){const n=i.value[0];return console.error("Error parsing expression:",t,n.key,n.message),{evaluate:()=>e.default}}return i.value};let Qx,tw;function ew(t,e,i,n,r,s){const o=t.id;r||(r={},console.warn("No functionCache provided to getValue()")),r[o]||(r[o]={});const a=r[o];if(!a[i]){let n=(t[e]||Ax)[i];const r=bx[`${e}_${t.type}`]&&bx[`${e}_${t.type}`][i];void 0===n&&r&&(n=r.default);let s=_v(n);if(!s&&mv(n)&&(n=Lv(n,r),s=!0),s){const t=Jx(n,r);a[i]=t.evaluate.bind(t)}else{const t=r?r.type:typeof n;"color"!==t&&"colorArray"!==t||(n=iy.parse(n));let e=!1;if("array"===t)for(let t=0;t<n.length;++t){const i=n[t];if(_v(i)||mv(i)){e=!0;break}}if(e){const t=Object.assign({},r,{type:r.value}),e=[];for(let i=0;i<n.length;++i){let r=n[i];if(!_v(r)&&mv(r)&&(r=Lv(r,t)),_v(r)){const i=Jx(r,t);e.push(i.evaluate.bind(i))}else e.push(function(){return r})}a[i]=function(t,i,n){const r=[];for(let s=0;s<e.length;++s)r[s]=e[s](t,i,n);return r}}else a[i]=function(){return n}}}return a[i](Cx,n,s)}function iw(t,e,i,n){return ew(t,"layout",`${i}-allow-overlap`,e,n)?ew(t,"layout",`${i}-ignore-placement`,e,n)?"none":"obstacle":"declutter"}function nw(t,e,i,n){if(n||console.warn("No filterCache provided to evaluateFilter()"),!(t in n))try{n[t]=function(t,e){if(null==t)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Cv(t)||(t=kv(t));const i=vv(t,Pv,e);if("error"===i.result)throw new Error(i.value.map(t=>`${t.key}: ${t.message}`).join(", "));return{filter:(t,e,n)=>i.value.evaluate(t,e,{},n),needGeometry:Tv(t),getGlobalStateRefs:()=>Mv(i.value.expression)}}(e).filter}catch(e){console.warn("Filter will evaluate to false: "+e.message),n[t]=function(){return!1}}return n[t](Cx,i)}function rw(t,e){if(t){if(0===t.a||0===e)return;const i=t.a;return e=void 0===e?1:e,0===i?"transparent":"rgba("+Math.round(255*t.r/i)+","+Math.round(255*t.g/i)+","+Math.round(255*t.b/i)+","+i*e+")"}return t}const sw=/\{[^{}}]*\}/g;function ow(t,e){return t.replace(sw,function(t){return e[t.slice(1,-1)]||""})}function aw(t,e){let i=t.split(":")[0];return i===t&&(i="default"),e[i]}let lw=!1;const hw={};function uw(t,e,i,n=Nx,r=void 0,s=void 0,o=void 0,a=void 0){if("string"==typeof e&&(e=JSON.parse(e)),e.schema)for(const t in e.schema){const i=e.schema[t];"default"in i&&(Ex[t]=i.default)}if(8!=e.version)throw new Error("glStyle version 8 required.");hw[function(t,e){return Lx(t)+"."+z(e)}(e,t)]=Array.from(arguments);const l={};("string"==typeof s||s instanceof Request||s instanceof Response||s instanceof Promise)&&(s={default:s});for(const e in s){const i=s[e];O(()=>i).then(async i=>{let n;if("undefined"!=typeof Image){const r=new Image;if("string"==typeof i)r.crossOrigin="anonymous",r.src=i;else{let t;i instanceof Request?t=await fetch(i):i instanceof Response&&(t=i);const e=await t.blob();n=URL.createObjectURL(e),r.src=n}r.addEventListener("load",function i(){r.removeEventListener("load",i),l[e]={image:r,size:[r.width,r.height]},t.changed(),n&&URL.revokeObjectURL(n)}),r.addEventListener("error",function t(){URL.revokeObjectURL(n),r.removeEventListener("error",t)})}else if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope){const t=self;t.postMessage({action:"loadImage",src:i}),t.addEventListener("message",function(t){"imageLoaded"===t.data.action&&t.data.src===i&&(l[e]={image:t.data.image,size:[t.data.image.width,t.data.image.height]})})}})}const h=function(t){t=t.slice();const e=Object.create(null);for(let i=0;i<t.length;i++)e[t[i].id]=t[i];for(let i=0;i<t.length;i++)"ref"in t[i]&&(t[i]=sm(t[i],e[t[i].ref]));return t}(e.layers),u={},c=[],d={},f={},p=function(t){let e=Ox[t.id];return e||(e={},Ox[Lx(t)]=e),e}(e),g=function(t){let e=Gx[t.id];return e||(e={},Gx[Lx(t)]=e),e}(e);let m;for(let t=0,n=h.length;t<n;++t){const n=h[t],r=n.id;if("string"==typeof i&&n.source==i||Array.isArray(i)&&-1!==i.indexOf(r)){const i=n["source-layer"];if(m){if(n.source!==m)throw new Error(`Layer "${r}" does not use source "${m}`)}else{m=n.source;const t=e.sources[m];if(!t)throw new Error(`Source "${m}" is not defined`);const i=t.type;if("vector"!==i&&"geojson"!==i)throw new Error(`Source "${m}" is not of type "vector" or "geojson", but "${i}"`)}let s=u[i];s||(s=[],u[i]=s),s.push({layer:n,index:t}),c.push(r)}}const y=[],_=function(i,s,h){const c=t.getSource?.()?.format_?.layerName_??"mvt:layer",m=i.getProperties(),_=u[m[c]];if(!_)return;let v=n.indexOf(s);-1==v&&(v=function(t,e){let i=0;const n=e.length;for(;i<n;++i)if(e[i]<t&&i+1<n){const n=e[i]/e[i+1];return i+Math.log(e[i]/t)/Math.log(n)}return n-1}(s,n)),Cx.zoom=v,Cx.distanceFromCenter=0;const x=i.getGeometry(),w=Yx[x.getType()],b=t.get("map");if(b&&b instanceof rh&&1===w){const t=b.getSize();if(t){const e=b.getView().getCenter(),i=Ht(x.getExtent());Cx.distanceFromCenter=(S=e,M=i,Math.sqrt(function(t,e){const i=t[0]-e[0],n=t[1]-e[1];return i*i+n*n}(S,M))/s/t[1])}}var S,M;const E={id:i.getId(),properties:m,type:w},C=t.get("mapbox-featurestate")[i.getId()];let P,I=-1;for(let n=0,u=_.length;n<u;++n){const u=_[n],c=u.layer,x=c.id;if(void 0!==h&&h!==x)continue;const b=c.layout||Ax,S=c.paint||Ax;if("none"===ew(c,"layout","visibility",E,p,C)||"minzoom"in c&&v<c.minzoom||"maxzoom"in c&&v>=c.maxzoom)continue;const M=c.filter;if(!M||nw(x,M,E,g)){let n,h,g,_,v,x;P=c;const M=u.index;if(3==w&&("fill"==c.type||"fill-extrusion"==c.type))if(h=ew(c,"paint",c.type+"-opacity",E,p,C),c.type+"-pattern"in S){const t=ew(c,"paint",c.type+"-pattern",E,p,C);if(t){const e="string"==typeof t?ow(t,m):t.toString(),i=aw(e,l);if(r&&r[e]&&i){++I,x=y[I],x&&x.getFill()&&!x.getStroke()&&!x.getText()||(x=new Sl({fill:new fl}),y[I]=x),g=x.getFill(),x.setZIndex(M);const t=e+"."+h;let n=f[t];if(!n){const s=r[e],o=Dx(s.width,s.height),a=o.getContext("2d");a.globalAlpha=h,a.drawImage(i.image,s.x,s.y,s.width,s.height,0,0,s.width,s.height),n=a.createPattern(o,"repeat"),f[t]=n}g.setColor(n)}}}else if(n=rw(ew(c,"paint",c.type+"-color",E,p,C),h),c.type+"-outline-color"in S&&(v=rw(ew(c,"paint",c.type+"-outline-color",E,p,C),h)),v||(v=n),n||v){if(++I,x=y[I],(!x||n&&!x.getFill()||!n&&x.getFill()||v&&!x.getStroke()||!v&&x.getStroke()||x.getText())&&(x=new Sl({fill:n?new fl:void 0,stroke:v?new _l:void 0}),y[I]=x),n&&(g=x.getFill(),g.setColor(n)),"fill-extrusion"===c.type){const t=ew(c,"paint","fill-extrusion-height",E,p,C);if(t>0){const e=Math.max(.1,.9-Math.min(t,225)/280);if(v&&"transparent"!==v){const t=iy.parse(v);v=`rgba(${Math.round(255*t.r*e)},${Math.round(255*t.g*e)},${Math.round(255*t.b*e)},${t.a})`}}}v&&(_=x.getStroke(),_.setColor(v),_.setWidth(.5)),x.setZIndex(M)}if(1!=w&&"line"==c.type){n="line-pattern"in S?void 0:rw(ew(c,"paint","line-color",E,p,C),ew(c,"paint","line-opacity",E,p,C));const t=ew(c,"paint","line-width",E,p,C);n&&t>0&&(++I,x=y[I],x&&x.getStroke()&&!x.getFill()&&!x.getText()||(x=new Sl({stroke:new _l}),y[I]=x),_=x.getStroke(),_.setLineCap(ew(c,"layout","line-cap",E,p,C)),_.setLineJoin(ew(c,"layout","line-join",E,p,C)),_.setMiterLimit(ew(c,"layout","line-miter-limit",E,p,C)),_.setColor(n),_.setWidth(t),_.setLineDash(S["line-dasharray"]?ew(c,"paint","line-dasharray",E,p,C).map(function(e){return e*t}):null),"function"==typeof _.setOffset&&_.setOffset(ew(c,"paint","line-offset",E,p,C)),x.setZIndex(M))}let T,k,R,A,O,G,F,L,j,N=!1,D=null,z=0;if((1==w||2==w)&&"icon-image"in b){const e=ew(c,"layout","icon-image",E,p,C);if(e){let n;T="string"==typeof e?ow(e,m):e.toString();const o=a?a(t,T):void 0,h=aw(T,l);if(r&&r[T]&&h||o){const t=ew(c,"layout","icon-rotation-alignment",E,p,C);if(2==w){const e=i.getGeometry();if(e.getFlatMidpoint||e.getFlatMidpoints){const i=e.getExtent();if(Math.sqrt(Math.max(Math.pow((i[2]-i[0])/s,2),Math.pow((i[3]-i[1])/s,2)))>150){const i="MultiLineString"===e.getType()?e.getFlatMidpoints():e.getFlatMidpoint();if(tw||(Qx=[NaN,NaN],tw=new Ig("Point",Qx,[],2,{},void 0)),n=tw,Qx[0]=i[0],Qx[1]=i[1],"line"===ew(c,"layout","symbol-placement",E,p,C)&&"map"===t){const t=e.getStride(),n=e.getFlatCoordinates();for(let e=0,r=n.length-t;e<r;e+=t){const r=n[e],s=n[e+1],o=n[e+t],a=n[e+t+1],l=Math.min(r,o),h=Math.max(r,o),u=i[0],c=(a-s)*(u-r)-(o-r)*(i[1]-s);if(Math.abs(c)<.001&&u<=h&&u>=l){z=Math.atan2(s-a,o-r);break}}}}}}if(2!==w||n){const e=ew(c,"layout","icon-size",E,p,C),i=void 0!==S["icon-color"]?ew(c,"paint","icon-color",E,p,C):null;if(!i||0!==i.a){const n=ew(c,"paint","icon-halo-color",E,p,C),s=ew(c,"paint","icon-halo-width",E,p,C);let a=`${T}.${e}.${s}.${n}`;if(null!==i&&(a+=`.${i}`),k=d[a],!k){const l=iw(c,E,"icon",p);let u;"icon-offset"in b&&(u=ew(c,"layout","icon-offset",E,p,C).slice(0),u[0]*=e,u[1]*=-e);let f=i?[255*i.r,255*i.g,255*i.b,i.a]:void 0;if(o){const i={color:f,rotateWithView:"map"===t,displacement:u,declutterMode:l,scale:e};"string"==typeof o?i.src=o:(i.img=o,i.imgSize=[o.width,o.height]),k=new ml(i)}else{const o=r[T];let a,c,d;if(s)o.sdf?(a=zx(Bx(h.image,o,i||[0,0,0,1]),{x:0,y:0,width:o.width,height:o.height,pixelRatio:o.pixelRatio},s,n),f=void 0):a=zx(h.image,o,s,n);else{if(o.sdf&&!h.unSDFed){const t=Bx(h.image,{x:0,y:0,width:h.size[0],height:h.size[1]},{r:1,g:1,b:1,a:1});h.image=t,h.unSDFed=!0}a=h.image,c=[o.width,o.height],d=[o.x,o.y]}k=new ml({color:f,img:a,imgSize:h.size,size:c,offset:d,rotateWithView:"map"===t,scale:e/o.pixelRatio,displacement:u,declutterMode:l})}d[a]=k}}k&&(++I,x=y[I],x&&x.getImage()&&!x.getFill()&&!x.getStroke()||(x=new Sl,y[I]=x),x.setGeometry(n),k.setRotation(z+jx(ew(c,"layout","icon-rotate",E,p,C))),k.setOpacity(ew(c,"paint","icon-opacity",E,p,C)),k.setAnchor(Hx[ew(c,"layout","icon-anchor",E,p,C)]),x.setImage(k),D=x.getText(),x.setText(void 0),x.setZIndex(M),N=!0,R=!1)}else R=!0}}}if(1==w&&"circle"===c.type){++I,x=y[I],x&&x.getImage()&&!x.getFill()&&!x.getStroke()||(x=new Sl,y[I]=x);const t="circle-radius"in S?ew(c,"paint","circle-radius",E,p,C):5,e=rw(ew(c,"paint","circle-stroke-color",E,p,C),ew(c,"paint","circle-stroke-opacity",E,p,C)),i=ew(c,"paint","circle-translate",E,p,C),n=rw(ew(c,"paint","circle-color",E,p,C),ew(c,"paint","circle-opacity",E,p,C)),r=ew(c,"paint","circle-stroke-width",E,p,C),s=t+"."+e+"."+n+"."+r+"."+i[0]+"."+i[1];k=d[s],k||(k=new cl({radius:t,displacement:[i[0],-i[1]],stroke:e&&r>0?new _l({width:r,color:e}):void 0,fill:n?new fl({color:n}):void 0,declutterMode:"none"}),d[s]=k),x.setImage(k),D=x.getText(),x.setText(void 0),x.setGeometry(void 0),x.setZIndex(M),N=!0}if("text-field"in b){F=Math.round(ew(c,"layout","text-size",E,p,C));const t=ew(c,"layout","text-font",E,p,C);G=ew(c,"layout","text-line-height",E,p,C),O=Rx(o?o(t,e.metadata?e.metadata["ol:webfonts"]:void 0):t,F,G),O.includes("sans-serif")||(O+=",sans-serif"),L=ew(c,"layout","text-letter-spacing",E,p,C),j=ew(c,"layout","text-max-width",E,p,C);const i=ew(c,"layout","text-field",E,p,C);A="object"==typeof i&&i.sections?1===i.sections.length?i.toString():i.sections.reduce((e,i,n)=>{const r=i.fontStack?i.fontStack.split(","):t,s=Rx(o?o(r):r,F*(i.scale||1),G);let a=i.text;if("\n"===a)return e.push("\n",""),e;if(2==w)return e.push(Ux(a,L),s),e;a=Zx(a,s,j,L).split("\n");for(let t=0,i=a.length;t<i;++t)t>0&&e.push("\n",""),e.push(a[t],s);return e},[]):ow(i,m).trim(),h=ew(c,"paint","text-opacity",E,p,C)}if(A&&h&&!R){N||(++I,x=y[I],x&&x.getText()&&!x.getFill()&&!x.getStroke()||(x=new Sl,y[I]=x),x.setImage(void 0),x.setGeometry(void 0));const t=iw(c,E,"text",p);x.getText()||x.setText(D),D=x.getText(),(!D||"getDeclutterMode"in D&&D.getDeclutterMode()!==t)&&(D=new El({padding:[2,2,2,2],declutterMode:t}),x.setText(D));const e=ew(c,"layout","text-transform",E,p,C);"uppercase"==e?A=Array.isArray(A)?A.map((t,e)=>e%2?t:t.toUpperCase()):A.toUpperCase():"lowercase"==e&&(A=Array.isArray(A)?A.map((t,e)=>e%2?t:t.toLowerCase()):A.toLowerCase());const i=Array.isArray(A)?A:2==w?Ux(A,L):Zx(A,O,j,L);if(D.setText(i),D.setFont(O),D.setRotation(jx(ew(c,"layout","text-rotate",E,p,C))),"function"==typeof D.setKeepUpright){const t=ew(c,"layout","text-keep-upright",E,p,C);D.setKeepUpright(t)}const n=ew(c,"layout","text-anchor",E,p,C),r=N||1==w?"point":ew(c,"layout","symbol-placement",E,p,C);let s;if("line-center"===r?(D.setPlacement("line"),s="center"):D.setPlacement(r),"line"===r&&"function"==typeof D.setRepeat){const t=ew(c,"layout","symbol-spacing",E,p,C);D.setRepeat(2*t)}D.setOverflow("point"===r);let o=ew(c,"paint","text-halo-width",E,p,C);const a=ew(c,"layout","text-offset",E,p,C),l=ew(c,"paint","text-translate",E,p,C);let u=0,d=0;if("point"==r){s="center",-1!==n.indexOf("left")?(s="left",d=o):-1!==n.indexOf("right")&&(s="right",d=-o);const t=ew(c,"layout","text-rotation-alignment",E,p,C);D.setRotateWithView("map"==t)}else D.setMaxAngle(jx(ew(c,"layout","text-max-angle",E,p,C))*A.length/i.length),D.setRotateWithView(!1);D.setTextAlign(s);let f="middle";0==n.indexOf("bottom")?(f="bottom",u=-o-.5*(G-1)*F):0==n.indexOf("top")&&(f="top",u=o+.5*(G-1)*F),D.setTextBaseline(f);const g=ew(c,"layout","text-justify",E,p,C);D.setJustify("auto"===g?void 0:g),D.setOffsetX(a[0]*F+d+l[0]),D.setOffsetY(a[1]*F+u+l[1]);const m=D.getFill()||new fl;m.setColor(rw(ew(c,"paint","text-color",E,p,C),h)),D.setFill(m);const _=rw(ew(c,"paint","text-halo-color",E,p,C),h);if(_&&o>0){const t=D.getStroke()||new _l;t.setColor(_),o*=2;const e=.5*F;t.setWidth(o<=e?o:e),D.setStroke(t)}else D.setStroke(void 0);const v=ew(c,"layout","text-padding",E,p,C),b=D.getPadding();v!==b[0]&&(b[0]=v,b[1]=v,b[2]=v,b[3]=v),x.setZIndex(M)}}}return I>-1?(y.length=I+1,lw&&("set"in i?i.set("mapbox-layer",P):i.getProperties()["mapbox-layer"]=P),y):void 0};return t.setStyle(_),t.set("mapbox-layers",c),t.set("mapbox-source",m),t.set("mapbox-featurestate",t.get("mapbox-featurestate")||{}),_}function cw(t){return cw="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},cw(t)}function dw(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function fw(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?dw(Object(i),!0).forEach(function(e){pw(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):dw(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function pw(t,e,i){return(e=function(t){var e=function(t){if("object"!=cw(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=cw(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==cw(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function gw(){var t,e,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",r=i.toStringTag||"@@toStringTag";function s(i,n,r,s){var l=n&&n.prototype instanceof a?n:a,h=Object.create(l.prototype);return mw(h,"_invoke",function(i,n,r){var s,a,l,h=0,u=r||[],c=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return s=e,a=0,l=t,d.n=i,o}};function f(i,n){for(a=i,l=n,e=0;!c&&h&&!r&&e<u.length;e++){var r,s=u[e],f=d.p,p=s[2];i>3?(r=p===n)&&(l=s[(a=s[4])?5:(a=3,3)],s[4]=s[5]=t):s[0]<=f&&((r=i<2&&f<s[1])?(a=0,d.v=n,d.n=s[1]):f<p&&(r=i<3||s[0]>n||n>p)&&(s[4]=i,s[5]=n,d.n=p,a=0))}if(r||i>1)return o;throw c=!0,n}return function(r,u,p){if(h>1)throw TypeError("Generator is already running");for(c&&1===u&&f(u,p),a=u,l=p;(e=a<2?t:l)||!c;){s||(a?a<3?(a>1&&(d.n=-1),f(a,l)):d.n=l:d.v=l);try{if(h=2,s){if(a||(r="next"),e=s[r]){if(!(e=e.call(s,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,a<2&&(a=0)}else 1===a&&(e=s.return)&&e.call(s),a<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),a=1);s=t}else if((e=(c=d.n<0)?l:i.call(n,d))!==o)break}catch(e){s=t,a=1,l=e}finally{h=1}}return{value:e,done:c}}}(i,r,s),!0),h}var o={};function a(){}function l(){}function h(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(mw(e={},n,function(){return this}),e),c=h.prototype=a.prototype=Object.create(u);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,mw(t,r,"GeneratorFunction")),t.prototype=Object.create(c),t}return l.prototype=h,mw(c,"constructor",h),mw(h,"constructor",l),l.displayName="GeneratorFunction",mw(h,r,"GeneratorFunction"),mw(c),mw(c,r,"Generator"),mw(c,n,function(){return this}),mw(c,"toString",function(){return"[object Generator]"}),(gw=function(){return{w:s,m:d}})()}function mw(t,e,i,n){var r=Object.defineProperty;try{r({},"",{})}catch(t){r=0}mw=function(t,e,i,n){function s(e,i){mw(t,e,function(t){return this._invoke(e,i,t)})}e?r?r(t,e,{value:i,enumerable:!n,configurable:!n,writable:!n}):t[e]=i:(s("next",0),s("throw",1),s("return",2))},mw(t,e,i,n)}function yw(t,e,i,n,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,r)}function _w(t){return function(){var e=this,i=arguments;return new Promise(function(n,r){var s=t.apply(e,i);function o(t){yw(s,n,r,o,a,"next",t)}function a(t){yw(s,n,r,o,a,"throw",t)}o(void 0)})}}function vw(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return xw(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)?xw(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xw(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}iy.parse("#000000"),iy.parse("#FFFFFF"),iy.parse("#000000"),function(t=!1){lw=t}(!0);var ww="EPSG:27700",bw=["vector","raster","wms","ogc-vt"];function Sw(t,e,i){var n=i&&i(t,e)||{};return fetch(n.url||t,{headers:n.headers||{}})}var Mw=function(t){return function(e,i){var n=t(i,"Tile")||{},r=n.url||i,s=n.headers||{};fetch(r,{headers:s}).then(function(t){return t.blob()}).then(function(t){e.getImage().src=URL.createObjectURL(t)}).catch(function(){return e.setState(3)})}};function Ew(){return new qd({resolutions:Md,origin:Cd,tileSize:256})}function Cw(t,e,i){var n=Ew();return new wf({url:t,params:e,projection:ww,tileGrid:n,tileLoadFunction:i?Mw(i):void 0})}function Pw(t,e){var i=Ew();return new mf({projection:ww,tileGrid:i,tileUrlFunction:function(e){var i=vw(e,3),n=i[0],r=i[1],s=i[2];return t.replace("{z}",n).replace("{x}",r).replace("{y}",s)},tileLoadFunction:e?Mw(e):void 0})}function Iw(t,e){return Tw.apply(this,arguments)}function Tw(){return(Tw=_w(gw().m(function t(e,i){var n,r;return gw().w(function(t){for(;;)switch(t.n){case 0:if(!e.type||bw.includes(e.type)){t.n=1;break}throw new Error("Unsupported map style type: '".concat(e.type,"'"));case 1:if("wms"!==e.type){t.n=2;break}return n=Cw(e.url,e.params||{},i),t.a(2,{layer:new Xf({source:n}),source:n});case 2:if("raster"!==e.type){t.n=3;break}return r=Pw(e.url,i),t.a(2,{layer:new Xf({source:r}),source:r});case 3:if("ogc-vt"!==e.type){t.n=4;break}return t.a(2,Gw(e.url,i,e));case 4:return t.a(2,Aw(e.url,i,e))}},t)}))).apply(this,arguments)}function kw(t,e){var i=t.indexOf("?"),n=vw(i>=0?[t.slice(0,i),t.slice(i)]:[t,""],2),r=n[0],s=n[1],o="".concat(r,".json").concat(s),a="".concat(r,".png").concat(s);return{jsonUrl:o,pngUrl:a,fetch:function(){return Sw(o,"SpriteJSON",e).then(function(t){return t.json()})}}}function Rw(t){t.layers.forEach(function(t){var e;null!==(e=t.paint)&&void 0!==e&&e["icon-color"]&&(t.paint["icon-color"]=t.paint["icon-color"].replace(",0)",",1)"))})}function Aw(t,e){return Ow.apply(this,arguments)}function Ow(){return Ow=_w(gw().m(function t(e,i){var n,r,s,o,a,l,h,u,c,d,f,p,g,m,y,_=arguments;return gw().w(function(t){for(;;)switch(t.n){case 0:return n=(_.length>2&&void 0!==_[2]?_[2]:{}).renderMode,t.n=1,Sw(e,"Style",i).then(function(t){return t.json()});case 1:return r=t.v,s=Object.keys(r.sources)[0],o=r.sources[s].url,t.n=2,Sw(o,"Source",i).then(function(t){return t.json()});case 2:return a=t.v,l=[a.fullExtent.xmin,a.fullExtent.ymin,a.fullExtent.xmax,a.fullExtent.ymax],h=[a.tileInfo.origin.x,a.tileInfo.origin.y],u=a.tileInfo.lods.map(function(t){return t.resolution}).slice(0,16),c=a.tileInfo.rows,d=a.tiles[0],f=kw(r.sprite,i),t.n=3,f.fetch();case 3:return p=t.v,Rw(r),g=new qd({extent:l,origin:h,resolutions:u,tileSize:c}),m=new Pf({format:new $g,url:d,projection:ww,tileGrid:g}),uw(y=new $p(fw({source:m,declutter:!0},n&&{renderMode:n})),r,s,u,p,f.pngUrl),t.a(2,{layer:y,source:m})}},t)})),Ow.apply(this,arguments)}function Gw(t,e){return Fw.apply(this,arguments)}function Fw(){return Fw=_w(gw().m(function t(e,i){var n,r,s,o,a,l,h,u,c,d,f,p,g,m,y,_,v,x,w,b=arguments;return gw().w(function(t){for(;;)switch(t.n){case 0:return r=(b.length>2&&void 0!==b[2]?b[2]:{}).renderMode,t.n=1,Sw(e,"Style",i).then(function(t){return t.json()});case 1:return s=t.v,o=Object.keys(s.sources)[0],a=s.sources[o].url,l=kw(s.sprite,i),t.n=2,Sw(a,"Source",i).then(function(t){return t.json()});case 2:return h=t.v,u=null===(n=h.links)||void 0===n?void 0:n.find(function(t){return"http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme"===t.rel}),t.n=3,Promise.all([Sw(u.href,"Source",i).then(function(t){return t.json()}),l.fetch()]);case 3:return c=t.v,d=vw(c,2),f=d[0],p=d[1],g=f.tileMatrices.map(function(t){return t.cellSize}),m=f.tileMatrices[0].pointOfOrigin,y=[f.tileMatrices[0].tileHeight,f.tileMatrices[0].tileWidth],(_=new $g).supportedMediaTypes.push("application/octet-stream"),v=new qd({resolutions:g,origin:m,tileSize:y}),x=new Qp({url:a,format:_,tileGrid:v,projection:ww}),uw(w=new $p(fw({source:x,declutter:!0},r&&{renderMode:r})),s,o,g,p,l.pngUrl),t.a(2,{layer:w,source:x})}},t)})),Fw.apply(this,arguments)}function Lw(){var t,e,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",r=i.toStringTag||"@@toStringTag";function s(i,n,r,s){var l=n&&n.prototype instanceof a?n:a,h=Object.create(l.prototype);return jw(h,"_invoke",function(i,n,r){var s,a,l,h=0,u=r||[],c=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return s=e,a=0,l=t,d.n=i,o}};function f(i,n){for(a=i,l=n,e=0;!c&&h&&!r&&e<u.length;e++){var r,s=u[e],f=d.p,p=s[2];i>3?(r=p===n)&&(l=s[(a=s[4])?5:(a=3,3)],s[4]=s[5]=t):s[0]<=f&&((r=i<2&&f<s[1])?(a=0,d.v=n,d.n=s[1]):f<p&&(r=i<3||s[0]>n||n>p)&&(s[4]=i,s[5]=n,d.n=p,a=0))}if(r||i>1)return o;throw c=!0,n}return function(r,u,p){if(h>1)throw TypeError("Generator is already running");for(c&&1===u&&f(u,p),a=u,l=p;(e=a<2?t:l)||!c;){s||(a?a<3?(a>1&&(d.n=-1),f(a,l)):d.n=l:d.v=l);try{if(h=2,s){if(a||(r="next"),e=s[r]){if(!(e=e.call(s,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,a<2&&(a=0)}else 1===a&&(e=s.return)&&e.call(s),a<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),a=1);s=t}else if((e=(c=d.n<0)?l:i.call(n,d))!==o)break}catch(e){s=t,a=1,l=e}finally{h=1}}return{value:e,done:c}}}(i,r,s),!0),h}var o={};function a(){}function l(){}function h(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(jw(e={},n,function(){return this}),e),c=h.prototype=a.prototype=Object.create(u);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,jw(t,r,"GeneratorFunction")),t.prototype=Object.create(c),t}return l.prototype=h,jw(c,"constructor",h),jw(h,"constructor",l),l.displayName="GeneratorFunction",jw(h,r,"GeneratorFunction"),jw(c),jw(c,r,"Generator"),jw(c,n,function(){return this}),jw(c,"toString",function(){return"[object Generator]"}),(Lw=function(){return{w:s,m:d}})()}function jw(t,e,i,n){var r=Object.defineProperty;try{r({},"",{})}catch(t){r=0}jw=function(t,e,i,n){function s(e,i){jw(t,e,function(t){return this._invoke(e,i,t)})}e?r?r(t,e,{value:i,enumerable:!n,configurable:!n,writable:!n}):t[e]=i:(s("next",0),s("throw",1),s("return",2))},jw(t,e,i,n)}function Nw(t,e,i,n,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,r)}function Dw(t){var e=t.mapProvider,i=t.transformRequest,n=t.events,r=t.eventBus,s=t.map,o=t.onBaseSourceChange,a=function(){var t,a=(t=Lw().m(function t(a){var l,h,u;return Lw().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,Iw(a,i);case 1:l=t.v,h=l.layer,u=l.source,s.getLayers().setAt(0,h),o(u),r.emit(n.MAP_STYLE_CHANGE,{mapStyleId:a.id}),e.reapplyHighlights();case 2:return t.a(2)}},t)}),function(){var e=this,i=arguments;return new Promise(function(n,r){var s=t.apply(e,i);function o(t){Nw(s,n,r,o,a,"next",t)}function a(t){Nw(s,n,r,o,a,"throw",t)}o(void 0)})});return function(t){return a.apply(this,arguments)}}(),l=function(t){s.setPixelRatio(t)},h=function(t){var i=t.mapSize;e.mapSize=i};return r.on(n.MAP_SET_STYLE,a),r.on(n.MAP_SET_PIXEL_RATIO,l),r.on(n.MAP_SIZE_CHANGE,h),{remove:function(){r.off(n.MAP_SET_STYLE,a),r.off(n.MAP_SET_PIXEL_RATIO,l),r.off(n.MAP_SIZE_CHANGE,h)}}}function zw(t,e,i){if(null!==t)for(var n,r,s,o,a,l,h,u,c=0,d=0,f=t.type,p="FeatureCollection"===f,g="Feature"===f,m=p?t.features.length:1,y=0;y<m;y++){a=(u=!!(h=p?t.features[y].geometry:g?t.geometry:t)&&"GeometryCollection"===h.type)?h.geometries.length:1;for(var _=0;_<a;_++){var v=0,x=0;if(null!==(o=u?h.geometries[_]:h)){l=o.coordinates;var w=o.type;switch(c=!i||"Polygon"!==w&&"MultiPolygon"!==w?0:1,w){case null:break;case"Point":if(!1===e(l,d,y,v,x))return!1;d++,v++;break;case"LineString":case"MultiPoint":for(n=0;n<l.length;n++){if(!1===e(l[n],d,y,v,x))return!1;d++,"MultiPoint"===w&&v++}"LineString"===w&&v++;break;case"Polygon":case"MultiLineString":for(n=0;n<l.length;n++){for(r=0;r<l[n].length-c;r++){if(!1===e(l[n][r],d,y,v,x))return!1;d++}"MultiLineString"===w&&v++,"Polygon"===w&&x++}"Polygon"===w&&v++;break;case"MultiPolygon":for(n=0;n<l.length;n++){for(x=0,r=0;r<l[n].length;r++){for(s=0;s<l[n][r].length-c;s++){if(!1===e(l[n][r][s],d,y,v,x))return!1;d++}x++}v++}break;case"GeometryCollection":for(n=0;n<o.geometries.length;n++)if(!1===zw(o.geometries[n],e,i))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}var qw=function(t,e={}){if(null!=t.bbox&&!0!==e.recompute)return t.bbox;const i=[1/0,1/0,-1/0,-1/0];return zw(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 Bw(t){return function(t){if(Array.isArray(t))return Ww(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Uw(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 $w(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(t,e)||Uw(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 Uw(t,e){if(t){if("string"==typeof t)return Ww(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)?Ww(t,e):void 0}}function Ww(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}var Xw=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)),n=1===i?"mile":"miles";return"".concat(i," ").concat(n)}var r=Math.round(e);return"".concat(r," miles")},Vw=function(t,e,i){for(var n=[],r=e;r<i;r+=2)n.push([t[r],t[r+1]]);return n},Kw=function(t){var e=t.getType(),i=t.getFlatCoordinates();if("Point"===e)return{type:"Point",coordinates:[i[0],i[1]]};if("LineString"===e)return{type:"LineString",coordinates:Vw(i,0,i.length)};if("Polygon"===e){var n=t.getEnds(),r=0;return{type:"Polygon",coordinates:n.map(function(t){var e=Vw(i,r,t);return r=t,e})}}if("MultiPolygon"===e){var s=t.getEndss(),o=0,a=s.map(function(t){var e=o,n=t.map(function(t){var n=Vw(i,e,t);return e=t,n});return o=t[t.length-1],n});return{type:"MultiPolygon",coordinates:a}}return{type:e,coordinates:Vw(i,0,i.length)}},Zw=function(t,e,i,n){var r=[];return t.getLayers().forEach(function(t){if(t instanceof $p){var s=t.getSource(),o=null==s?void 0:s.sourceTiles_;o&&Object.values(o).forEach(function(t){2===t.getState()&&t.getFeatures().forEach(function(t){var s;if((null===(s=t.get("mapbox-layer"))||void 0===s?void 0:s.id)===e){var o=n?t.get(n):t.getId();String(o)===String(i)&&r.push(Kw(t))}})})}}),r},Yw=new Map;function Hw(t){return Hw="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},Hw(t)}var Jw=function(t,e){if(!t)return null;if("string"==typeof t)return t.trim();if("object"===Hw(t)){if(e&&t[e])return t[e];var i=Object.values(t)[0];return null!=i?i:null}return null},Qw={symbol:"pin",backgroundColor:"#ca3535",foregroundColor:"#ffffff"},tb={dot:"M8 3c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.241 5-5-2.24-5-5-5z",cross:"M6 3H10V6H13V10H10V13H6V10H3V6H6Z",diamond:"M8 2L14 8L8 14L2 8Z",triangle:"M8 2L14 14H2Z",square:"M3 3H13V13H3Z"},eb={id:"pin",viewBox:"0 0 44 44",anchor:[.5,.9],graphic:tb.dot,svg:'<path d="M22 40.999c-3.621 0-8.306-5.864-10.258-8.3C9.02 29.302 6 23.66 6 19.002a16.01 16.01 0 0 1 16-16 16.01 16.01 0 0 1 16 16c0 4.658-3.02 10.3-5.742 13.697-1.952 2.437-6.637 8.3-10.258 8.3z" fill="{{selectedColor}}" stroke="{{activeColor}}" stroke-width="6" paint-order="stroke fill"/>\n <path d="M22 7.001a12.01 12.01 0 0 1 12 12c0 7.623-10.377 17.998-12 17.998S10 26.624 10 19.001a12.01 12.01 0 0 1 12-12z" fill="{{backgroundColor}}" stroke="{{haloColor}}" stroke-width="2" paint-order="stroke fill"/>\n <g transform="translate(22, 19) scale(0.8) translate(-8, -8)"><path d="{{graphic}}" fill="{{foregroundColor}}"/></g>'},ib={id:"circle",viewBox:"0 0 44 44",anchor:[.5,.5],graphic:tb.dot,svg:'<circle cx="22" cy="22" r="16" fill="{{selectedColor}}" stroke="{{activeColor}}" stroke-width="6" paint-order="stroke fill"/>\n <circle cx="22" cy="22" r="12" fill="{{backgroundColor}}" stroke="{{haloColor}}" stroke-width="2" paint-order="stroke fill"/>\n <g transform="translate(22, 22) scale(0.8) translate(-8, -8)"><path d="{{graphic}}" fill="{{foregroundColor}}"/></g>'},nb={id:"square",viewBox:"0 0 44 44",anchor:[.5,.5],graphic:tb.dot,svg:'<path d="M13 6h18c3.863 0 7 3.137 7 7v18c0 3.863-3.137 7-7 7H13c-3.863 0-7-3.137-7-7V13c0-3.863 3.137-7 7-7" fill="{{selectedColor}}" stroke="{{activeColor}}" stroke-width="6" paint-order="stroke fill"/>\n <path d="M13 34a3 3 0 0 1-3-3V13a3 3 0 0 1 3-3h18a3 3 0 0 1 3 3v18a3 3 0 0 1-3 3H13z" fill-rule="nonzero" fill="{{backgroundColor}}" stroke="{{haloColor}}" stroke-width="2" paint-order="stroke fill"/>\n <g transform="translate(22, 22) scale(0.8) translate(-8, -8)"><path d="{{graphic}}" fill="{{foregroundColor}}"/></g>'},rb=new Set(["symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"]),sb=function(t){if(!function(t){return!(!t.symbol&&!t.symbolSvgContent)}(t))return{};var e={};return rb.forEach(function(i){if(null!=t[i]){var n=i.charAt(6).toLowerCase()+i.slice(7);e[n]=t[i]}}),e},ob=function(t,e){var i;return t.symbolViewBox?t.symbolViewBox:null!==(i=null==e?void 0:e.viewBox)&&void 0!==i?i:"0 0 38 38"},ab={light:{haloColor:"#ffffff",selectedColor:"#0b0c0c",activeColor:"#ffdd00",foregroundColor:"#0b0c0c"},dark:{haloColor:"#0b0c0c",selectedColor:"#ffffff",activeColor:"#ffdd00",foregroundColor:"#ffffff"}},lb=function(t,e,i){return new Promise(function(n,r){var s="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(t)),o=new Image(e,i);o.onload=function(){var t=document.createElement("canvas");t.width=e,t.height=i;var r=t.getContext("2d");r.drawImage(o,0,0,e,i),n(r.getImageData(0,0,e,i))},o.onerror=function(){r(new Error("Failed to rasterise SVG: ".concat(t.slice(0,80))))},o.src=s})};function hb(t){return hb="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},hb(t)}function ub(){var t,e,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",r=i.toStringTag||"@@toStringTag";function s(i,n,r,s){var l=n&&n.prototype instanceof a?n:a,h=Object.create(l.prototype);return cb(h,"_invoke",function(i,n,r){var s,a,l,h=0,u=r||[],c=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return s=e,a=0,l=t,d.n=i,o}};function f(i,n){for(a=i,l=n,e=0;!c&&h&&!r&&e<u.length;e++){var r,s=u[e],f=d.p,p=s[2];i>3?(r=p===n)&&(l=s[(a=s[4])?5:(a=3,3)],s[4]=s[5]=t):s[0]<=f&&((r=i<2&&f<s[1])?(a=0,d.v=n,d.n=s[1]):f<p&&(r=i<3||s[0]>n||n>p)&&(s[4]=i,s[5]=n,d.n=p,a=0))}if(r||i>1)return o;throw c=!0,n}return function(r,u,p){if(h>1)throw TypeError("Generator is already running");for(c&&1===u&&f(u,p),a=u,l=p;(e=a<2?t:l)||!c;){s||(a?a<3?(a>1&&(d.n=-1),f(a,l)):d.n=l:d.v=l);try{if(h=2,s){if(a||(r="next"),e=s[r]){if(!(e=e.call(s,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,a<2&&(a=0)}else 1===a&&(e=s.return)&&e.call(s),a<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),a=1);s=t}else if((e=(c=d.n<0)?l:i.call(n,d))!==o)break}catch(e){s=t,a=1,l=e}finally{h=1}}return{value:e,done:c}}}(i,r,s),!0),h}var o={};function a(){}function l(){}function h(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(cb(e={},n,function(){return this}),e),c=h.prototype=a.prototype=Object.create(u);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,cb(t,r,"GeneratorFunction")),t.prototype=Object.create(c),t}return l.prototype=h,cb(c,"constructor",h),cb(h,"constructor",l),l.displayName="GeneratorFunction",cb(h,r,"GeneratorFunction"),cb(c),cb(c,r,"Generator"),cb(c,n,function(){return this}),cb(c,"toString",function(){return"[object Generator]"}),(ub=function(){return{w:s,m:d}})()}function cb(t,e,i,n){var r=Object.defineProperty;try{r({},"",{})}catch(t){r=0}cb=function(t,e,i,n){function s(e,i){cb(t,e,function(t){return this._invoke(e,i,t)})}e?r?r(t,e,{value:i,enumerable:!n,configurable:!n,writable:!n}):t[e]=i:(s("next",0),s("throw",1),s("return",2))},cb(t,e,i,n)}function db(t,e,i,n,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,r)}function fb(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function pb(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?fb(Object(i),!0).forEach(function(e){gb(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):fb(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function gb(t,e,i){return(e=function(t){var e=function(t){if("object"!=hb(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=hb(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==hb(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function mb(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(t,e)||yb(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 yb(t,e){if(t){if("string"==typeof t)return _b(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)?_b(t,e):void 0}}function _b(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}var vb=new Map,xb=new Map,wb={},bb=function(t){var e,i=0,n=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=yb(t))){e&&(t=e);var i=0,n=function(){};return{s:n,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,s=!0,o=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return s=t.done,t},e:function(t){o=!0,r=t},f:function(){try{s||null==e.return||e.return()}finally{if(o)throw r}}}}(t);try{for(n.s();!(e=n.n()).done;){var r=e.value;i=Math.trunc((i<<5)-i+r.codePointAt(0))}}catch(t){n.e(t)}finally{n.f()}return Math.abs(i).toString(36)},Sb=new Set(["id","svg","viewBox","anchor","symbol","symbolSvgContent"]);function Mb(t,e,i){var n,r,s,o,a=null==i?void 0:i.id,l=Object.fromEntries(Object.entries(t||{}).filter(function(t){var e=mb(t,1)[0];return!Sb.has(e)})),h=Object.fromEntries(Object.entries(wb).filter(function(t){var e=mb(t,1)[0];return!Sb.has(e)})),u=Object.fromEntries(Object.entries(e).filter(function(t){return null!=mb(t,2)[1]})),c=pb(pb(pb(pb({},Qw),h),l),u),d=null!==(n=ab[null==i?void 0:i.mapColorScheme])&&void 0!==n?n:ab.light;return c.haloColor=null!==(r=null==i?void 0:i.haloColor)&&void 0!==r?r:d.haloColor,c.selectedColor=null!==(s=null==i?void 0:i.selectedColor)&&void 0!==s?s:d.selectedColor,c.activeColor=null!==(o=null==i?void 0:i.activeColor)&&void 0!==o?o:d.activeColor,"string"==typeof c.graphic&&tb[c.graphic]&&(c.graphic=tb[c.graphic]),Object.fromEntries(Object.entries(c).map(function(t){var e=mb(t,2),i=e[0],n=e[1];return[i,Jw(n,a)||""]}))}function Eb(t,e){return Object.entries(e).reduce(function(t,e){var i=mb(e,2),n=i[0],r=i[1];return t.replaceAll("{{".concat(n,"}}"),r)},t)}var Cb={setDefaults:function(t){wb=t||{}},getDefaults:function(){return pb(pb({},Qw),wb)},register:function(t){vb.set(t.id,t)},get:function(t){return vb.get(t)},list:function(){return function(t){if(Array.isArray(t))return _b(t)}(t=vb.values())||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||yb(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.")}();var t},clear:function(){vb.clear()},initialise:function(){this.register(eb),this.register(ib),this.register(nb)},resolve:function(t,e,i){var n=Mb(t,e||{},i);return t?(n.selectedColor="none",n.activeColor="none",Eb(t.svg,n)):""},resolveActive:function(t,e,i){var n=Mb(t,e||{},i);return t?Eb(t.svg,n):""},resolveSelected:function(t,e,i){var n=Mb(t,e||{},i);return t?(n.activeColor="none",Eb(t.svg,n)):""},getSymbolImageId:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2,r=this.getSymbolDef(t);if(!r)return null;var s=sb(t),o=i?this.resolveActive(r,s,e):this.resolve(r,s,e);return"symbol-".concat(i?"act-":"").concat(bb(o),"-").concat(n,"x")},getSymbolDef:function(t){return t.symbolSvgContent?{svg:t.symbolSvgContent}:t.symbol?this.get(t.symbol):void 0},rasteriseSymbolImage:function(t,e,i,n){var r,s=this;return(r=ub().m(function r(){var o,a,l,h,u,c,d,f,p,g,m,y;return ub().w(function(r){for(;;)switch(r.n){case 0:if(o=s.getSymbolDef(t)){r.n=1;break}return r.a(2,null);case 1:if(a=sb(t),"active"===i?(l=s.resolveActive(o,a,e),h="act-"):"selected"===i?(l=s.resolveSelected(o,a,e),h="sel-"):(l=s.resolve(o,a,e),h=""),u="symbol-".concat(h).concat(bb(l),"-").concat(n,"x"),c=xb.get(u)){r.n=3;break}return d=ob(t,o),f=d.split(" ").map(Number),p=mb(f,4),g=p[2],m=p[3],y='<svg xmlns="http://www.w3.org/2000/svg" width="'.concat(g*n,'" height="').concat(m*n,'" viewBox="').concat(d,'">').concat(l,"</svg>"),r.n=2,lb(y,g*n,m*n);case 2:c=r.v,xb.set(u,c);case 3:return r.a(2,{imageId:u,imageData:c})}},r)}),function(){var t=this,e=arguments;return new Promise(function(i,n){var s=r.apply(t,e);function o(t){db(s,i,n,o,a,"next",t)}function a(t){db(s,i,n,o,a,"throw",t)}o(void 0)})})()}};function Pb(t){return Pb="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},Pb(t)}function Ib(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function Tb(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Ib(Object(i),!0).forEach(function(e){kb(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ib(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function kb(t,e,i){return(e=function(t){var e=function(t){if("object"!=Pb(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=Pb(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Pb(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Rb(t){return function(t){if(Array.isArray(t))return Gb(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Ob(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 Ab(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=Ob(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function Ob(t,e){if(t){if("string"==typeof t)return Gb(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)?Gb(t,e):void 0}}function Gb(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}Cb.initialise();var Fb="EPSG:27700",Lb=new Kg({dataProjection:Fb,featureProjection:Fb}),jb="_highlight",Nb=999,Db=function(t,e){if(!t)return[];var i=t.stroke,n=t.selectionStroke,r=t.fill,s=t.strokeWidth,o=t.activeStrokeWidth;if(e)return[new Sl({stroke:new _l({color:i,width:o}),zIndex:Nb}),new Sl({stroke:new _l({color:n,width:s}),zIndex:1e3})];var a=[new Sl({stroke:new _l({color:n,width:s}),zIndex:Nb})];return r&&"transparent"!==r&&a.push(new Sl({fill:new fl({color:r}),zIndex:Nb})),a},zb=function(t,e){if(!function(t){return!!(null!=t&&t.symbol||null!=t&&t.symbolSvgContent)}(t))return null;var i=e?t.symbolActiveImageId:t.symbolSelectedImageId,n=i&&function(t){return Yw.get(t)}(i);if(!n)return null;var r,s,o,a=(r=t,s=Cb.getSymbolDef(t),r.symbolAnchor?r.symbolAnchor:null!==(o=null==s?void 0:s.anchor)&&void 0!==o?o:[.5,.5]),l=1/(t.symbolPixelRatio||1);return[new Sl({image:new ml({img:n,anchor:a,scale:l}),zIndex:Nb})]},qb=function(t){var e,i=new Set,n={},r=Ab(null!=t?t:[]);try{for(r.s();!(e=r.n()).done;){var s=e.value,o=s.layerId,a=s.featureId,l=s.idProperty;i.add("".concat(o,":").concat(a)),l&&(n[o]=l)}}catch(t){r.e(t)}finally{r.f()}return{keys:i,idProps:n}},Bb=function(t,e,i){var n;if(null!=i)return t.getLayers().forEach(function(t){var r;if(!n&&t instanceof Yg&&!t.get(jb)&&t.get("layerId")===e){var s=null===(r=t.getSource())||void 0===r?void 0:r.getFeatureById(String(i));s&&(n=s.getProperties())}}),n},$b=function(t,e,i,n,r){var s,o=Ab(null!=i?i:[]);try{for(o.s();!(s=o.n()).done;){var a,l=s.value,h=l.layerId,u=l.featureId,c=l.geometry;if(c){var d=Bb(t,h,u),f=null!==(a=zb(d,n))&&void 0!==a?a:Db(null==r?void 0:r[h],n);if(f.length){var p=new kg({geometry:Lb.readGeometry(c)});p.setStyle(f),e.addFeature(p)}}}}catch(t){o.e(t)}finally{o.f()}},Ub=function(t,e){var i=t.type,n=t.coordinates,r=function(t){var i,n,r=(n=2,function(t){if(Array.isArray(t))return t}(i=t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(i,n)||Ob(i,n)||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.")}()),s=r[0],o=r[1];return e(s,o)},s=function(t){return t.forEach(r)};"Point"===i?r(n):"MultiPoint"===i||"LineString"===i?n.forEach(r):"MultiLineString"===i||"Polygon"===i?n.forEach(s):"MultiPolygon"===i&&n.forEach(function(t){return t.forEach(s)})},Wb=function(t,e,i,n){if(!t)return null;var r=new Set;t.getLayers().forEach(function(t){if(t instanceof Yg&&!t.get(jb)){var e=t.get("layerId");e&&r.add(e)}});var s=qb(e),o=s.keys,a=s.idProps,l=qb(i),h=l.keys,u=l.idProps,c=Tb(Tb({},a),u);!function(t,e,i,n,r){t.getLayers().forEach(function(t){if(t instanceof $p)if(e.size>0||i.size>0){t._highlightOriginalStyle||(t._highlightOriginalStyle=t.getStyleFunction());var s=t._highlightOriginalStyle;t.setStyle(function(t,o){var a,l=s(t,o),h=null===(a=t.get("mapbox-layer"))||void 0===a?void 0:a.id;if(!h)return l;var u=n[h],c=u?t.get(u):t.getId(),d="".concat(h,":").concat(c),f=i.has(d),p=!f&&e.has(d);if(!f&&!p)return l;var g=Db(null==r?void 0:r[h],f);if(!g.length)return l;var m=l?Array.isArray(l)?l:[l]:[];return[].concat(Rb(m),Rb(g))})}else t._highlightOriginalStyle&&(t.setStyle(t._highlightOriginalStyle),delete t._highlightOriginalStyle)})}(t,o,h,c,n);var d=function(t){var e=null;return t.getLayers().forEach(function(t){t.get(jb)&&(e=t)}),e||((e=new Yg({source:new im,zIndex:1001})).set(jb,!0),t.addLayer(e)),e}(t),f=d.getSource();f.clear();var p=(null!=e?e:[]).filter(function(t){return r.has(t.layerId)}),g=(null!=i?i:[]).filter(function(t){return r.has(t.layerId)});$b(t,f,g,!0,n),$b(t,f,p,!1,n);var m=(null!=e?e:[]).flatMap(function(e){return function(t,e){var i=e.layerId,n=e.featureId,r=e.idProperty,s=e.geometry;if(null!=n){var o=Zw(t,i,n,r);if(o.length>0)return o}return s?[s]:[]}(t,e)});return function(t){if(!t.length)return null;var e,i=1/0,n=1/0,r=-1/0,s=-1/0,o=Ab(t);try{for(o.s();!(e=o.n()).done;){var a=e.value;Ub(a,function(t,e){t<i&&(i=t),e<n&&(n=e),t>r&&(r=t),e>s&&(s=e)})}}catch(t){o.e(t)}finally{o.f()}return i===1/0?null:[i,n,r,s]}(m)};function Xb(t){return Xb="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},Xb(t)}function Vb(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function Kb(t,e,i){return(e=function(t){var e=function(t){if("object"!=Xb(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=Xb(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Xb(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var Zb="EPSG:27700",Yb=new Kg({dataProjection:Zb,featureProjection:Zb});function Hb(t){return Hb="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},Hb(t)}function Jb(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function Qb(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Jb(Object(i),!0).forEach(function(e){tS(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Jb(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function tS(t,e,i){return(e=function(t){var e=function(t){if("object"!=Hb(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=Hb(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Hb(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function eS(t){return eS="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},eS(t)}function iS(){var t,e,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",r=i.toStringTag||"@@toStringTag";function s(i,n,r,s){var l=n&&n.prototype instanceof a?n:a,h=Object.create(l.prototype);return nS(h,"_invoke",function(i,n,r){var s,a,l,h=0,u=r||[],c=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return s=e,a=0,l=t,d.n=i,o}};function f(i,n){for(a=i,l=n,e=0;!c&&h&&!r&&e<u.length;e++){var r,s=u[e],f=d.p,p=s[2];i>3?(r=p===n)&&(l=s[(a=s[4])?5:(a=3,3)],s[4]=s[5]=t):s[0]<=f&&((r=i<2&&f<s[1])?(a=0,d.v=n,d.n=s[1]):f<p&&(r=i<3||s[0]>n||n>p)&&(s[4]=i,s[5]=n,d.n=p,a=0))}if(r||i>1)return o;throw c=!0,n}return function(r,u,p){if(h>1)throw TypeError("Generator is already running");for(c&&1===u&&f(u,p),a=u,l=p;(e=a<2?t:l)||!c;){s||(a?a<3?(a>1&&(d.n=-1),f(a,l)):d.n=l:d.v=l);try{if(h=2,s){if(a||(r="next"),e=s[r]){if(!(e=e.call(s,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,a<2&&(a=0)}else 1===a&&(e=s.return)&&e.call(s),a<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),a=1);s=t}else if((e=(c=d.n<0)?l:i.call(n,d))!==o)break}catch(e){s=t,a=1,l=e}finally{h=1}}return{value:e,done:c}}}(i,r,s),!0),h}var o={};function a(){}function l(){}function h(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(nS(e={},n,function(){return this}),e),c=h.prototype=a.prototype=Object.create(u);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,nS(t,r,"GeneratorFunction")),t.prototype=Object.create(c),t}return l.prototype=h,nS(c,"constructor",h),nS(h,"constructor",l),l.displayName="GeneratorFunction",nS(h,r,"GeneratorFunction"),nS(c),nS(c,r,"Generator"),nS(c,n,function(){return this}),nS(c,"toString",function(){return"[object Generator]"}),(iS=function(){return{w:s,m:d}})()}function nS(t,e,i,n){var r=Object.defineProperty;try{r({},"",{})}catch(t){r=0}nS=function(t,e,i,n){function s(e,i){nS(t,e,function(t){return this._invoke(e,i,t)})}e?r?r(t,e,{value:i,enumerable:!n,configurable:!n,writable:!n}):t[e]=i:(s("next",0),s("throw",1),s("return",2))},nS(t,e,i,n)}function rS(t,e,i,n,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,r)}function sS(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,oS(n.key),n)}}function oS(t){var e=function(t){if("object"!=eS(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=eS(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==eS(e)?e:e+""}function aS(t,e,i){return e=hS(e),function(t,e){if(e&&("object"==eS(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,lS()?Reflect.construct(e,i||[],hS(t).constructor):e.apply(t,i))}function lS(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(lS=function(){return!!t})()}function hS(t){return hS=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},hS(t)}function uS(t,e){return uS=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},uS(t,e)}!function(){if("undefined"!=typeof HTMLCanvasElement){var t=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(e,i){for(var n=arguments.length,r=new Array(n>2?n-2:0),s=2;s<n;s++)r[s-2]=arguments[s];return t.call.apply(t,[this,e,"2d"===e?Qb(Qb({},i),{},{willReadFrequently:!0}):i].concat(r))}}}();var cS="EPSG:27700",dS=function(t){if(t){var e=t.top,i=void 0===e?0:e,n=t.right,r=void 0===n?0:n,s=t.bottom,o=void 0===s?0:s,a=t.left;return[i,r,o,void 0===a?0:a]}};bd.defs(cS,"+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){Sd=t;const e=Object.keys(t.defs),i=e.length;let n,r;for(n=0;n<i;++n){const i=e[n];if(!je(i)){const e=t.defs(i);let n=e.units;n||"longlat"!==e.projName||(n="degrees"),yi(new Me({code:i,axisOrientation:e.axis,metersPerUnit:e.to_meter,units:n}))}}for(n=0;n<i;++n){const s=e[n],o=je(s);for(r=0;r<i;++r){const i=e[r],n=je(i);if(!ze(s,i))if(t.defs[s]===t.defs[i])xi([o,n]);else{const e=t(s,i);Si(o,n,ji(o,n,e.forward),ji(n,o,e.inverse))}}}}(bd);var fS=function(t){function e(t){var i,n=t.mapProviderConfig,r=void 0===n?{}:n,s=t.events,o=t.eventBus;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(i=aS(this,e)).events=s,i.eventBus=o,i.capabilities={supportedShortcuts:Id,supportsMapSizes:!0},Object.assign(i,r),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&uS(t,e)}(e,t),i=e,n=[{key:"name",get:function(){return"OpenLayersProvider"}},{key:"initMap",value:(r=iS().m(function t(e){var i,n,r,s,o,a,l,h,u,c,d,f,p,g,m,y,_,v,x,w;return iS().w(function(t){for(;;)switch(t.n){case 0:return n=e.container,r=e.padding,s=e.mapStyle,o=e.mapSize,a=e.center,l=e.zoom,h=e.bounds,u=e.minZoom,c=e.maxZoom,d=e.transformRequest,f=e.pixelRatio,this.mapStyleId=null==s?void 0:s.id,this.mapSize=o,p=this.events,g=this.eventBus,t.n=1,Iw(s,d);case 1:m=t.v,y=m.layer,_=m.source,v=Td(null!==(i=this.zoomAlignment)&&void 0!==i?i:"uk"),x=new er({projection:cS,center:null!=a?a:h?Ht(h):void 0,zoom:null!=l?l:v.defaultMinZoom,minZoom:Math.max(null!=u?u:v.defaultMinZoom,v.defaultMinZoom),maxZoom:null!=c?c:v.maxZoom,resolutions:v.resolutions,constrainResolution:!1,padding:dS(r)}),w=new rh({target:n,layers:[y],view:x,controls:[],interactions:Qr({doubleClickZoom:!1}),pixelRatio:f}),h&&w.once("rendercomplete",function(){x.fit(h,{size:w.getSize(),duration:0})}),this.mapEventHandles=Od({map:w,source:_,events:p,eventBus:g,getZoom:this.getZoom.bind(this),getCenter:this.getCenter.bind(this),getBounds:this.getBounds.bind(this),getResolution:this.getResolution.bind(this)}),this.appEventHandles=Dw({mapProvider:this,transformRequest:d,events:p,eventBus:g,map:w,onBaseSourceChange:this.mapEventHandles.setSource})||[],this.map=w,this.view=x,g.emit(p.MAP_READY,{map:this.map,mapStyleId:this.mapStyleId,mapSize:this.mapSize,crs:this.crs});case 2:return t.a(2)}},t,this)}),s=function(){var t=this,e=arguments;return new Promise(function(i,n){var s=r.apply(t,e);function o(t){rS(s,i,n,o,a,"next",t)}function a(t){rS(s,i,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._onHoverMove&&(this.map.un("pointermove",this._onHoverMove),this._onHoverMove=null),this.map.setTarget(null),this.map=null),this.view=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:Pd})}},{key:"zoomIn",value:function(t){this.view.animate({zoom:this.view.getZoom()+t,duration:Pd})}},{key:"zoomOut",value:function(t){this.view.animate({zoom:this.view.getZoom()-t,duration:Pd})}},{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:Pd})}},{key:"fitToBounds",value:function(t){var e=Array.isArray(t)?t:Ti(qw(t),"EPSG:4326","EPSG:27700");this.view.fit(e,{duration:Pd})}},{key:"setPadding",value:function(t){this.view.padding=dS(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 function(t,e){if(!e)return[];var i=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).radius,n=void 0===i?10:i,r=[e.x,e.y],s=[],o=new Set;return t.forEachFeatureAtPixel(r,function(t,e){if(e instanceof $p){var i=t.get("mapbox-layer"),n=null==i?void 0:i.id;if(!n||"background"===(null==i?void 0:i.type))return;var r="".concat(n,":").concat(function(t){var e=t.getId();if(null!=e)return e;var i=function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Vb(Object(i),!0).forEach(function(e){Kb(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Vb(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}({},t.getProperties());return delete i["mapbox-layer"],JSON.stringify(i)}(t));if(o.has(r))return;o.add(r),s.push({id:t.getId(),layer:{id:n},geometry:Kw(t),properties:t.getProperties()})}else if(e instanceof Yg){var a=e.get("layerId");if(!a||e.get("_highlight"))return;var l=t.getId(),h="".concat(a,":").concat(l);if(o.has(h))return;o.add(h),s.push({id:l,layer:{id:a},geometry:Yb.writeGeometryObject(t.getGeometry()),properties:t.getProperties()})}},{hitTolerance:n}),s}(this.map,t,e)}},{key:"getFeatureGeometry",value:function(t,e,i){var n=Zw(this.map,t,e,i);return 0===n.length?null:1===n.length?n[0]:{type:"MultiPolygon",coordinates:n.flatMap(function(t){return"MultiPolygon"===t.type?t.coordinates:[t.coordinates]})}}},{key:"setHoverCursor",value:function(t){this.map&&(this._onHoverMove=function(t,e,i){var n=t.getViewport();if(i&&t.un("pointermove",i),null==e||!e.length)return n.style.cursor="",null;var r=new Set(e),s=null,o=function(e){var i;if("mouse"===(null===(i=e.originalEvent)||void 0===i?void 0:i.pointerType)){var o=e.pixel;null!==s&&cancelAnimationFrame(s),s=requestAnimationFrame(function(){s=null;var e=t.forEachFeatureAtPixel(o,function(t,e){return function(t,e,i){if(e instanceof $p){var n,r=null===(n=t.get("mapbox-layer"))||void 0===n?void 0:n.id;return Boolean(r&&i.has(r))}if(e instanceof Yg&&!e.get("_highlight")){var s=e.get("layerId");return Boolean(s&&i.has(s))}return!1}(t,e,r)},{hitTolerance:8});n.style.cursor=e?"pointer":""})}};return t.on("pointermove",o),o}(this.map,t,this._onHoverMove))}},{key:"getVisibleFeatures",value:function(t){return[]}},{key:"updateHighlightedFeatures",value:function(t,e,i){return this._lastHighlightArgs={selectedFeatures:t,activeFeatures:e,stylesMap:i},Wb(this.map,t,e,i)}},{key:"reapplyHighlights",value:function(){if(this._lastHighlightArgs){var t=this._lastHighlightArgs,e=t.selectedFeatures,i=t.activeFeatures,n=t.stylesMap;Wb(this.map,e,i,n)}}},{key:"getAreaDimensions",value:function(){return function(t){if(!t)return"";var e=$w(t,4),i=e[0],n=e[1],r=e[2],s=e[3],o=r-i;return"".concat(Xw(s-n)," by ").concat(Xw(o))}((e=(t=this.map).getSize(),n=(i=$w(t.getView().padding||[0,0,0,0],4))[0],r=i[1],s=i[2],o=[i[3],e[1]-s],a=[e[0]-r,n],l=t.getCoordinateFromPixel(o),h=t.getCoordinateFromPixel(a),l&&h?[l[0],l[1],h[0],h[1]]:null));var t,e,i,n,r,s,o,a,l,h}},{key:"getCardinalMove",value:function(t,e){return function(t,e){var i=e[0]-t[0],n=e[1]-t[1],r=[];return Math.abs(n)>1&&r.push("".concat(n>0?"north":"south"," ").concat(Xw(Math.abs(n)))),Math.abs(i)>1&&r.push("".concat(i>0?"east":"west"," ").concat(Xw(Math.abs(i)))),r.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 n=i.getTargetElement().getBoundingClientRect();if(!n.width||!n.height)return!1;var r=i.getViewport().getBoundingClientRect(),s=r.width/n.width,o=r.height/n.height,a=function(t){return qw(t)}(t),l=$w(a,4),h=l[0],u=l[1],c=l[2],d=l[3],f=[[h,u],[h,d],[c,u],[c,d]].map(function(t){return i.getPixelFromCoordinate(t)}).filter(Boolean);if(!f.length)return!1;var p=n.left+Math.min.apply(Math,Bw(f.map(function(t){return t[0]})))*s,g=n.left+Math.max.apply(Math,Bw(f.map(function(t){return t[0]})))*s,m=n.top+Math.min.apply(Math,Bw(f.map(function(t){return t[1]})))*o,y=n.top+Math.max.apply(Math,Bw(f.map(function(t){return t[1]})))*o;return p<e.right&&g>e.left&&m<e.bottom&&y>e.top}(t,e,this.map)}}],n&&sS(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,n,r,s}(o)}}]);
|