From 91f9b9866f09c55ffa4ac51a284db6f756153ec4 Mon Sep 17 00:00:00 2001 From: adrian Date: Tue, 2 Jul 2024 17:43:51 -0400 Subject: [PATCH] mapbox 4, rollup 4, node 22. lets make route a button while we debug the event handling. add 30d weather layer. --- README.md | 2 +- build-production.sh | 4 +- build.sh | 4 +- buttons.json | 16 + dist/cyclemaps.css | 2 +- dist/cyclemaps.js | 8 +- index.html | 8 +- install.sh | 6 + npm.sh | 6 + package-lock.json | 966 +++++++++++++++++++++++++++++++++++++------- package.json | 12 +- src/button.ts | 48 +-- src/main.ts | 7 +- src/route.ts | 59 +-- 14 files changed, 920 insertions(+), 228 deletions(-) create mode 100755 install.sh create mode 100755 npm.sh diff --git a/README.md b/README.md index e7c0a25..f270598 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ * you need to set environment variable `CYCLEMAPS_MAPBOX_PUBLIC_ACCESS_TOKEN` * `echo "CYCLEMAPS_MAPBOX_PUBLIC_ACCESS_TOKEN=$CYCLEMAPS_MAPBOX_PUBLIC_ACCESS_TOKEN" >.env` * `./update.sh` -* `docker run --user=$(id --user):$(id --group) --rm --volume=.:/home --workdir=/home -it node:18 npm install` +* `./install.sh` * `./build.sh` ## non server-side layers diff --git a/build-production.sh b/build-production.sh index fd70d60..1468c95 100755 --- a/build-production.sh +++ b/build-production.sh @@ -2,6 +2,6 @@ set -e #exit on failure -#first time: npm install -docker run --user=$(id --user):$(id --group) --rm --volume=.:/home --workdir=/home -it node:18 npm run build-production +#first time: ./install.sh +./npm.sh run build-production "$@" diff --git a/build.sh b/build.sh index 122bcb9..ead367e 100755 --- a/build.sh +++ b/build.sh @@ -2,6 +2,6 @@ set -e #exit on failure -#first time: npm install -docker run --user=$(id --user):$(id --group) --rm --volume=.:/home --workdir=/home -it node:18 npm run build +#first time: ./install.sh +./npm.sh run build "$@" diff --git a/buttons.json b/buttons.json index 6cf836b..9454169 100644 --- a/buttons.json +++ b/buttons.json @@ -17,6 +17,7 @@ "cycleway-paved": [{"propertyType": "layout", "property": "visibility", "value": "visible"}], "cyclefriendly-paved": [{"propertyType": "layout", "property": "visibility", "value": "visible"}] }}, + { "id": "route", "class": "route" }, { "id": "satellite", "class": "layer", @@ -70,6 +71,21 @@ "https://mapservices.weather.noaa.gov/raster/rest/services/obs/rfc_qpe/MapServer/export?bbox={bbox-epsg-3857}&size=512,512&dpi=96&format=png8&transparent=true&bboxSR=3857&imageSR=3857&layers=show:56&f=image" ] } + }, + { + "id": "past-rain-30d", + "class": "rain", + "type": "raster", + "paint": {"raster-opacity": 0.5}, + "beforeId": "rain-anchor", + "group": "weather", + "source": { + "type": "raster", + "tileSize": 2048, + "tiles" : [ + "https://mapservices.weather.noaa.gov/raster/rest/services/obs/rfc_qpe/MapServer/export?bbox={bbox-epsg-3857}&size=512,512&dpi=96&format=png8&transparent=true&bboxSR=3857&imageSR=3857&layers=show:68&f=image" + ] + } } ]}, { "id": "more", "name": "☰", "class": "directory", "source": [ diff --git a/dist/cyclemaps.css b/dist/cyclemaps.css index 317ea49..6ceb5de 100644 --- a/dist/cyclemaps.css +++ b/dist/cyclemaps.css @@ -1 +1 @@ -.maplibregl-map{-webkit-tap-highlight-color:rgb(0 0 0/0);font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px rgba(0,0,0,.1)}@media (-ms-high-contrast:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (-ms-high-contrast:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}.maplibregl-ctrl button:not(:disabled):hover{background-color:rgb(0 0 0/5%)}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8h-8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8h-8z'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8h-8z'/%3E%3Cpath fill='%23999' d='m10.5 16 4 8 4-8h-8z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8h-8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8h-8z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1 9-9z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23999' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1 9-9z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23666' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1 9-9z'/%3E%3C/svg%3E")}}@keyframes maplibregl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.255 1.255 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.255 1.255 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5.11 5.11 0 0 1 .314-.787l.009-.016a4.623 4.623 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.548 4.548 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4.314.319.566.676.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.416 2.416 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.448 2.448 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675c.211.2.381.43.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.76 4.76 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.407 3.407 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.255 1.255 0 0 1 .689 1.004 4.73 4.73 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528 0 .343-.02.694-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.815 5.815 0 0 1-.548-2.512c0-.286.017-.567.053-.843a1.255 1.255 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.778 4.778 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.47 4.47 0 0 1-1.935-.424 1.252 1.252 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.402 2.402 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.703 4.703 0 0 1-1.782 1.884 4.767 4.767 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.47 4.47 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a4.983 4.983 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.255 1.255 0 0 1-1.115.676h-.098a1.255 1.255 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15c.329-.237.574-.499.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267c-.088-.22-.264-.438-.526-.658l-.032-.028a3.16 3.16 0 0 0-.668-.428l-.27-.12a3.293 3.293 0 0 0-1.235-.23c-.757 0-1.415.163-1.974.493a3.36 3.36 0 0 0-1.3 1.382c-.297.593-.444 1.284-.444 2.074 0 .8.17 1.503.51 2.107a3.795 3.795 0 0 0 1.382 1.381 3.883 3.883 0 0 0 1.893.477c.53 0 1.015-.11 1.455-.33zm-2.789-5.38c-.384.45-.575 1.038-.575 1.762 0 .735.186 1.332.559 1.794.384.45.933.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.17 2.17 0 0 0 .468-.29l.178-.161a2.163 2.163 0 0 0 .397-.561c.163-.333.244-.717.244-1.15v-.115c0-.472-.098-.894-.296-1.267l-.043-.077a2.211 2.211 0 0 0-.633-.709l-.13-.086-.047-.028a2.099 2.099 0 0 0-1.073-.285c-.702 0-1.244.231-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.958.958 0 0 0-.353-.389.851.851 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.626 2.626 0 0 0 .331.423c.213.22.464.402.755.548l.173.074c.433.17.93.255 1.49.255.68 0 1.295-.165 1.844-.493a3.447 3.447 0 0 0 1.316-1.4c.329-.603.493-1.299.493-2.089 0-1.273-.33-2.243-.988-2.913-.658-.68-1.52-1.02-2.584-1.02-.598 0-1.124.115-1.575.347a2.807 2.807 0 0 0-.415.262l-.199.166a3.35 3.35 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138c.137.193.297.36.48.5l.155.11.053.034c.34.197.713.297 1.119.297.714 0 1.262-.225 1.645-.675.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.29 0-.569.053-.835.16a2.366 2.366 0 0 0-.284.136 1.99 1.99 0 0 0-.363.254 2.237 2.237 0 0 0-.46.569l-.082.162a2.56 2.56 0 0 0-.213 1.072v.115c0 .471.098.894.296 1.267l.135.211zm.964-.818a1.11 1.11 0 0 0 .367.385.937.937 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a.995.995 0 0 0-.503.135l-.012.007a.859.859 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.43 1.43 0 0 0 .14.66zm15.7-6.222c.232-.23.346-.516.346-.856a1.053 1.053 0 0 0-.345-.79 1.175 1.175 0 0 0-.84-.329c-.34 0-.625.11-.855.33a1.053 1.053 0 0 0-.346.79c0 .34.115.625.346.855.23.23.516.346.856.346.34 0 .62-.115.839-.346zm4.337 9.314.033-1.332c.128.269.324.518.59.747l.098.081a3.727 3.727 0 0 0 .316.224l.223.122a3.21 3.21 0 0 0 1.44.322 3.785 3.785 0 0 0 1.875-.477 3.52 3.52 0 0 0 1.382-1.366c.352-.593.526-1.29.526-2.09 0-.79-.147-1.48-.444-2.073a3.235 3.235 0 0 0-1.283-1.399c-.549-.34-1.195-.51-1.942-.51a3.476 3.476 0 0 0-1.527.344l-.086.043-.165.09a3.412 3.412 0 0 0-.33.214c-.288.21-.507.446-.656.707a1.893 1.893 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.482 2.482 0 0 0 .566.7c.078.065.159.125.245.18l.144.08a2.105 2.105 0 0 0 .975.232c.713 0 1.262-.225 1.645-.675.384-.46.576-1.053.576-1.778 0-.734-.192-1.327-.576-1.777-.373-.46-.921-.692-1.645-.692a2.18 2.18 0 0 0-1.015.235c-.147.075-.285.17-.415.282l-.15.142a2.086 2.086 0 0 0-.42.594c-.149.32-.223.685-.223 1.1v.115c0 .47.097.89.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.868.868 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.13 1.13 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013c.23-.087.472-.134.724-.14l.069-.002c.329 0 .542.033.642.099l.247-1.794c-.13-.066-.37-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2.086 2.086 0 0 0-.411.148 2.18 2.18 0 0 0-.4.249 2.482 2.482 0 0 0-.485.499 2.659 2.659 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884c0-.364.053-.678.159-.943a1.49 1.49 0 0 1 .466-.636 2.52 2.52 0 0 1 .399-.253 2.19 2.19 0 0 1 .224-.099zm9.784 2.656.05-.922c0-1.162-.285-2.062-.856-2.698-.559-.647-1.42-.97-2.584-.97-.746 0-1.415.163-2.007.493a3.462 3.462 0 0 0-1.4 1.382c-.329.604-.493 1.306-.493 2.106 0 .714.143 1.371.428 1.975.285.593.73 1.07 1.332 1.432.604.351 1.355.526 2.255.526.649 0 1.204-.062 1.668-.185l.044-.012.135-.04c.409-.122.736-.263.984-.421l-.542-1.267c-.2.108-.415.199-.642.274l-.297.087c-.34.088-.773.131-1.3.131-.636 0-1.135-.147-1.497-.444a1.573 1.573 0 0 1-.192-.193c-.244-.294-.415-.705-.512-1.234l-.004-.021h5.43zm-5.427-1.256-.003.022h3.752v-.138c-.007-.485-.104-.857-.288-1.118a1.056 1.056 0 0 0-.156-.176c-.307-.285-.746-.428-1.316-.428-.657 0-1.155.202-1.494.604-.253.3-.417.712-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81c-.68 0-1.311-.16-1.893-.478a3.795 3.795 0 0 1-1.381-1.382c-.34-.604-.51-1.306-.51-2.106 0-.79.147-1.482.444-2.074a3.364 3.364 0 0 1 1.3-1.382c.559-.33 1.217-.494 1.974-.494a3.293 3.293 0 0 1 1.234.231 3.341 3.341 0 0 1 .97.575c.264.22.44.439.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332c-.186.395-.526.746-1.02 1.053a3.167 3.167 0 0 1-1.662.444zm.296-1.482c.626 0 1.152-.214 1.58-.642.428-.44.642-1.01.642-1.711v-.115c0-.472-.098-.894-.296-1.267a2.211 2.211 0 0 0-.807-.872 2.098 2.098 0 0 0-1.119-.313c-.702 0-1.245.231-1.629.692-.384.45-.575 1.037-.575 1.76 0 .736.186 1.333.559 1.795.384.45.933.675 1.645.675zm6.521-6.237h1.711v1.4c.604-1.065 1.547-1.597 2.83-1.597 1.064 0 1.926.34 2.584 1.02.659.67.988 1.641.988 2.914 0 .79-.164 1.487-.493 2.09a3.456 3.456 0 0 1-1.316 1.399 3.51 3.51 0 0 1-1.844.493c-.636 0-1.19-.11-1.662-.329a2.665 2.665 0 0 1-1.086-.97l.017 5.134h-1.728V9.242zm4.048 6.22c.714 0 1.262-.224 1.645-.674.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.395 0-.768.098-1.12.296-.34.187-.613.46-.822.823-.197.351-.296.763-.296 1.234v.115c0 .472.098.894.296 1.267.209.362.483.647.823.855.34.197.713.297 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.159 1.159 0 0 1-.856-.346 1.165 1.165 0 0 1-.346-.856 1.053 1.053 0 0 1 .346-.79c.23-.219.516-.329.856-.329.329 0 .609.11.839.33a1.053 1.053 0 0 1 .345.79 1.159 1.159 0 0 1-.345.855c-.22.23-.5.346-.84.346zm7.875 9.133a3.167 3.167 0 0 1-1.662-.444c-.482-.307-.817-.658-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283c.186-.438.548-.812 1.086-1.119a3.486 3.486 0 0 1 1.778-.477c.746 0 1.393.17 1.942.51a3.235 3.235 0 0 1 1.283 1.4c.297.592.444 1.282.444 2.072 0 .8-.175 1.498-.526 2.09a3.52 3.52 0 0 1-1.382 1.366 3.785 3.785 0 0 1-1.876.477zm-.296-1.481c.713 0 1.26-.225 1.645-.675.384-.46.577-1.053.577-1.778 0-.734-.193-1.327-.577-1.776-.373-.46-.921-.692-1.645-.692a2.115 2.115 0 0 0-1.58.659c-.428.428-.642.992-.642 1.694v.115c0 .473.098.895.296 1.267a2.385 2.385 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481c.176-.505.46-.91.856-1.217a2.14 2.14 0 0 1 1.349-.46c.351 0 .593.032.724.098l-.247 1.794c-.099-.066-.313-.099-.642-.099-.516 0-.988.164-1.416.494-.417.329-.626.855-.626 1.58v3.883h-1.777V9.242zm9.534 7.718c-.9 0-1.651-.175-2.255-.526-.603-.362-1.047-.84-1.332-1.432a4.567 4.567 0 0 1-.428-1.975c0-.8.164-1.502.493-2.106a3.462 3.462 0 0 1 1.4-1.382c.592-.33 1.262-.494 2.007-.494 1.163 0 2.024.324 2.584.97.57.637.856 1.537.856 2.7 0 .296-.017.603-.05.92h-5.43c.12.67.356 1.153.708 1.45.362.296.86.443 1.497.443.526 0 .96-.044 1.3-.131a4.123 4.123 0 0 0 .938-.362l.542 1.267c-.274.175-.647.329-1.119.46-.472.132-1.042.197-1.711.197zm1.596-4.558c.01-.68-.137-1.158-.444-1.432-.307-.285-.746-.428-1.316-.428-1.152 0-1.815.62-1.991 1.86h3.752z'/%3E%3Cg fill-rule='evenodd' stroke-width='1.036'%3E%3Cpath fill='%23000' fill-opacity='.4' d='m8.166 16.146-.002.002a1.54 1.54 0 0 1-2.009 0l-.002-.002-.043-.034-.002-.002-.199-.162H4.377a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659H8.411l-.202.164zm-1.121-.905a.29.29 0 0 0 .113.023.286.286 0 0 0 .189-.07l.077-.063c.634-.508 4.672-3.743 4.672-7.575 0-2.55-2.215-4.625-4.938-4.625S2.221 5.006 2.221 7.556c0 3.225 2.86 6.027 4.144 7.137h.004l.04.038.484.4.077.063a.628.628 0 0 0 .074.047zm-2.52-.548a16.898 16.898 0 0 1-1.183-1.315C2.187 11.942.967 9.897.967 7.555c0-3.319 2.855-5.88 6.192-5.88 3.338 0 6.193 2.561 6.193 5.881 0 2.34-1.22 4.387-2.376 5.822a16.898 16.898 0 0 1-1.182 1.315h.15a1.912 1.912 0 0 1 1.914 1.914v1.84a1.912 1.912 0 0 1-1.914 1.914H4.377a1.912 1.912 0 0 1-1.914-1.914v-1.84a1.912 1.912 0 0 1 1.914-1.914zm3.82-6.935c0 .692-.55 1.222-1.187 1.222s-1.185-.529-1.185-1.222.548-1.222 1.185-1.222c.638 0 1.186.529 1.186 1.222zm-1.186 2.477c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477zm2.048 7.71H5.114v-.838h4.093z'/%3E%3Cpath fill='%23e1e3e9' d='M2.222 7.555c0-2.55 2.214-4.625 4.937-4.625 2.723 0 4.938 2.075 4.938 4.625 0 3.832-4.038 7.068-4.672 7.575l-.077.063a.286.286 0 0 1-.189.07.286.286 0 0 1-.188-.07l-.077-.063c-.634-.507-4.672-3.743-4.672-7.575zm4.937 2.68c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477z'/%3E%3Cpath fill='%23fff' d='M4.377 15.948a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659zm4.83 1.16H5.114v.838h4.093z'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (-ms-high-contrast:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.255 1.255 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.255 1.255 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5.11 5.11 0 0 1 .314-.787l.009-.016a4.623 4.623 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.548 4.548 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4.314.319.566.676.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.416 2.416 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.448 2.448 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675c.211.2.381.43.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.76 4.76 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.407 3.407 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.255 1.255 0 0 1 .689 1.004 4.73 4.73 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528 0 .343-.02.694-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.815 5.815 0 0 1-.548-2.512c0-.286.017-.567.053-.843a1.255 1.255 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.778 4.778 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.47 4.47 0 0 1-1.935-.424 1.252 1.252 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.402 2.402 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.703 4.703 0 0 1-1.782 1.884 4.767 4.767 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.47 4.47 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a4.983 4.983 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.255 1.255 0 0 1-1.115.676h-.098a1.255 1.255 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15c.329-.237.574-.499.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267c-.088-.22-.264-.438-.526-.658l-.032-.028a3.16 3.16 0 0 0-.668-.428l-.27-.12a3.293 3.293 0 0 0-1.235-.23c-.757 0-1.415.163-1.974.493a3.36 3.36 0 0 0-1.3 1.382c-.297.593-.444 1.284-.444 2.074 0 .8.17 1.503.51 2.107a3.795 3.795 0 0 0 1.382 1.381 3.883 3.883 0 0 0 1.893.477c.53 0 1.015-.11 1.455-.33zm-2.789-5.38c-.384.45-.575 1.038-.575 1.762 0 .735.186 1.332.559 1.794.384.45.933.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.17 2.17 0 0 0 .468-.29l.178-.161a2.163 2.163 0 0 0 .397-.561c.163-.333.244-.717.244-1.15v-.115c0-.472-.098-.894-.296-1.267l-.043-.077a2.211 2.211 0 0 0-.633-.709l-.13-.086-.047-.028a2.099 2.099 0 0 0-1.073-.285c-.702 0-1.244.231-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.958.958 0 0 0-.353-.389.851.851 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.626 2.626 0 0 0 .331.423c.213.22.464.402.755.548l.173.074c.433.17.93.255 1.49.255.68 0 1.295-.165 1.844-.493a3.447 3.447 0 0 0 1.316-1.4c.329-.603.493-1.299.493-2.089 0-1.273-.33-2.243-.988-2.913-.658-.68-1.52-1.02-2.584-1.02-.598 0-1.124.115-1.575.347a2.807 2.807 0 0 0-.415.262l-.199.166a3.35 3.35 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138c.137.193.297.36.48.5l.155.11.053.034c.34.197.713.297 1.119.297.714 0 1.262-.225 1.645-.675.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.29 0-.569.053-.835.16a2.366 2.366 0 0 0-.284.136 1.99 1.99 0 0 0-.363.254 2.237 2.237 0 0 0-.46.569l-.082.162a2.56 2.56 0 0 0-.213 1.072v.115c0 .471.098.894.296 1.267l.135.211zm.964-.818a1.11 1.11 0 0 0 .367.385.937.937 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a.995.995 0 0 0-.503.135l-.012.007a.859.859 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.43 1.43 0 0 0 .14.66zm15.7-6.222c.232-.23.346-.516.346-.856a1.053 1.053 0 0 0-.345-.79 1.175 1.175 0 0 0-.84-.329c-.34 0-.625.11-.855.33a1.053 1.053 0 0 0-.346.79c0 .34.115.625.346.855.23.23.516.346.856.346.34 0 .62-.115.839-.346zm4.337 9.314.033-1.332c.128.269.324.518.59.747l.098.081a3.727 3.727 0 0 0 .316.224l.223.122a3.21 3.21 0 0 0 1.44.322 3.785 3.785 0 0 0 1.875-.477 3.52 3.52 0 0 0 1.382-1.366c.352-.593.526-1.29.526-2.09 0-.79-.147-1.48-.444-2.073a3.235 3.235 0 0 0-1.283-1.399c-.549-.34-1.195-.51-1.942-.51a3.476 3.476 0 0 0-1.527.344l-.086.043-.165.09a3.412 3.412 0 0 0-.33.214c-.288.21-.507.446-.656.707a1.893 1.893 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.482 2.482 0 0 0 .566.7c.078.065.159.125.245.18l.144.08a2.105 2.105 0 0 0 .975.232c.713 0 1.262-.225 1.645-.675.384-.46.576-1.053.576-1.778 0-.734-.192-1.327-.576-1.777-.373-.46-.921-.692-1.645-.692a2.18 2.18 0 0 0-1.015.235c-.147.075-.285.17-.415.282l-.15.142a2.086 2.086 0 0 0-.42.594c-.149.32-.223.685-.223 1.1v.115c0 .47.097.89.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.868.868 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.13 1.13 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013c.23-.087.472-.134.724-.14l.069-.002c.329 0 .542.033.642.099l.247-1.794c-.13-.066-.37-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2.086 2.086 0 0 0-.411.148 2.18 2.18 0 0 0-.4.249 2.482 2.482 0 0 0-.485.499 2.659 2.659 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884c0-.364.053-.678.159-.943a1.49 1.49 0 0 1 .466-.636 2.52 2.52 0 0 1 .399-.253 2.19 2.19 0 0 1 .224-.099zm9.784 2.656.05-.922c0-1.162-.285-2.062-.856-2.698-.559-.647-1.42-.97-2.584-.97-.746 0-1.415.163-2.007.493a3.462 3.462 0 0 0-1.4 1.382c-.329.604-.493 1.306-.493 2.106 0 .714.143 1.371.428 1.975.285.593.73 1.07 1.332 1.432.604.351 1.355.526 2.255.526.649 0 1.204-.062 1.668-.185l.044-.012.135-.04c.409-.122.736-.263.984-.421l-.542-1.267c-.2.108-.415.199-.642.274l-.297.087c-.34.088-.773.131-1.3.131-.636 0-1.135-.147-1.497-.444a1.573 1.573 0 0 1-.192-.193c-.244-.294-.415-.705-.512-1.234l-.004-.021h5.43zm-5.427-1.256-.003.022h3.752v-.138c-.007-.485-.104-.857-.288-1.118a1.056 1.056 0 0 0-.156-.176c-.307-.285-.746-.428-1.316-.428-.657 0-1.155.202-1.494.604-.253.3-.417.712-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81c-.68 0-1.311-.16-1.893-.478a3.795 3.795 0 0 1-1.381-1.382c-.34-.604-.51-1.306-.51-2.106 0-.79.147-1.482.444-2.074a3.364 3.364 0 0 1 1.3-1.382c.559-.33 1.217-.494 1.974-.494a3.293 3.293 0 0 1 1.234.231 3.341 3.341 0 0 1 .97.575c.264.22.44.439.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332c-.186.395-.526.746-1.02 1.053a3.167 3.167 0 0 1-1.662.444zm.296-1.482c.626 0 1.152-.214 1.58-.642.428-.44.642-1.01.642-1.711v-.115c0-.472-.098-.894-.296-1.267a2.211 2.211 0 0 0-.807-.872 2.098 2.098 0 0 0-1.119-.313c-.702 0-1.245.231-1.629.692-.384.45-.575 1.037-.575 1.76 0 .736.186 1.333.559 1.795.384.45.933.675 1.645.675zm6.521-6.237h1.711v1.4c.604-1.065 1.547-1.597 2.83-1.597 1.064 0 1.926.34 2.584 1.02.659.67.988 1.641.988 2.914 0 .79-.164 1.487-.493 2.09a3.456 3.456 0 0 1-1.316 1.399 3.51 3.51 0 0 1-1.844.493c-.636 0-1.19-.11-1.662-.329a2.665 2.665 0 0 1-1.086-.97l.017 5.134h-1.728V9.242zm4.048 6.22c.714 0 1.262-.224 1.645-.674.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.395 0-.768.098-1.12.296-.34.187-.613.46-.822.823-.197.351-.296.763-.296 1.234v.115c0 .472.098.894.296 1.267.209.362.483.647.823.855.34.197.713.297 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.159 1.159 0 0 1-.856-.346 1.165 1.165 0 0 1-.346-.856 1.053 1.053 0 0 1 .346-.79c.23-.219.516-.329.856-.329.329 0 .609.11.839.33a1.053 1.053 0 0 1 .345.79 1.159 1.159 0 0 1-.345.855c-.22.23-.5.346-.84.346zm7.875 9.133a3.167 3.167 0 0 1-1.662-.444c-.482-.307-.817-.658-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283c.186-.438.548-.812 1.086-1.119a3.486 3.486 0 0 1 1.778-.477c.746 0 1.393.17 1.942.51a3.235 3.235 0 0 1 1.283 1.4c.297.592.444 1.282.444 2.072 0 .8-.175 1.498-.526 2.09a3.52 3.52 0 0 1-1.382 1.366 3.785 3.785 0 0 1-1.876.477zm-.296-1.481c.713 0 1.26-.225 1.645-.675.384-.46.577-1.053.577-1.778 0-.734-.193-1.327-.577-1.776-.373-.46-.921-.692-1.645-.692a2.115 2.115 0 0 0-1.58.659c-.428.428-.642.992-.642 1.694v.115c0 .473.098.895.296 1.267a2.385 2.385 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481c.176-.505.46-.91.856-1.217a2.14 2.14 0 0 1 1.349-.46c.351 0 .593.032.724.098l-.247 1.794c-.099-.066-.313-.099-.642-.099-.516 0-.988.164-1.416.494-.417.329-.626.855-.626 1.58v3.883h-1.777V9.242zm9.534 7.718c-.9 0-1.651-.175-2.255-.526-.603-.362-1.047-.84-1.332-1.432a4.567 4.567 0 0 1-.428-1.975c0-.8.164-1.502.493-2.106a3.462 3.462 0 0 1 1.4-1.382c.592-.33 1.262-.494 2.007-.494 1.163 0 2.024.324 2.584.97.57.637.856 1.537.856 2.7 0 .296-.017.603-.05.92h-5.43c.12.67.356 1.153.708 1.45.362.296.86.443 1.497.443.526 0 .96-.044 1.3-.131a4.123 4.123 0 0 0 .938-.362l.542 1.267c-.274.175-.647.329-1.119.46-.472.132-1.042.197-1.711.197zm1.596-4.558c.01-.68-.137-1.158-.444-1.432-.307-.285-.746-.428-1.316-.428-1.152 0-1.815.62-1.991 1.86h3.752z'/%3E%3Cg fill-rule='evenodd' stroke-width='1.036'%3E%3Cpath fill='%23000' fill-opacity='.4' d='m8.166 16.146-.002.002a1.54 1.54 0 0 1-2.009 0l-.002-.002-.043-.034-.002-.002-.199-.162H4.377a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659H8.411l-.202.164zm-1.121-.905a.29.29 0 0 0 .113.023.286.286 0 0 0 .189-.07l.077-.063c.634-.508 4.672-3.743 4.672-7.575 0-2.55-2.215-4.625-4.938-4.625S2.221 5.006 2.221 7.556c0 3.225 2.86 6.027 4.144 7.137h.004l.04.038.484.4.077.063a.628.628 0 0 0 .074.047zm-2.52-.548a16.898 16.898 0 0 1-1.183-1.315C2.187 11.942.967 9.897.967 7.555c0-3.319 2.855-5.88 6.192-5.88 3.338 0 6.193 2.561 6.193 5.881 0 2.34-1.22 4.387-2.376 5.822a16.898 16.898 0 0 1-1.182 1.315h.15a1.912 1.912 0 0 1 1.914 1.914v1.84a1.912 1.912 0 0 1-1.914 1.914H4.377a1.912 1.912 0 0 1-1.914-1.914v-1.84a1.912 1.912 0 0 1 1.914-1.914zm3.82-6.935c0 .692-.55 1.222-1.187 1.222s-1.185-.529-1.185-1.222.548-1.222 1.185-1.222c.638 0 1.186.529 1.186 1.222zm-1.186 2.477c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477zm2.048 7.71H5.114v-.838h4.093z'/%3E%3Cpath fill='%23e1e3e9' d='M2.222 7.555c0-2.55 2.214-4.625 4.937-4.625 2.723 0 4.938 2.075 4.938 4.625 0 3.832-4.038 7.068-4.672 7.575l-.077.063a.286.286 0 0 1-.189.07.286.286 0 0 1-.188-.07l-.077-.063c-.634-.507-4.672-3.743-4.672-7.575zm4.937 2.68c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477z'/%3E%3Cpath fill='%23fff' d='M4.377 15.948a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659zm4.83 1.16H5.114v.838h4.093z'/%3E%3C/g%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.255 1.255 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.255 1.255 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5.11 5.11 0 0 1 .314-.787l.009-.016a4.623 4.623 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.548 4.548 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4.314.319.566.676.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.416 2.416 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.448 2.448 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675c.211.2.381.43.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.76 4.76 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.407 3.407 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.255 1.255 0 0 1 .689 1.004 4.73 4.73 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528 0 .343-.02.694-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.815 5.815 0 0 1-.548-2.512c0-.286.017-.567.053-.843a1.255 1.255 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.778 4.778 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.47 4.47 0 0 1-1.935-.424 1.252 1.252 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.402 2.402 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.703 4.703 0 0 1-1.782 1.884 4.767 4.767 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.47 4.47 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a4.983 4.983 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.255 1.255 0 0 1-1.115.676h-.098a1.255 1.255 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15c.329-.237.574-.499.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267c-.088-.22-.264-.438-.526-.658l-.032-.028a3.16 3.16 0 0 0-.668-.428l-.27-.12a3.293 3.293 0 0 0-1.235-.23c-.757 0-1.415.163-1.974.493a3.36 3.36 0 0 0-1.3 1.382c-.297.593-.444 1.284-.444 2.074 0 .8.17 1.503.51 2.107a3.795 3.795 0 0 0 1.382 1.381 3.883 3.883 0 0 0 1.893.477c.53 0 1.015-.11 1.455-.33zm-2.789-5.38c-.384.45-.575 1.038-.575 1.762 0 .735.186 1.332.559 1.794.384.45.933.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.17 2.17 0 0 0 .468-.29l.178-.161a2.163 2.163 0 0 0 .397-.561c.163-.333.244-.717.244-1.15v-.115c0-.472-.098-.894-.296-1.267l-.043-.077a2.211 2.211 0 0 0-.633-.709l-.13-.086-.047-.028a2.099 2.099 0 0 0-1.073-.285c-.702 0-1.244.231-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.958.958 0 0 0-.353-.389.851.851 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.626 2.626 0 0 0 .331.423c.213.22.464.402.755.548l.173.074c.433.17.93.255 1.49.255.68 0 1.295-.165 1.844-.493a3.447 3.447 0 0 0 1.316-1.4c.329-.603.493-1.299.493-2.089 0-1.273-.33-2.243-.988-2.913-.658-.68-1.52-1.02-2.584-1.02-.598 0-1.124.115-1.575.347a2.807 2.807 0 0 0-.415.262l-.199.166a3.35 3.35 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138c.137.193.297.36.48.5l.155.11.053.034c.34.197.713.297 1.119.297.714 0 1.262-.225 1.645-.675.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.29 0-.569.053-.835.16a2.366 2.366 0 0 0-.284.136 1.99 1.99 0 0 0-.363.254 2.237 2.237 0 0 0-.46.569l-.082.162a2.56 2.56 0 0 0-.213 1.072v.115c0 .471.098.894.296 1.267l.135.211zm.964-.818a1.11 1.11 0 0 0 .367.385.937.937 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a.995.995 0 0 0-.503.135l-.012.007a.859.859 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.43 1.43 0 0 0 .14.66zm15.7-6.222c.232-.23.346-.516.346-.856a1.053 1.053 0 0 0-.345-.79 1.175 1.175 0 0 0-.84-.329c-.34 0-.625.11-.855.33a1.053 1.053 0 0 0-.346.79c0 .34.115.625.346.855.23.23.516.346.856.346.34 0 .62-.115.839-.346zm4.337 9.314.033-1.332c.128.269.324.518.59.747l.098.081a3.727 3.727 0 0 0 .316.224l.223.122a3.21 3.21 0 0 0 1.44.322 3.785 3.785 0 0 0 1.875-.477 3.52 3.52 0 0 0 1.382-1.366c.352-.593.526-1.29.526-2.09 0-.79-.147-1.48-.444-2.073a3.235 3.235 0 0 0-1.283-1.399c-.549-.34-1.195-.51-1.942-.51a3.476 3.476 0 0 0-1.527.344l-.086.043-.165.09a3.412 3.412 0 0 0-.33.214c-.288.21-.507.446-.656.707a1.893 1.893 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.482 2.482 0 0 0 .566.7c.078.065.159.125.245.18l.144.08a2.105 2.105 0 0 0 .975.232c.713 0 1.262-.225 1.645-.675.384-.46.576-1.053.576-1.778 0-.734-.192-1.327-.576-1.777-.373-.46-.921-.692-1.645-.692a2.18 2.18 0 0 0-1.015.235c-.147.075-.285.17-.415.282l-.15.142a2.086 2.086 0 0 0-.42.594c-.149.32-.223.685-.223 1.1v.115c0 .47.097.89.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.868.868 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.13 1.13 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013c.23-.087.472-.134.724-.14l.069-.002c.329 0 .542.033.642.099l.247-1.794c-.13-.066-.37-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2.086 2.086 0 0 0-.411.148 2.18 2.18 0 0 0-.4.249 2.482 2.482 0 0 0-.485.499 2.659 2.659 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884c0-.364.053-.678.159-.943a1.49 1.49 0 0 1 .466-.636 2.52 2.52 0 0 1 .399-.253 2.19 2.19 0 0 1 .224-.099zm9.784 2.656.05-.922c0-1.162-.285-2.062-.856-2.698-.559-.647-1.42-.97-2.584-.97-.746 0-1.415.163-2.007.493a3.462 3.462 0 0 0-1.4 1.382c-.329.604-.493 1.306-.493 2.106 0 .714.143 1.371.428 1.975.285.593.73 1.07 1.332 1.432.604.351 1.355.526 2.255.526.649 0 1.204-.062 1.668-.185l.044-.012.135-.04c.409-.122.736-.263.984-.421l-.542-1.267c-.2.108-.415.199-.642.274l-.297.087c-.34.088-.773.131-1.3.131-.636 0-1.135-.147-1.497-.444a1.573 1.573 0 0 1-.192-.193c-.244-.294-.415-.705-.512-1.234l-.004-.021h5.43zm-5.427-1.256-.003.022h3.752v-.138c-.007-.485-.104-.857-.288-1.118a1.056 1.056 0 0 0-.156-.176c-.307-.285-.746-.428-1.316-.428-.657 0-1.155.202-1.494.604-.253.3-.417.712-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81c-.68 0-1.311-.16-1.893-.478a3.795 3.795 0 0 1-1.381-1.382c-.34-.604-.51-1.306-.51-2.106 0-.79.147-1.482.444-2.074a3.364 3.364 0 0 1 1.3-1.382c.559-.33 1.217-.494 1.974-.494a3.293 3.293 0 0 1 1.234.231 3.341 3.341 0 0 1 .97.575c.264.22.44.439.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332c-.186.395-.526.746-1.02 1.053a3.167 3.167 0 0 1-1.662.444zm.296-1.482c.626 0 1.152-.214 1.58-.642.428-.44.642-1.01.642-1.711v-.115c0-.472-.098-.894-.296-1.267a2.211 2.211 0 0 0-.807-.872 2.098 2.098 0 0 0-1.119-.313c-.702 0-1.245.231-1.629.692-.384.45-.575 1.037-.575 1.76 0 .736.186 1.333.559 1.795.384.45.933.675 1.645.675zm6.521-6.237h1.711v1.4c.604-1.065 1.547-1.597 2.83-1.597 1.064 0 1.926.34 2.584 1.02.659.67.988 1.641.988 2.914 0 .79-.164 1.487-.493 2.09a3.456 3.456 0 0 1-1.316 1.399 3.51 3.51 0 0 1-1.844.493c-.636 0-1.19-.11-1.662-.329a2.665 2.665 0 0 1-1.086-.97l.017 5.134h-1.728V9.242zm4.048 6.22c.714 0 1.262-.224 1.645-.674.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.395 0-.768.098-1.12.296-.34.187-.613.46-.822.823-.197.351-.296.763-.296 1.234v.115c0 .472.098.894.296 1.267.209.362.483.647.823.855.34.197.713.297 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.159 1.159 0 0 1-.856-.346 1.165 1.165 0 0 1-.346-.856 1.053 1.053 0 0 1 .346-.79c.23-.219.516-.329.856-.329.329 0 .609.11.839.33a1.053 1.053 0 0 1 .345.79 1.159 1.159 0 0 1-.345.855c-.22.23-.5.346-.84.346zm7.875 9.133a3.167 3.167 0 0 1-1.662-.444c-.482-.307-.817-.658-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283c.186-.438.548-.812 1.086-1.119a3.486 3.486 0 0 1 1.778-.477c.746 0 1.393.17 1.942.51a3.235 3.235 0 0 1 1.283 1.4c.297.592.444 1.282.444 2.072 0 .8-.175 1.498-.526 2.09a3.52 3.52 0 0 1-1.382 1.366 3.785 3.785 0 0 1-1.876.477zm-.296-1.481c.713 0 1.26-.225 1.645-.675.384-.46.577-1.053.577-1.778 0-.734-.193-1.327-.577-1.776-.373-.46-.921-.692-1.645-.692a2.115 2.115 0 0 0-1.58.659c-.428.428-.642.992-.642 1.694v.115c0 .473.098.895.296 1.267a2.385 2.385 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481c.176-.505.46-.91.856-1.217a2.14 2.14 0 0 1 1.349-.46c.351 0 .593.032.724.098l-.247 1.794c-.099-.066-.313-.099-.642-.099-.516 0-.988.164-1.416.494-.417.329-.626.855-.626 1.58v3.883h-1.777V9.242zm9.534 7.718c-.9 0-1.651-.175-2.255-.526-.603-.362-1.047-.84-1.332-1.432a4.567 4.567 0 0 1-.428-1.975c0-.8.164-1.502.493-2.106a3.462 3.462 0 0 1 1.4-1.382c.592-.33 1.262-.494 2.007-.494 1.163 0 2.024.324 2.584.97.57.637.856 1.537.856 2.7 0 .296-.017.603-.05.92h-5.43c.12.67.356 1.153.708 1.45.362.296.86.443 1.497.443.526 0 .96-.044 1.3-.131a4.123 4.123 0 0 0 .938-.362l.542 1.267c-.274.175-.647.329-1.119.46-.472.132-1.042.197-1.711.197zm1.596-4.558c.01-.68-.137-1.158-.444-1.432-.307-.285-.746-.428-1.316-.428-1.152 0-1.815.62-1.991 1.86h3.752z'/%3E%3Cg fill-rule='evenodd' stroke-width='1.036'%3E%3Cpath fill='%23000' fill-opacity='.4' d='m8.166 16.146-.002.002a1.54 1.54 0 0 1-2.009 0l-.002-.002-.043-.034-.002-.002-.199-.162H4.377a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659H8.411l-.202.164zm-1.121-.905a.29.29 0 0 0 .113.023.286.286 0 0 0 .189-.07l.077-.063c.634-.508 4.672-3.743 4.672-7.575 0-2.55-2.215-4.625-4.938-4.625S2.221 5.006 2.221 7.556c0 3.225 2.86 6.027 4.144 7.137h.004l.04.038.484.4.077.063a.628.628 0 0 0 .074.047zm-2.52-.548a16.898 16.898 0 0 1-1.183-1.315C2.187 11.942.967 9.897.967 7.555c0-3.319 2.855-5.88 6.192-5.88 3.338 0 6.193 2.561 6.193 5.881 0 2.34-1.22 4.387-2.376 5.822a16.898 16.898 0 0 1-1.182 1.315h.15a1.912 1.912 0 0 1 1.914 1.914v1.84a1.912 1.912 0 0 1-1.914 1.914H4.377a1.912 1.912 0 0 1-1.914-1.914v-1.84a1.912 1.912 0 0 1 1.914-1.914zm3.82-6.935c0 .692-.55 1.222-1.187 1.222s-1.185-.529-1.185-1.222.548-1.222 1.185-1.222c.638 0 1.186.529 1.186 1.222zm-1.186 2.477c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477zm2.048 7.71H5.114v-.838h4.093z'/%3E%3Cpath fill='%23e1e3e9' d='M2.222 7.555c0-2.55 2.214-4.625 4.937-4.625 2.723 0 4.938 2.075 4.938 4.625 0 3.832-4.038 7.068-4.672 7.575l-.077.063a.286.286 0 0 1-.189.07.286.286 0 0 1-.188-.07l-.077-.063c-.634-.507-4.672-3.743-4.672-7.575zm4.937 2.68c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477z'/%3E%3Cpath fill='%23fff' d='M4.377 15.948a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659zm4.83 1.16H5.114v.838h4.093z'/%3E%3C/g%3E%3C/svg%3E")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:hsla(0,0%,100%,.5);margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:hsla(0,0%,100%,.5);background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:rgb(0 0 0/5%)}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (-ms-high-contrast:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}@media screen and (-ms-high-contrast:black-on-white){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}.maplibregl-ctrl-attrib a{color:rgba(0,0,0,.75);text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:hsla(0,0%,100%,.75);border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:rgb(0 0 0/5%)}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px rgba(0,0,0,.35);box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:rgba(0,0,0,.4);color:#fff;display:flex;font-size:1.4em;inset:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(width <= 480px){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999} \ No newline at end of file +.maplibregl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0 0 0/0)}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px rgba(0,0,0,.1)}@media (forced-colors:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (forced-colors:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}.maplibregl-ctrl button:not(:disabled):hover{background-color:rgb(0 0 0/5%)}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23999' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23666' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}}@keyframes maplibregl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (forced-colors:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:hsla(0,0%,100%,.5);margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;color:#000;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:hsla(0,0%,100%,.5);background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:rgb(0 0 0/5%)}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (forced-colors:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}@media screen and (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}.maplibregl-ctrl-attrib a{color:rgba(0,0,0,.75);text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:hsla(0,0%,100%,.75);border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:rgb(0 0 0/5%)}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;transition:opacity .2s;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px rgba(0,0,0,.35);box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:rgba(0,0,0,.4);color:#fff;display:flex;font-size:1.4em;inset:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(width <= 480px){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999} \ No newline at end of file diff --git a/dist/cyclemaps.js b/dist/cyclemaps.js index 02bca56..6334dd2 100644 --- a/dist/cyclemaps.js +++ b/dist/cyclemaps.js @@ -1,3 +1,7 @@ -function t(t,e=5){return`${t.lat.toFixed(e)},${t.lng.toFixed(e)}`}function e(t,e){fetch(t).then((t=>{if(!t.ok)throw new Error(`http error. status: ${t.status}`);return t.text()})).then((t=>(t=t.replaceAll("{CYCLEMAPS_MAPBOX_PUBLIC_ACCESS_TOKEN}","pk.eyJ1IjoiY3ljbGVtYXB1cyIsImEiOiJjanNhbHRlaGMwMGp2NDNqeG80Mzk2cmExIn0.0OBPtvf3KANeaA6QOCk1yw"),JSON.parse(t)))).then(e)}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function i(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var s={exports:{}};s.exports=function(){var t,e,i;function s(s,n){if(t)if(e){var r="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",o={};t(o),i=n(o),"undefined"!=typeof window&&(i.workerUrl=window.URL.createObjectURL(new Blob([r],{type:"text/javascript"})))}else e=n;else t=n}s(["exports"],(function(t){function e(t,e,i,s){return new(i||(i=Promise))((function(n,r){function o(t){try{l(s.next(t))}catch(t){r(t)}}function a(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((s=s.apply(t,e||[])).next())}))}function i(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}"function"==typeof SuppressedError&&SuppressedError;var s=n;function n(t,e){this.x=t,this.y=e}n.prototype={clone:function(){return new n(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),i=Math.sin(t),s=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=s,this},_rotateAround:function(t,e){var i=Math.cos(t),s=Math.sin(t),n=e.y+s*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-s*(this.y-e.y),this.y=n,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t};var r=i(s),o=a;function a(t,e,i,s){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*(s-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=i,this.p2y=s}a.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,s=0;s<8;s++){var n=this.sampleCurveX(i)-t;if(Math.abs(n)n?o=i:a=i,i=.5*(a-o)+o;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var l=i(o);let c,g;function h(){return null==c&&(c="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),c}function u(){if(null==g&&(g=!1,h())){const t=5,e=new OffscreenCanvas(t,t).getContext("2d",{willReadFrequently:!0});if(e){for(let i=0;i(e.y-t.y)*(i.x-t.x)}function w(t){let e=0;for(let i,s,n=0,r=t.length,o=r-1;ncancelAnimationFrame(e)}},getImageData(t,e=0){return this.getImageCanvasContext(t).getImageData(-e,-e,t.width+2*e,t.height+2*e)},getImageCanvasContext(t){const e=window.document.createElement("canvas"),i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return e.width=t.width,e.height=t.height,i.drawImage(t,0,0,t.width,t.height),i},resolveURL:t=>(V||(V=document.createElement("a")),V.href=t,V.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(null==W&&(W=matchMedia("(prefers-reduced-motion: reduce)")),W.matches)}},J={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class M extends Error{constructor(t,e,i,s){super(`AJAXError: ${e} (${t}): ${i}`),this.status=t,this.statusText=e,this.url=i,this.body=s}}const F=S()?()=>self.worker&&self.worker.referrer:()=>("blob:"===window.location.protocol?window.parent:window).location.href,K=t=>J.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))];function L(t,e){const i=new AbortController,s=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:F(),signal:i.signal});let n=!1,r=!1;return"json"===t.type&&s.headers.set("Accept","application/json"),r||fetch(s).then((i=>i.ok?(i=>{("arrayBuffer"===t.type||"image"===t.type?i.arrayBuffer():"json"===t.type?i.json():i.text()).then((t=>{r||(n=!0,e(null,t,i.headers.get("Cache-Control"),i.headers.get("Expires")))})).catch((t=>{r||e(new Error(t.message))}))})(i):i.blob().then((s=>e(new M(i.status,i.statusText,t.url,s)))))).catch((t=>{20!==t.code&&e(new Error(t.message))})),{cancel:()=>{r=!0,n||i.abort()}}}const P=function(t,e){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){if(S()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e);if(!S())return(K(t.url)||L)(t,e)}if(!(/^file:/.test(i=t.url)||/^file:/.test(F())&&!/^\w+:/.test(i))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return L(t,e);if(S()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var i;return function(t,e){const i=new XMLHttpRequest;i.open(t.method||"GET",t.url,!0),"arrayBuffer"!==t.type&&"image"!==t.type||(i.responseType="arraybuffer");for(const e in t.headers)i.setRequestHeader(e,t.headers[e]);return"json"===t.type&&(i.responseType="text",i.setRequestHeader("Accept","application/json")),i.withCredentials="include"===t.credentials,i.onerror=()=>{e(new Error(i.statusText))},i.onload=()=>{if((i.status>=200&&i.status<300||0===i.status)&&null!==i.response){let s=i.response;if("json"===t.type)try{s=JSON.parse(i.response)}catch(t){return e(t)}e(null,s,i.getResponseHeader("Cache-Control"),i.getResponseHeader("Expires"))}else{const s=new Blob([i.response],{type:i.getResponseHeader("Content-Type")});e(new M(i.status,i.statusText,t.url,s))}},i.send(t.body),{cancel:()=>i.abort()}}(t,e)},X=function(t,e){return P(C(t,{type:"arrayBuffer"}),e)};function H(t){if(!t||t.indexOf("://")<=0||0===t.indexOf("data:image/")||0===t.indexOf("blob:"))return!0;const e=new URL(t),i=window.location;return e.protocol===i.protocol&&e.host===i.host}function E(t,e,i){i[t]&&-1!==i[t].indexOf(e)||(i[t]=i[t]||[],i[t].push(e))}function D(t,e,i){if(i&&i[t]){const s=i[t].indexOf(e);-1!==s&&i[t].splice(s,1)}}class Y{constructor(t,e={}){C(this,e),this.type=t}}class N extends Y{constructor(t,e={}){super("error",C({error:t},e))}}class O{on(t,e){return this._listeners=this._listeners||{},E(t,e,this._listeners),this}off(t,e){return D(t,e,this._listeners),D(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},E(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){"string"==typeof t&&(t=new Y(t,e||{}));const i=t.type;if(this.listens(i)){t.target=this;const e=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(const i of e)i.call(this,t);const s=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(const e of s)D(i,e,this._oneTimeListeners),e.call(this,t);const n=this._eventedParent;n&&(C(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),n.fire(t))}else t instanceof N&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}var U={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},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},"*":{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:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"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","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},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}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","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"]},"property-type":"cross-faded"},"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"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},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"}}};const j=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Q(t,e){const i={};for(const e in t)"ref"!==e&&(i[e]=t[e]);return j.forEach((t=>{t in e&&(i[t]=e[t])})),i}function q(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const wt=[ht,ut,dt,pt,mt,At,It,vt(Ct),yt,bt,_t];function St(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!St(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 wt)if(!St(t,e))return null}return`Expected ${xt(t)} but found ${xt(e)} instead.`}function kt(t,e){return e.some((e=>e.kind===t.kind))}function Bt(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 Zt(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const Gt=.96422,Rt=.82521,Tt=4/29,Vt=6/29,Wt=3*Vt*Vt,zt=Vt*Vt*Vt,Jt=Math.PI/180,Mt=180/Math.PI;function Ft(t){return(t%=360)<0&&(t+=360),t}function Kt([t,e,i,s]){let n,r;const o=Pt((.2225045*(t=Lt(t))+.7168786*(e=Lt(e))+.0606169*(i=Lt(i)))/1);t===e&&e===i?n=r=o:(n=Pt((.4360747*t+.3850649*e+.1430804*i)/Gt),r=Pt((.0139322*t+.0971045*e+.7141733*i)/Rt));const a=116*o-16;return[a<0?0:a,500*(n-o),200*(o-r),s]}function Lt(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Pt(t){return t>zt?Math.pow(t,1/3):t/Wt+Tt}function Xt([t,e,i,s]){let n=(t+16)/116,r=isNaN(e)?n:n+e/500,o=isNaN(i)?n:n-i/200;return n=1*Et(n),r=Gt*Et(r),o=Rt*Et(o),[Ht(3.1338561*r-1.6168667*n-.4906146*o),Ht(-.9787684*r+1.9161415*n+.033454*o),Ht(.0719453*r-.2289914*n+1.4052427*o),s]}function Ht(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function Et(t){return t>Vt?t*t*t:Wt*(t-Tt)}function Dt(t){return parseInt(t.padEnd(2,t),16)/255}function Yt(t,e){return Nt(e?t/100:t,0,1)}function Nt(t,e,i){return Math.min(Math.max(e,t),i)}function Ot(t){return!t.some(Number.isNaN)}const Ut={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]};class jt{constructor(t,e,i,s=1,n=!0){this.r=t,this.g=e,this.b=i,this.a=s,n||(this.r*=s,this.g*=s,this.b*=s,s||this.overwriteGetter("rgb",[t,e,i,s]))}static parse(t){if(t instanceof jt)return t;if("string"!=typeof t)return;const e=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];const e=Ut[t];if(e){const[t,i,s]=e;return[t/255,i/255,s/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[Dt(t.slice(i,i+=e)),Dt(t.slice(i,i+=e)),Dt(t.slice(i,i+=e)),Dt(t.slice(i,i+e)||"ff")]}if(t.startsWith("rgb")){const e=t.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(e){const[t,i,s,n,r,o,a,l,c,g,h,u]=e,d=[n||" ",a||" ",g].join("");if(" "===d||" /"===d||",,"===d||",,,"===d){const t=[s,o,c].join(""),e="%%%"===t?100:""===t?255:0;if(e){const t=[Nt(+i/e,0,1),Nt(+r/e,0,1),Nt(+l/e,0,1),h?Yt(+h,u):1];if(Ot(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,s,n,r,o,a,l,c]=i,g=[s||" ",r||" ",a].join("");if(" "===g||" /"===g||",,"===g||",,,"===g){const t=[+e,Nt(+n,0,100),Nt(+o,0,100),l?Yt(+l,c):1];if(Ot(t))return function([t,e,i,s]){function n(s){const n=(s+t/30)%12,r=e*Math.min(i,1-i);return i-r*Math.max(-1,Math.min(n-3,9-n,1))}return t=Ft(t),e/=100,i/=100,[n(0),n(8),n(4),s]}(t)}}}(t);return e?new jt(...e,!1):void 0}get rgb(){const{r:t,g:e,b:i,a:s}=this,n=s||1/0;return this.overwriteGetter("rgb",[t/n,e/n,i/n,s])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,i,s,n]=Kt(t),r=Math.sqrt(i*i+s*s);return[Math.round(1e4*r)?Ft(Math.atan2(s,i)*Mt):NaN,r,e,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Kt(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,i,s]=this.rgb;return`rgba(${[t,e,i].map((t=>Math.round(255*t))).join(",")},${s})`}}jt.black=new jt(0,0,0,1),jt.white=new jt(1,1,1,1),jt.transparent=new jt(0,0,0,0),jt.red=new jt(1,0,0,1);class Qt{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}}class qt{constructor(t,e,i,s,n){this.text=t,this.image=e,this.scale=i,this.fontStack=s,this.textColor=n}}class $t{constructor(t){this.sections=t}static fromString(t){return new $t([new qt(t,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 $t?t:$t.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}}class te{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof te)return t;if("number"==typeof t)return new te([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 te(t)}}toString(){return JSON.stringify(this.values)}}const ee=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class ie{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ie)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===s||"number"==typeof s&&s>=0&&s<=1?null:`Invalid rgba value [${[t,e,i,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof s?[t,e,i,s]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function re(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof jt||t instanceof Qt||t instanceof $t||t instanceof te||t instanceof ie||t instanceof se)return!0;if(Array.isArray(t)){for(const e of t)if(!re(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!re(t[e]))return!1;return!0}return!1}function oe(t){if(null===t)return ht;if("string"==typeof t)return dt;if("boolean"==typeof t)return pt;if("number"==typeof t)return ut;if(t instanceof jt)return mt;if(t instanceof Qt)return ft;if(t instanceof $t)return At;if(t instanceof te)return yt;if(t instanceof ie)return _t;if(t instanceof se)return bt;if(Array.isArray(t)){const e=t.length;let i;for(const e of t){const t=oe(e);if(i){if(i===t)continue;i=Ct;break}i=t}return vt(i||Ct,e)}return It}function ae(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof jt||t instanceof $t||t instanceof te||t instanceof ie||t instanceof se?t.toString():JSON.stringify(t)}class le{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(!re(t[1]))return e.error("invalid value");const i=t[1];let s=oe(i);const n=e.expectedType;return"array"!==s.kind||0!==s.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(s=n),new le(s,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class ce{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const ge={string:dt,number:ut,boolean:pt,object:It};class he{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,s=1;const n=t[0];if("array"===n){let n,r;if(t.length>2){const i=t[1];if("string"!=typeof i||!(i in ge)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);n=ge[i],s++}else n=Ct;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);r=t[2],s++}i=vt(n,r)}else{if(!ge[n])throw new Error(`Types doesn't contain name = ${n}`);i=ge[n]}const r=[];for(;st.outputDefined()))}}const ue={"to-boolean":pt,"to-color":mt,"to-number":ut,"to-string":dt};class de{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(!ue[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 s=ue[i],n=[];for(let i=1;i4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:ne(e[0],e[1],e[2],e[3]),!i))return new jt(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new ce(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 s=te.parse(e);if(s)return s}throw new ce(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"variableAnchorOffsetCollection":{let e;for(const i of this.args){e=i.evaluate(t);const s=ie.parse(e);if(s)return s}throw new ce(`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 s=Number(e);if(!isNaN(s))return s}throw new ce(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return $t.fromString(ae(this.args[0].evaluate(t)));case"resolvedImage":return se.fromString(ae(this.args[0].evaluate(t)));default:return ae(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const pe=["Unknown","Point","LineString","Polygon"];class me{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},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?pe[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[t];return e||(e=this._parseColorCache[t]=jt.parse(t)),e}}class Ie{constructor(t,e,i=[],s,n=new gt,r=[]){this.registry=t,this.path=i,this.key=i.map((t=>`[${t}]`)).join(""),this.scope=n,this.errors=r,this.expectedType=s,this._isConstant=e}parse(t,e,i,s,n={}){return e?this.concat(e,i,s)._parse(t,n):this._parse(t,n)}_parse(t,e){function i(t,e,i){return"assert"===i?new he(e,[t]):"coerce"===i?new de(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 s=t[0];if("string"!=typeof s)return this.error(`Expression name must be a string, but found ${typeof s} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const n=this.registry[s];if(n){let s=n.parse(t,this);if(!s)return null;if(this.expectedType){const t=this.expectedType,n=s.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==n.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==n.kind&&"string"!==n.kind)if("padding"!==t.kind||"value"!==n.kind&&"number"!==n.kind&&"array"!==n.kind)if("variableAnchorOffsetCollection"!==t.kind||"value"!==n.kind&&"array"!==n.kind){if(this.checkSubtype(t,n))return null}else s=i(s,t,e.typeAnnotation||"coerce");else s=i(s,t,e.typeAnnotation||"coerce");else s=i(s,t,e.typeAnnotation||"coerce");else s=i(s,t,e.typeAnnotation||"assert")}if(!(s instanceof le)&&"resolvedImage"!==s.type.kind&&this._isConstant(s)){const e=new me;try{s=new le(s.type,s.evaluate(e))}catch(t){return this.error(t.message),null}}return s}return this.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,i){const s="number"==typeof t?this.path.concat(t):this.path,n=i?this.scope.concat(i):this.scope;return new Ie(this.registry,this._isConstant,s,e||null,n,this.errors)}error(t,...e){const i=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new ct(i,t))}checkSubtype(t,e){const i=St(t,e);return i&&this.error(i),i}}class Ce{constructor(t,e,i){this.type=ft,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 s=e.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,pt);if(!s)return null;const n=e.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,pt);if(!n)return null;let r=null;return i.locale&&(r=e.parse(i.locale,1,dt),!r)?null:new Ce(s,n,r)}evaluate(t){return new Qt(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}}const fe=8192;function Ae(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 ye(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function be(t,e){const i=(180+t[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,n=Math.pow(2,e.z);return[Math.round(i*n*fe),Math.round(s*n*fe)]}function _e(t,e,i){const s=t[0]-e[0],n=t[1]-e[1],r=t[0]-i[0],o=t[1]-i[1];return s*o-r*n==0&&s*r<=0&&n*o<=0}function ve(t,e){let i=!1;for(let o=0,a=e.length;o(s=t)[1]!=(r=a[e+1])[1]>s[1]&&s[0]<(r[0]-n[0])*(s[1]-n[1])/(r[1]-n[1])+n[0]&&(i=!i)}}var s,n,r;return i}function xe(t,e){for(let i=0;i0&&a<0||o<0&&a>0}function Se(t,e,i){for(const c of i)for(let i=0;ii[2]){const e=.5*s;let n=t[0]-i[0]>e?-s:i[0]-t[0]>e?s:0;0===n&&(n=t[0]-i[2]>e?-s:i[2]-t[0]>e?s:0),t[0]+=n}Ae(e,t)}function Te(t,e,i,s){const n=Math.pow(2,s.z)*fe,r=[s.x*fe,s.y*fe],o=[];for(const s of t)for(const t of s){const s=[t.x+r[0],t.y+r[1]];Re(s,e,i,n),o.push(s)}return o}function Ve(t,e,i,s){const n=Math.pow(2,s.z)*fe,r=[s.x*fe,s.y*fe],o=[];for(const i of t){const t=[];for(const s of i){const i=[s.x+r[0],s.y+r[1]];Ae(e,i),t.push(i)}o.push(t)}if(e[2]-e[0]<=n/2){(a=e)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const t of o)for(const s of t)Re(s,e,i,n)}var a;return o}class We{constructor(t,e){this.type=pt,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(re(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t!Array.isArray(e)||e.length===t.length-1));let a=null;for(const[s,r]of o){a=new Ie(e.registry,Me,e.path,null,e.scope);const o=[];let l=!1;for(let e=1;e{return e=t,Array.isArray(e)?`(${e.map(xt).join(", ")})`:`(${xt(e.type)}...)`;var e})).join(" | "),s=[];for(let i=1;i{i=e?i&&Me(t):i&&t instanceof le})),!!i&&Fe(t)&&Le(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Fe(t){if(t instanceof Je){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 We)return!1;let e=!0;return t.eachChild((t=>{e&&!Fe(t)&&(e=!1)})),e}function Ke(t){if(t instanceof Je&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!Ke(t)&&(e=!1)})),e}function Le(t,e){if(t instanceof Je&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild((t=>{i&&!Le(t,e)&&(i=!1)})),i}function Pe(t,e){const i=t.length-1;let s,n,r=0,o=i,a=0;for(;r<=o;)if(a=Math.floor((r+o)/2),s=t[a],n=t[a+1],s<=e){if(a===i||ee))throw new ce("Input is not a number.");o=a-1}return 0}class Xe{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,ut);if(!i)return null;const s=[];let n=null;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(let i=1;i=r)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const c=e.parse(o,l,n);if(!c)return null;n=n||c.type,s.push([r,c])}return new Xe(n,i,s)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const s=this.input.evaluate(t);if(s<=e[0])return i[0].evaluate(t);const n=e.length;return s>=e[n-1]?i[n-1].evaluate(t):i[Pe(e,s)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function He(t,e,i){return t+i*(e-t)}function Ee(t,e,i){return t.map(((t,s)=>He(t,e[s],i)))}const De={number:He,color:function(t,e,i,s="rgb"){switch(s){case"rgb":{const[s,n,r,o]=Ee(t.rgb,e.rgb,i);return new jt(s,n,r,o,!1)}case"hcl":{const[s,n,r,o]=t.hcl,[a,l,c,g]=e.hcl;let h,u;if(isNaN(s)||isNaN(a))isNaN(s)?isNaN(a)?h=NaN:(h=a,1!==r&&0!==r||(u=l)):(h=s,1!==c&&0!==c||(u=n));else{let t=a-s;a>s&&t>180?t-=360:a180&&(t+=360),h=s+i*t}const[d,p,m,I]=function([t,e,i,s]){return t=isNaN(t)?0:t*Jt,Xt([i,Math.cos(t)*e,Math.sin(t)*e,s])}([h,null!=u?u:He(n,l,i),He(r,c,i),He(o,g,i)]);return new jt(d,p,m,I,!1)}case"lab":{const[s,n,r,o]=Xt(Ee(t.lab,e.lab,i));return new jt(s,n,r,o,!1)}}},array:Ee,padding:function(t,e,i){return new te(Ee(t.values,e.values,i))},variableAnchorOffsetCollection:function(t,e,i){const s=t.values,n=e.values;if(s.length!==n.length)throw new ce(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);const r=[];for(let t=0;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);s={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(n=e.parse(n,2,ut),!n)return null;const o=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=mt:e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType);for(let t=0;t=i)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);const c=e.parse(s,l,a);if(!c)return null;a=a||c.type,o.push([i,c])}return Zt(a,ut)||Zt(a,mt)||Zt(a,yt)||Zt(a,_t)||Zt(a,vt(ut))?new Ye(a,i,s,n,o):e.error(`Type ${xt(a)} is not interpolatable.`)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const s=this.input.evaluate(t);if(s<=e[0])return i[0].evaluate(t);const n=e.length;if(s>=e[n-1])return i[n-1].evaluate(t);const r=Pe(e,s),o=Ye.interpolationFactor(this.interpolation,s,e[r],e[r+1]),a=i[r].evaluate(t),l=i[r+1].evaluate(t);switch(this.operator){case"interpolate":return De[this.type.kind](a,l,o);case"interpolate-hcl":return De.color(a,l,o,"hcl");case"interpolate-lab":return De.color(a,l,o,"lab")}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Ne(t,e,i,s){const n=s-i,r=t-i;return 0===n?0:1===e?r/n:(Math.pow(e,r)-1)/(Math.pow(e,n)-1)}class Oe{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expectected at least one argument.");let i=null;const s=e.expectedType;s&&"value"!==s.kind&&(i=s);const n=[];for(const s of t.slice(1)){const t=e.parse(s,1+n.length,i,void 0,{typeAnnotation:"omit"});if(!t)return null;i=i||t.type,n.push(t)}if(!i)throw new Error("No output type");const r=s&&n.some((t=>St(s,t.type)));return new Oe(r?Ct:i,n)}evaluate(t){let e,i=null,s=0;for(const n of this.args)if(s++,i=n.evaluate(t),i&&i instanceof se&&!i.available&&(e||(e=i.name),i=null,s===this.args.length&&(i=e)),null!==i)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}class Ue{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 s=1;s=i.length)throw new ce(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new ce(`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 Qe{constructor(t,e){this.type=pt,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,Ct),s=e.parse(t[2],2,Ct);return i&&s?kt(i.type,[pt,dt,ut,ht,Ct])?new Qe(i,s):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${xt(i.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!Bt(e,["boolean","string","number","null"]))throw new ce(`Expected first argument to be of type boolean, string, number or null, but found ${xt(oe(e))} instead.`);if(!Bt(i,["string","array"]))throw new ce(`Expected second argument to be of type array or string, but found ${xt(oe(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class qe{constructor(t,e,i){this.type=ut,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,Ct),s=e.parse(t[2],2,Ct);if(!i||!s)return null;if(!kt(i.type,[pt,dt,ut,ht,Ct]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${xt(i.type)} instead`);if(4===t.length){const n=e.parse(t[3],3,ut);return n?new qe(i,s,n):null}return new qe(i,s)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!Bt(e,["boolean","string","number","null"]))throw new ce(`Expected first argument to be of type boolean, string, number or null, but found ${xt(oe(e))} instead.`);if(!Bt(i,["string","array"]))throw new ce(`Expected second argument to be of type array or string, but found ${xt(oe(i))} instead.`);if(this.fromIndex){const s=this.fromIndex.evaluate(t);return i.indexOf(e,s)}return i.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class $e{constructor(t,e,i,s,n,r){this.inputType=t,this.type=e,this.input=i,this.cases=s,this.outputs=n,this.otherwise=r}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,s;e.expectedType&&"value"!==e.expectedType.kind&&(s=e.expectedType);const n={},r=[];for(let o=2;oNumber.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return c.error("Numeric branch labels must be integer values.");if(i){if(c.checkSubtype(i,oe(t)))return null}else i=oe(t);if(void 0!==n[String(t)])return c.error("Branch labels must be unique.");n[String(t)]=r.length}const g=e.parse(l,o,s);if(!g)return null;s=s||g.type,r.push(g)}const o=e.parse(t[1],1,Ct);if(!o)return null;const a=e.parse(t[t.length-1],t.length-1,s);return a?"value"!==o.type.kind&&e.concat(1).checkSubtype(i,o.type)?null:new $e(i,s,o,n,r,a):null}evaluate(t){const e=this.input.evaluate(t);return(oe(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 ti{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 s=[];for(let n=1;ne.outputDefined()))&&this.otherwise.outputDefined()}}class ei{constructor(t,e,i,s){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=s}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,Ct),s=e.parse(t[2],2,ut);if(!i||!s)return null;if(!kt(i.type,[vt(Ct),dt,Ct]))return e.error(`Expected first argument to be of type array or string, but found ${xt(i.type)} instead`);if(4===t.length){const n=e.parse(t[3],3,ut);return n?new ei(i.type,i,s,n):null}return new ei(i.type,i,s)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);if(!Bt(e,["string","array"]))throw new ce(`Expected first argument to be of type array or string, but found ${xt(oe(e))} instead.`);if(this.endIndex){const s=this.endIndex.evaluate(t);return e.slice(i,s)}return e.slice(i)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function ii(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 si(t,e,i,s){return 0===s.compare(e,i)}function ni(t,e,i){const s="=="!==t&&"!="!==t;return class n{constructor(t,e,i){this.type=pt,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 r=e.parse(t[1],1,Ct);if(!r)return null;if(!ii(i,r.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${xt(r.type)}'.`);let o=e.parse(t[2],2,Ct);if(!o)return null;if(!ii(i,o.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${xt(o.type)}'.`);if(r.type.kind!==o.type.kind&&"value"!==r.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${xt(r.type)}' and '${xt(o.type)}'.`);s&&("value"===r.type.kind&&"value"!==o.type.kind?r=new he(o.type,[r]):"value"!==r.type.kind&&"value"===o.type.kind&&(o=new he(r.type,[o])));let a=null;if(4===t.length){if("string"!==r.type.kind&&"string"!==o.type.kind&&"value"!==r.type.kind&&"value"!==o.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,ft),!a)return null}return new n(r,o,a)}evaluate(n){const r=this.lhs.evaluate(n),o=this.rhs.evaluate(n);if(s&&this.hasUntypedArgument){const e=oe(r),i=oe(o);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new ce(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${i.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const t=oe(r),i=oe(o);if("string"!==t.kind||"string"!==i.kind)return e(n,r,o)}return this.collator?i(n,r,o,this.collator.evaluate(n)):e(n,r,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const ri=ni("==",(function(t,e,i){return e===i}),si),oi=ni("!=",(function(t,e,i){return e!==i}),(function(t,e,i,s){return!si(0,e,i,s)})),ai=ni("<",(function(t,e,i){return e",(function(t,e,i){return e>i}),(function(t,e,i,s){return s.compare(e,i)>0})),ci=ni("<=",(function(t,e,i){return e<=i}),(function(t,e,i,s){return s.compare(e,i)<=0})),gi=ni(">=",(function(t,e,i){return e>=i}),(function(t,e,i,s){return s.compare(e,i)>=0}));class hi{constructor(t,e,i,s,n){this.type=dt,this.number=t,this.locale=e,this.currency=i,this.minFractionDigits=s,this.maxFractionDigits=n}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,ut);if(!i)return null;const s=t[2];if("object"!=typeof s||Array.isArray(s))return e.error("NumberFormat options argument must be an object.");let n=null;if(s.locale&&(n=e.parse(s.locale,1,dt),!n))return null;let r=null;if(s.currency&&(r=e.parse(s.currency,1,dt),!r))return null;let o=null;if(s["min-fraction-digits"]&&(o=e.parse(s["min-fraction-digits"],1,ut),!o))return null;let a=null;return s["max-fraction-digits"]&&(a=e.parse(s["max-fraction-digits"],1,ut),!a)?null:new hi(i,n,r,o,a)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.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.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class ui{constructor(t){this.type=At,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 s=[];let n=!1;for(let i=1;i<=t.length-1;++i){const r=t[i];if(n&&"object"==typeof r&&!Array.isArray(r)){n=!1;let t=null;if(r["font-scale"]&&(t=e.parse(r["font-scale"],1,ut),!t))return null;let i=null;if(r["text-font"]&&(i=e.parse(r["text-font"],1,vt(dt)),!i))return null;let o=null;if(r["text-color"]&&(o=e.parse(r["text-color"],1,mt),!o))return null;const a=s[s.length-1];a.scale=t,a.font=i,a.textColor=o}else{const r=e.parse(t[i],1,Ct);if(!r)return null;const o=r.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,s.push({content:r,scale:null,font:null,textColor:null})}}return new ui(s)}evaluate(t){return new $t(this.sections.map((e=>{const i=e.content.evaluate(t);return oe(i)===bt?new qt("",i,null,null,null):new qt(ae(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.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)}outputDefined(){return!1}}class di{constructor(t){this.type=bt,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,dt);return i?new di(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=se.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}}class pi{constructor(t){this.type=ut,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 ${xt(i.type)} instead.`):new pi(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 ce(`Expected value to be of type string or array, but found ${xt(oe(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const mi={"==":ri,"!=":oi,">":li,"<":ai,">=":gi,"<=":ci,array:he,at:je,boolean:he,case:ti,coalesce:Oe,collator:Ce,format:ui,image:di,in:Qe,"index-of":qe,interpolate:Ye,"interpolate-hcl":Ye,"interpolate-lab":Ye,length:pi,let:Ue,literal:le,match:$e,number:he,"number-format":hi,object:he,slice:ei,step:Xe,string:he,"to-boolean":de,"to-color":de,"to-number":de,"to-string":de,var:ze,within:We};function Ii(t,[e,i,s,n]){e=e.evaluate(t),i=i.evaluate(t),s=s.evaluate(t);const r=n?n.evaluate(t):1,o=ne(e,i,s,r);if(o)throw new ce(o);return new jt(e/255,i/255,s/255,r,!1)}function Ci(t,e){return t in e}function fi(t,e){const i=e[t];return void 0===i?null:i}function Ai(t){return{type:t}}function yi(t){return{result:"success",value:t}}function bi(t){return{result:"error",value:t}}function _i(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function vi(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function xi(t){return!!t.expression&&t.expression.interpolated}function wi(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Si(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function ki(t){return t}function Bi(t,e){const i="color"===e.type,s=t.stops&&"object"==typeof t.stops[0][0],n=s||!(s||void 0!==t.property),r=t.type||(xi(e)?"exponential":"interval");if(i||"padding"===e.type){const s=i?jt.parse:te.parse;(t=lt({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],s(t[1])]))),t.default=s(t.default?t.default:e.default)}if(t.colorSpace&&"rgb"!==(o=t.colorSpace)&&"hcl"!==o&&"lab"!==o)throw new Error(`Unknown color space: "${t.colorSpace}"`);var o;let a,l,c;if("exponential"===r)a=Ti;else if("interval"===r)a=Ri;else if("categorical"===r){a=Gi,l=Object.create(null);for(const e of t.stops)l[e[0]]=e[1];c=typeof t.stops[0][0]}else{if("identity"!==r)throw new Error(`Unknown function type "${r}"`);a=Vi}if(s){const i={},s=[];for(let e=0;et[0])),evaluate:({zoom:i},s)=>Ti({stops:n,base:t.base},e,i).evaluate(i,s)}}if(n){const i="exponential"===r?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:Ye.interpolationFactor.bind(void 0,i),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:i})=>a(t,e,i,l,c)}}return{kind:"source",evaluate(i,s){const n=s&&s.properties?s.properties[t.property]:void 0;return void 0===n?Zi(t.default,e.default):a(t,e,n,l,c)}}}function Zi(t,e,i){return void 0!==t?t:void 0!==e?e:void 0!==i?i:void 0}function Gi(t,e,i,s,n){return Zi(typeof i===n?s[i]:void 0,t.default,e.default)}function Ri(t,e,i){if("number"!==wi(i))return Zi(t.default,e.default);const s=t.stops.length;if(1===s)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[s-1][0])return t.stops[s-1][1];const n=Pe(t.stops.map((t=>t[0])),i);return t.stops[n][1]}function Ti(t,e,i){const s=void 0!==t.base?t.base:1;if("number"!==wi(i))return Zi(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[n-1][0])return t.stops[n-1][1];const r=Pe(t.stops.map((t=>t[0])),i),o=function(t,e,i,s){const n=s-i,r=t-i;return 0===n?0:1===e?r/n:(Math.pow(e,r)-1)/(Math.pow(e,n)-1)}(i,s,t.stops[r][0],t.stops[r+1][0]),a=t.stops[r][1],l=t.stops[r+1][1],c=De[e.type]||ki;return"function"==typeof a.evaluate?{evaluate(...e){const i=a.evaluate.apply(void 0,e),s=l.evaluate.apply(void 0,e);if(void 0!==i&&void 0!==s)return c(i,s,o,t.colorSpace)}}:c(a,l,o,t.colorSpace)}function Vi(t,e,i){switch(e.type){case"color":i=jt.parse(i);break;case"formatted":i=$t.fromString(i.toString());break;case"resolvedImage":i=se.fromString(i.toString());break;case"padding":i=te.parse(i);break;default:wi(i)===e.type||"enum"===e.type&&e.values[i]||(i=void 0)}return Zi(i,t.default,e.default)}Je.register(mi,{error:[{kind:"error"},[dt],(t,[e])=>{throw new ce(e.evaluate(t))}],typeof:[dt,[Ct],(t,[e])=>xt(oe(e.evaluate(t)))],"to-rgba":[vt(ut,4),[mt],(t,[e])=>{const[i,s,n,r]=e.evaluate(t).rgb;return[255*i,255*s,255*n,r]}],rgb:[mt,[ut,ut,ut],Ii],rgba:[mt,[ut,ut,ut,ut],Ii],has:{type:pt,overloads:[[[dt],(t,[e])=>Ci(e.evaluate(t),t.properties())],[[dt,It],(t,[e,i])=>Ci(e.evaluate(t),i.evaluate(t))]]},get:{type:Ct,overloads:[[[dt],(t,[e])=>fi(e.evaluate(t),t.properties())],[[dt,It],(t,[e,i])=>fi(e.evaluate(t),i.evaluate(t))]]},"feature-state":[Ct,[dt],(t,[e])=>fi(e.evaluate(t),t.featureState||{})],properties:[It,[],t=>t.properties()],"geometry-type":[dt,[],t=>t.geometryType()],id:[Ct,[],t=>t.id()],zoom:[ut,[],t=>t.globals.zoom],"heatmap-density":[ut,[],t=>t.globals.heatmapDensity||0],"line-progress":[ut,[],t=>t.globals.lineProgress||0],accumulated:[Ct,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[ut,Ai(ut),(t,e)=>{let i=0;for(const s of e)i+=s.evaluate(t);return i}],"*":[ut,Ai(ut),(t,e)=>{let i=1;for(const s of e)i*=s.evaluate(t);return i}],"-":{type:ut,overloads:[[[ut,ut],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[ut],(t,[e])=>-e.evaluate(t)]]},"/":[ut,[ut,ut],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[ut,[ut,ut],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[ut,[],()=>Math.LN2],pi:[ut,[],()=>Math.PI],e:[ut,[],()=>Math.E],"^":[ut,[ut,ut],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[ut,[ut],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[ut,[ut],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[ut,[ut],(t,[e])=>Math.log(e.evaluate(t))],log2:[ut,[ut],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[ut,[ut],(t,[e])=>Math.sin(e.evaluate(t))],cos:[ut,[ut],(t,[e])=>Math.cos(e.evaluate(t))],tan:[ut,[ut],(t,[e])=>Math.tan(e.evaluate(t))],asin:[ut,[ut],(t,[e])=>Math.asin(e.evaluate(t))],acos:[ut,[ut],(t,[e])=>Math.acos(e.evaluate(t))],atan:[ut,[ut],(t,[e])=>Math.atan(e.evaluate(t))],min:[ut,Ai(ut),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[ut,Ai(ut),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[ut,[ut],(t,[e])=>Math.abs(e.evaluate(t))],round:[ut,[ut],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[ut,[ut],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[ut,[ut],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[pt,[dt,Ct],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[pt,[Ct],(t,[e])=>t.id()===e.value],"filter-type-==":[pt,[dt],(t,[e])=>t.geometryType()===e.value],"filter-<":[pt,[dt,Ct],(t,[e,i])=>{const s=t.properties()[e.value],n=i.value;return typeof s==typeof n&&s{const i=t.id(),s=e.value;return typeof i==typeof s&&i":[pt,[dt,Ct],(t,[e,i])=>{const s=t.properties()[e.value],n=i.value;return typeof s==typeof n&&s>n}],"filter-id->":[pt,[Ct],(t,[e])=>{const i=t.id(),s=e.value;return typeof i==typeof s&&i>s}],"filter-<=":[pt,[dt,Ct],(t,[e,i])=>{const s=t.properties()[e.value],n=i.value;return typeof s==typeof n&&s<=n}],"filter-id-<=":[pt,[Ct],(t,[e])=>{const i=t.id(),s=e.value;return typeof i==typeof s&&i<=s}],"filter->=":[pt,[dt,Ct],(t,[e,i])=>{const s=t.properties()[e.value],n=i.value;return typeof s==typeof n&&s>=n}],"filter-id->=":[pt,[Ct],(t,[e])=>{const i=t.id(),s=e.value;return typeof i==typeof s&&i>=s}],"filter-has":[pt,[Ct],(t,[e])=>e.value in t.properties()],"filter-has-id":[pt,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[pt,[vt(dt)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[pt,[vt(Ct)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[pt,[dt,vt(Ct)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[pt,[dt,vt(Ct)],(t,[e,i])=>function(t,e,i,s){for(;i<=s;){const n=i+s>>1;if(e[n]===t)return!0;e[n]>t?s=n-1:i=n+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:pt,overloads:[[[pt,pt],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[Ai(pt),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:pt,overloads:[[[pt,pt],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[Ai(pt),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[pt,[pt],(t,[e])=>!e.evaluate(t)],"is-supported-script":[pt,[dt],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[dt,[dt],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[dt,[dt],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[dt,Ai(Ct),(t,e)=>e.map((e=>ae(e.evaluate(t)))).join("")],"resolved-locale":[dt,[ft],(t,[e])=>e.evaluate(t).resolvedLocale()]});class Wi{constructor(t,e){var i;this.expression=t,this._warningHistory={},this._evaluator=new me,this._defaultValue=e?"color"===(i=e).type&&Si(i.default)?new jt(0,0,0,0):"color"===i.type?jt.parse(i.default)||null:"padding"===i.type?te.parse(i.default)||null:"variableAnchorOffsetCollection"===i.type?ie.parse(i.default)||null:void 0===i.default?null:i.default:null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,i,s,n,r){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=s,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=r,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,s,n,r){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=s,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=r||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 ce(`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 zi(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in mi}function Ji(t,e){const i=new Ie(mi,Me,[],e?function(t){const e={color:mt,string:dt,number:ut,enum:dt,boolean:pt,formatted:At,padding:yt,resolvedImage:bt,variableAnchorOffsetCollection:_t};return"array"===t.type?vt(e[t.value]||Ct,t.length):e[t.type]}(e):void 0),s=i.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return s?yi(new Wi(s,e)):bi(i.errors)}class Mi{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Ke(e.expression)}evaluateWithoutErrorHandling(t,e,i,s,n,r){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,s,n,r)}evaluate(t,e,i,s,n,r){return this._styleExpression.evaluate(t,e,i,s,n,r)}}class Fi{constructor(t,e,i,s){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Ke(e.expression),this.interpolationType=s}evaluateWithoutErrorHandling(t,e,i,s,n,r){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,s,n,r)}evaluate(t,e,i,s,n,r){return this._styleExpression.evaluate(t,e,i,s,n,r)}interpolationFactor(t,e,i){return this.interpolationType?Ye.interpolationFactor(this.interpolationType,t,e,i):0}}function Ki(t,e){const i=Ji(t,e);if("error"===i.result)return i;const s=i.value.expression,n=Fe(s);if(!n&&!_i(e))return bi([new ct("","data expressions not supported")]);const r=Le(s,["zoom"]);if(!r&&!vi(e))return bi([new ct("","zoom expressions not supported")]);const o=Pi(s);return o||r?o instanceof ct?bi([o]):o instanceof Ye&&!xi(e)?bi([new ct("",'"interpolate" expressions cannot be used with this property')]):yi(o?new Fi(n?"camera":"composite",i.value,o.labels,o instanceof Ye?o.interpolation:void 0):new Mi(n?"constant":"source",i.value)):bi([new ct("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Li{constructor(t,e){this._parameters=t,this._specification=e,lt(this,Bi(this._parameters,this._specification))}static deserialize(t){return new Li(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Pi(t){let e=null;if(t instanceof Ue)e=Pi(t.result);else if(t instanceof Oe){for(const i of t.args)if(e=Pi(i),e)break}else(t instanceof Xe||t instanceof Ye)&&t.input instanceof Je&&"zoom"===t.input.name&&(e=t);return e instanceof ct||t.eachChild((t=>{const i=Pi(t);i instanceof ct?e=i:!e&&i?e=new ct("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new ct("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function Xi(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(!Xi(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const Hi={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ei(t){if(null==t)return{filter:()=>!0,needGeometry:!1};Xi(t)||(t=Ni(t));const e=Ji(t,Hi);if("error"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return{filter:(t,i,s)=>e.value.evaluate(t,i,{},s),needGeometry:Yi(t)}}function Di(t,e){return te?1:0}function Yi(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e"===e||"<="===e||">="===e?Oi(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map(Ni))):"all"===e?["all"].concat(t.slice(1).map(Ni)):"none"===e?["all"].concat(t.slice(1).map(Ni).map(Qi)):"in"===e?Ui(t[1],t.slice(2)):"!in"===e?Qi(Ui(t[1],t.slice(2))):"has"===e?ji(t[1]):"!has"===e?Qi(ji(t[1])):"within"!==e||t;var i}function Oi(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 Ui(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(Di)]]:["filter-in-small",t,["literal",e]]}}function ji(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Qi(t){return["!",t]}function qi(t){const e=typeof t;if("number"===e||"boolean"===e||"string"===e||null==t)return JSON.stringify(t);if(Array.isArray(t)){let e="[";for(const i of t)e+=`${qi(i)},`;return`${e}]`}const i=Object.keys(t).sort();let s="{";for(let e=0;es.maximum?[new at(e,i,`${i} is greater than the maximum value ${s.maximum}`)]:[]}function os(t){const e=t.valueSpec,i=es(t.value.type);let s,n,r,o={};const a="categorical"!==i&&void 0===t.value.property,l=!a,c="array"===wi(t.value.stops)&&"array"===wi(t.value.stops[0])&&"object"===wi(t.value.stops[0][0]),g=ss({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 at(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const s=t.value;return e=e.concat(ns({key:t.key,value:s,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===wi(s)&&0===s.length&&e.push(new at(t.key,s,"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&&g.push(new at(t.key,t.value,'missing required property "property"')),"identity"===i||t.value.stops||g.push(new at(t.key,t.value,'missing required property "stops"')),"exponential"===i&&t.valueSpec.expression&&!xi(t.valueSpec)&&g.push(new at(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!_i(t.valueSpec)?g.push(new at(t.key,t.value,"property functions not supported")):a&&!vi(t.valueSpec)&&g.push(new at(t.key,t.value,"zoom functions not supported"))),"categorical"!==i&&!c||void 0!==t.value.property||g.push(new at(t.key,t.value,'"property" property is required')),g;function h(t){let i=[];const s=t.value,a=t.key;if("array"!==wi(s))return[new at(a,s,`array expected, ${wi(s)} found`)];if(2!==s.length)return[new at(a,s,`array length 2 expected, length ${s.length} found`)];if(c){if("object"!==wi(s[0]))return[new at(a,s,`object expected, ${wi(s[0])} found`)];if(void 0===s[0].zoom)return[new at(a,s,"object stop key must have zoom")];if(void 0===s[0].value)return[new at(a,s,"object stop key must have value")];if(r&&r>es(s[0].zoom))return[new at(a,s[0].zoom,"stop zoom values must appear in ascending order")];es(s[0].zoom)!==r&&(r=es(s[0].zoom),n=void 0,o={}),i=i.concat(ss({key:`${a}[0]`,value:s[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:rs,value:u}}))}else i=i.concat(u({key:`${a}[0]`,value:s[0],valueSpec:{},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},s));return zi(is(s[1]))?i.concat([new at(`${a}[1]`,s[1],"expressions are not allowed in function stops.")]):i.concat(t.validateSpec({key:`${a}[1]`,value:s[1],valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function u(t,r){const a=wi(t.value),l=es(t.value),c=null!==t.value?t.value:r;if(s){if(a!==s)return[new at(t.key,c,`${a} stop domain type must match previous stop domain type ${s}`)]}else s=a;if("number"!==a&&"string"!==a&&"boolean"!==a)return[new at(t.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==i){let s=`number expected, ${a} found`;return _i(e)&&void 0===i&&(s+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new at(t.key,c,s)]}return"categorical"!==i||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===a&&void 0!==n&&lnew at(`${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 at(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&&!Ke(i))return[new at(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!Ke(i))return[new at(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!Le(i,["zoom","feature-state"]))return[new at(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Fe(i))return[new at(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ls(t){const e=t.key,i=t.value,s=t.valueSpec,n=[];return Array.isArray(s.values)?-1===s.values.indexOf(es(i))&&n.push(new at(e,i,`expected one of [${s.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(s.values).indexOf(es(i))&&n.push(new at(e,i,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(i)} found`)),n}function cs(t){return Xi(is(t.value))?as(lt({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):gs(t)}function gs(t){const e=t.value,i=t.key;if("array"!==wi(e))return[new at(i,e,`array expected, ${wi(e)} found`)];const s=t.styleSpec;let n,r=[];if(e.length<1)return[new at(i,e,"filter array must have at least 1 element")];switch(r=r.concat(ls({key:`${i}[0]`,value:e[0],valueSpec:s.filter_operator,style:t.style,styleSpec:t.styleSpec})),es(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===es(e[1])&&r.push(new at(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&r.push(new at(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(n=wi(e[1]),"string"!==n&&r.push(new at(`${i}[1]`,e[1],`string expected, ${n} found`)));for(let o=2;o{t in i&&e.push(new at(s,i[t],`"${t}" is prohibited for ref layers`))})),n.layers.forEach((e=>{es(e.id)===a&&(t=e)})),t?t.ref?e.push(new at(s,i.ref,"ref cannot reference another ref layer")):o=es(t.type):e.push(new at(s,i.ref,`ref layer "${a}" not found`))}else if("background"!==o)if(i.source){const t=n.sources&&n.sources[i.source],r=t&&es(t.type);t?"vector"===r&&"raster"===o?e.push(new at(s,i.source,`layer "${i.id}" requires a raster source`)):"raster-dem"!==r&&"hillshade"===o?e.push(new at(s,i.source,`layer "${i.id}" requires a raster-dem source`)):"raster"===r&&"raster"!==o?e.push(new at(s,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==r||i["source-layer"]?"raster-dem"===r&&"hillshade"!==o?e.push(new at(s,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==o||!i.paint||!i.paint["line-gradient"]||"geojson"===r&&t.lineMetrics||e.push(new at(s,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new at(s,i,`layer "${i.id}" must specify a "source-layer"`)):e.push(new at(s,i.source,`source "${i.source}" not found`))}else e.push(new at(s,i,'missing required property "source"'));return e=e.concat(ss({key:s,value:i,valueSpec:r.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${s}.type`,value:i.type,valueSpec:r.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:i,objectKey:"type"}),filter:cs,layout:t=>ss({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>ds(lt({layerType:o},t))}}),paint:t=>ss({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>us(lt({layerType:o},t))}})}})),e}function ms(t){const e=t.value,i=t.key,s=wi(e);return"string"!==s?[new at(i,e,`string expected, ${s} found`)]:[]}const Is={promoteId:function({key:t,value:e}){if("string"===wi(e))return ms({key:t,value:e});{const i=[];for(const s in e)i.push(...ms({key:`${t}.${s}`,value:e[s]}));return i}}};function Cs(t){const e=t.value,i=t.key,s=t.styleSpec,n=t.style,r=t.validateSpec;if(!e.type)return[new at(i,e,'"type" is required')];const o=es(e.type);let a;switch(o){case"vector":case"raster":return a=ss({key:i,value:e,valueSpec:s[`source_${o.replace("-","_")}`],style:t.style,styleSpec:s,objectElementValidators:Is,validateSpec:r}),a;case"raster-dem":return a=function(t){var e;const i=null!==(e=t.sourceName)&&void 0!==e?e:"",s=t.value,n=t.styleSpec,r=n.source_raster_dem,o=t.style;let a=[];const l=wi(s);if(void 0===s)return a;if("object"!==l)return a.push(new at("source_raster_dem",s,`object expected, ${l} found`)),a;const c="custom"===es(s.encoding),g=["redFactor","greenFactor","blueFactor","baseShift"],h=t.value.encoding?`"${t.value.encoding}"`:"Default";for(const e in s)!c&&g.includes(e)?a.push(new at(e,s[e],`In "${i}": "${e}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):r[e]?a=a.concat(t.validateSpec({key:e,value:s[e],valueSpec:r[e],validateSpec:t.validateSpec,style:o,styleSpec:n})):a.push(new at(e,s[e],`unknown property "${e}"`));return a}({sourceName:i,value:e,style:t.style,styleSpec:s,validateSpec:r}),a;case"geojson":if(a=ss({key:i,value:e,valueSpec:s.source_geojson,style:n,styleSpec:s,validateSpec:r,objectElementValidators:Is}),e.cluster)for(const t in e.clusterProperties){const[s,n]=e.clusterProperties[t],o="string"==typeof s?[s,["accumulated"],["get",t]]:s;a.push(...as({key:`${i}.${t}.map`,value:n,validateSpec:r,expressionContext:"cluster-map"})),a.push(...as({key:`${i}.${t}.reduce`,value:o,validateSpec:r,expressionContext:"cluster-reduce"}))}return a;case"video":return ss({key:i,value:e,valueSpec:s.source_video,style:n,validateSpec:r,styleSpec:s});case"image":return ss({key:i,value:e,valueSpec:s.source_image,style:n,validateSpec:r,styleSpec:s});case"canvas":return[new at(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ls({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:n,validateSpec:r,styleSpec:s})}}function fs(t){const e=t.value,i=t.styleSpec,s=i.light,n=t.style;let r=[];const o=wi(e);if(void 0===e)return r;if("object"!==o)return r=r.concat([new at("light",e,`object expected, ${o} found`)]),r;for(const o in e){const a=o.match(/^(.*)-transition$/);r=r.concat(a&&s[a[1]]&&s[a[1]].transition?t.validateSpec({key:o,value:e[o],valueSpec:i.transition,validateSpec:t.validateSpec,style:n,styleSpec:i}):s[o]?t.validateSpec({key:o,value:e[o],valueSpec:s[o],validateSpec:t.validateSpec,style:n,styleSpec:i}):[new at(o,e[o],`unknown property "${o}"`)])}return r}function As(t){const e=t.value,i=t.styleSpec,s=i.terrain,n=t.style;let r=[];const o=wi(e);if(void 0===e)return r;if("object"!==o)return r=r.concat([new at("terrain",e,`object expected, ${o} found`)]),r;for(const o in e)r=r.concat(s[o]?t.validateSpec({key:o,value:e[o],valueSpec:s[o],validateSpec:t.validateSpec,style:n,styleSpec:i}):[new at(o,e[o],`unknown property "${o}"`)]);return r}function ys(t){let e=[];const i=t.value,s=t.key;if(Array.isArray(i)){const n=[],r=[];for(const o in i)i[o].id&&n.includes(i[o].id)&&e.push(new at(s,i,`all the sprites' ids must be unique, but ${i[o].id} is duplicated`)),n.push(i[o].id),i[o].url&&r.includes(i[o].url)&&e.push(new at(s,i,`all the sprites' URLs must be unique, but ${i[o].url} is duplicated`)),r.push(i[o].url),e=e.concat(ss({key:`${s}[${o}]`,value:i[o],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return e}return ms({key:s,value:i})}const bs={"*":()=>[],array:ns,boolean:function(t){const e=t.value,i=t.key,s=wi(e);return"boolean"!==s?[new at(i,e,`boolean expected, ${s} found`)]:[]},number:rs,color:function(t){const e=t.key,i=t.value,s=wi(i);return"string"!==s?[new at(e,i,`color expected, ${s} found`)]:jt.parse(String(i))?[]:[new at(e,i,`color expected, "${i}" found`)]},constants:ts,enum:ls,filter:cs,function:os,layer:ps,object:ss,source:Cs,light:fs,terrain:As,string:ms,formatted:function(t){return 0===ms(t).length?[]:as(t)},resolvedImage:function(t){return 0===ms(t).length?[]:as(t)},padding:function(t){const e=t.key,i=t.value;if("array"===wi(i)){if(i.length<1||i.length>4)return[new at(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];const s={type:"number"};let n=[];for(let r=0;r[]}})),t.constants&&(i=i.concat(ts({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:_s}))),Ss(i)}function ws(t){return function(e){return t({...e,validateSpec:_s})}}function Ss(t){return[].concat(t).sort(((t,e)=>t.line-e.line))}function ks(t){return function(...e){return Ss(t.apply(this,e))}}xs.source=ks(ws(Cs)),xs.sprite=ks(ws(ys)),xs.glyphs=ks(ws(vs)),xs.light=ks(ws(fs)),xs.terrain=ks(ws(As)),xs.layer=ks(ws(ps)),xs.filter=ks(ws(cs)),xs.paintProperty=ks(ws(us)),xs.layoutProperty=ks(ws(ds));const Bs=xs,Zs=Bs.light,Gs=Bs.paintProperty,Rs=Bs.layoutProperty;function Ts(t,e){let i=!1;if(e&&e.length)for(const s of e)t.fire(new N(new Error(s.message))),i=!0;return i}class Vs{constructor(t,e,i){const s=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const n=new Int32Array(this.arrayBuffer);t=n[0],this.d=(e=n[1])+2*(i=n[2]);for(let t=0;t=c[l+0]&&s>=c[l+1])?(o[h]=!0,r.push(n[h])):o[h]=!1}}}}_forEachCell(t,e,i,s,n,r,o,a){const l=this._convertToCellCoord(t),c=this._convertToCellCoord(e),g=this._convertToCellCoord(i),h=this._convertToCellCoord(s);for(let u=l;u<=g;u++)for(let l=c;l<=h;l++){const c=this.d*l+u;if((!a||a(this._convertFromCellCoord(u),this._convertFromCellCoord(l),this._convertFromCellCoord(u+1),this._convertFromCellCoord(l+1)))&&n.call(this,t,e,i,s,c,r,o,a))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,e=3+this.cells.length+1+1;let i=0;for(let t=0;t=0)continue;const r=t[i];n[i]=Ws[s].shallow.indexOf(i)>=0?r:Ms(r,e)}t instanceof Error&&(n.message=t.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==s&&(n.$name=s),n}throw new Error("can't serialize object of type "+typeof t)}function Fs(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||Js(t)||B(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(Fs);if("object"==typeof t){const e=t.$name||"Object";if(!Ws[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:i}=Ws[e];if(!i)throw new Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(t);const s=Object.create(i.prototype);for(const i of Object.keys(t)){if("$name"===i)continue;const n=t[i];s[i]=Ws[e].shallow.indexOf(i)>=0?n:Fs(n)}return s}throw new Error("can't deserialize object of type "+typeof t)}class Ks{constructor(){this.first=!0}update(t,e){const i=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=e):this.lastFloorZoomt>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function Ps(t){for(const e of t)if(Es(e.charCodeAt(0)))return!0;return!1}function Xs(t){for(const e of t)if(!Hs(e.charCodeAt(0)))return!1;return!0}function Hs(t){return!(Ls.Arabic(t)||Ls["Arabic Supplement"](t)||Ls["Arabic Extended-A"](t)||Ls["Arabic Presentation Forms-A"](t)||Ls["Arabic Presentation Forms-B"](t))}function Es(t){return!(746!==t&&747!==t&&(t<4352||!(Ls["Bopomofo Extended"](t)||Ls.Bopomofo(t)||Ls["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||Ls["CJK Compatibility Ideographs"](t)||Ls["CJK Compatibility"](t)||Ls["CJK Radicals Supplement"](t)||Ls["CJK Strokes"](t)||!(!Ls["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Ls["CJK Unified Ideographs Extension A"](t)||Ls["CJK Unified Ideographs"](t)||Ls["Enclosed CJK Letters and Months"](t)||Ls["Hangul Compatibility Jamo"](t)||Ls["Hangul Jamo Extended-A"](t)||Ls["Hangul Jamo Extended-B"](t)||Ls["Hangul Jamo"](t)||Ls["Hangul Syllables"](t)||Ls.Hiragana(t)||Ls["Ideographic Description Characters"](t)||Ls.Kanbun(t)||Ls["Kangxi Radicals"](t)||Ls["Katakana Phonetic Extensions"](t)||Ls.Katakana(t)&&12540!==t||!(!Ls["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Ls["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Ls["Unified Canadian Aboriginal Syllabics"](t)||Ls["Unified Canadian Aboriginal Syllabics Extended"](t)||Ls["Vertical Forms"](t)||Ls["Yijing Hexagram Symbols"](t)||Ls["Yi Syllables"](t)||Ls["Yi Radicals"](t))))}function Ds(t){return!(Es(t)||function(t){return!!(Ls["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||Ls["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||Ls["Letterlike Symbols"](t)||Ls["Number Forms"](t)||Ls["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||Ls["Control Pictures"](t)&&9251!==t||Ls["Optical Character Recognition"](t)||Ls["Enclosed Alphanumerics"](t)||Ls["Geometric Shapes"](t)||Ls["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Ls["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Ls["CJK Symbols and Punctuation"](t)||Ls.Katakana(t)||Ls["Private Use Area"](t)||Ls["CJK Compatibility Forms"](t)||Ls["Small Form Variants"](t)||Ls["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Ys(t){return t>=1424&&t<=2303||Ls["Arabic Presentation Forms-A"](t)||Ls["Arabic Presentation Forms-B"](t)}function Ns(t,e){return!(!e&&Ys(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Ls.Khmer(t))}function Os(t){for(const e of t)if(Ys(e.charCodeAt(0)))return!0;return!1}const Us="deferred",js="loading",Qs="loaded";let qs=null,$s="unavailable",tn=null;const en=function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&($s="error"),qs&&qs(t)};function sn(){nn.fire(new Y("pluginStateChange",{pluginStatus:$s,pluginURL:tn}))}const nn=new O,rn=function(){return $s},on=function(){if($s!==Us||!tn)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");$s=js,sn(),tn&&X({url:tn},(t=>{t?en(t):($s=Qs,sn())}))},an={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>$s===Qs||null!=an.applyArabicShaping,isLoading:()=>$s===js,setState(t){if(!S())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");$s=t.pluginStatus,tn=t.pluginURL},isParsed(){if(!S())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return null!=an.applyArabicShaping&&null!=an.processBidirectionalText&&null!=an.processStyledBidirectionalText},getPluginURL(){if(!S())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return tn}};class ln{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ks,this.transition={})}isSupportedScript(t){return function(t,e){for(const i of t)if(!Ns(i.charCodeAt(0),e))return!1;return!0}(t,an.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),i=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*e}}}class cn{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Si(t))return new Li(t,e);if(zi(t)){const i=Ki(t,e);if("error"===i.result)throw new Error(i.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return i.value}{let i=t;return"color"===e.type&&"string"==typeof t?i=jt.parse(t):"padding"!==e.type||"number"!=typeof t&&!Array.isArray(t)?"variableAnchorOffsetCollection"===e.type&&Array.isArray(t)&&(i=ie.parse(t)):i=te.parse(t),{kind:"constant",evaluate:()=>i}}}(void 0===e?t.specification.default:e,t.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,i){return this.property.possiblyEvaluate(this,t,e,i)}}class gn{constructor(t){this.property=t,this.value=new cn(t,void 0)}transitioned(t,e){return new un(this.property,this.value,e,C({},t.transition,this.transition),t.now)}untransitioned(){return new un(this.property,this.value,null,{},0)}}class hn{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return b(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new gn(this._values[t].property)),this._values[t].value=new cn(this._values[t].property,null===e?void 0:b(e))}getTransition(t){return b(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new gn(this._values[t].property)),this._values[t].transition=b(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const i=this.getValue(e);void 0!==i&&(t[e]=i);const s=this.getTransition(e);void 0!==s&&(t[`${e}-transition`]=s)}return t}transitioned(t,e){const i=new dn(this._properties);for(const s of Object.keys(this._values))i._values[s]=this._values[s].transitioned(t,e._values[s]);return i}untransitioned(){const t=new dn(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class un{constructor(t,e,i,s,n){this.property=t,this.value=e,this.begin=n+s.delay||0,this.end=this.begin+s.duration||0,t.specification.transition&&(s.delay||s.duration)&&(this.prior=i)}possiblyEvaluate(t,e,i){const s=t.now||0,n=this.value.possiblyEvaluate(t,e,i),r=this.prior;if(r){if(s>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(s=1)return 1;const e=t*t,i=e*t;return 4*(t<.5?i:3*(t-e)+i-.75)}(o))}}return n}}class dn{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,i){const s=new In(this._properties);for(const n of Object.keys(this._values))s._values[n]=this._values[n].possiblyEvaluate(t,e,i);return s}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class pn{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return void 0!==this._values[t].value}getValue(t){return b(this._values[t].value)}setValue(t,e){this._values[t]=new cn(this._values[t].property,null===e?void 0:b(e))}serialize(){const t={};for(const e of Object.keys(this._values)){const i=this.getValue(e);void 0!==i&&(t[e]=i)}return t}possiblyEvaluate(t,e,i){const s=new In(this._properties);for(const n of Object.keys(this._values))s._values[n]=this._values[n].possiblyEvaluate(t,e,i);return s}}class mn{constructor(t,e,i){this.property=t,this.value=e,this.parameters=i}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,e,i,s){return this.property.evaluate(this.value,this.parameters,t,e,i,s)}}class In{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Cn{constructor(t){this.specification=t}possiblyEvaluate(t,e){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(e)}interpolate(t,e,i){const s=De[this.specification.type];return s?s(t,e,i):t}}class fn{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,i,s){return new mn(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},i,s)}:t.expression,e)}interpolate(t,e,i){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new mn(this,{kind:"constant",value:void 0},t.parameters);const s=De[this.specification.type];if(s){const n=s(t.value.value,e.value.value,i);return new mn(this,{kind:"constant",value:n},t.parameters)}return t}evaluate(t,e,i,s,n,r){return"constant"===t.kind?t.value:t.evaluate(e,i,s,n,r)}}class An extends fn{possiblyEvaluate(t,e,i,s){if(void 0===t.value)return new mn(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const n=t.expression.evaluate(e,null,{},i,s),r="resolvedImage"===t.property.specification.type&&"string"!=typeof n?n.name:n,o=this._calculate(r,r,r,e);return new mn(this,{kind:"constant",value:o},e)}if("camera"===t.expression.kind){const i=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new mn(this,{kind:"constant",value:i},e)}return new mn(this,t.expression,e)}evaluate(t,e,i,s,n,r){if("source"===t.kind){const o=t.evaluate(e,i,s,n,r);return this._calculate(o,o,o,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},i,s),t.evaluate({zoom:Math.floor(e.zoom)},i,s),t.evaluate({zoom:Math.floor(e.zoom)+1},i,s),e):t.value}_calculate(t,e,i,s){return s.zoom>s.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class yn{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,s){if(void 0!==t.value){if("constant"===t.expression.kind){const n=t.expression.evaluate(e,null,{},i,s);return this._calculate(n,n,n,e)}return this._calculate(t.expression.evaluate(new ln(Math.floor(e.zoom-1),e)),t.expression.evaluate(new ln(Math.floor(e.zoom),e)),t.expression.evaluate(new ln(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,i,s){return s.zoom>s.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class bn{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,s){return!!t.expression.evaluate(e,null,{},i,s)}interpolate(){return!1}}class _n{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const i=t[e];i.specification.overridable&&this.overridableProperties.push(e);const s=this.defaultPropertyValues[e]=new cn(i,void 0),n=this.defaultTransitionablePropertyValues[e]=new gn(i);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=s.possiblyEvaluate({})}}}zs("DataDrivenProperty",fn),zs("DataConstantProperty",Cn),zs("CrossFadedDataDrivenProperty",An),zs("CrossFadedProperty",yn),zs("ColorRampProperty",bn);const vn="-transition";class xn extends O{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==t.type&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),e.layout&&(this._unevaluatedLayout=new pn(e.layout)),e.paint)){this._transitionablePaint=new hn(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new In(e.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,i={}){null!=e&&this._validate(Rs,`layers.${this.id}.layout.${t}`,t,e,i)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return t.endsWith(vn)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,i={}){if(null!=e&&this._validate(Gs,`layers.${this.id}.paint.${t}`,t,e,i))return!1;if(t.endsWith(vn))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{const i=this._transitionablePaint._values[t],s="cross-faded-data-driven"===i.property.specification["property-type"],n=i.value.isDataDriven(),r=i.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const o=this._transitionablePaint._values[t].value;return o.isDataDriven()||n||s||this._handleOverridablePaintPropertyUpdate(t,r,o)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,i){return!1}isHidden(t){return!!(this.minzoom&&t=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),y(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,i,s,n={}){return(!n||!1!==n.validate)&&Ts(this,t.call(Bs,{key:e,layerType:this.type,objectKey:i,value:s,styleSpec:U,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof mn&&_i(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}}const wn={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Sn{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class kn{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Bn(t,e=1){let i=0,s=0;return{members:t.map((t=>{const n=wn[t.type].BYTES_PER_ELEMENT,r=i=Zn(i,Math.max(e,n)),o=t.components||1;return s=Math.max(s,n),i+=n*o,{name:t.name,type:t.type,components:o,offset:r}})),size:Zn(i,Math.max(s,e)),alignment:e}}function Zn(t,e){return Math.ceil(t/e)*e}class Gn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const s=2*t;return this.int16[s+0]=e,this.int16[s+1]=i,t}}Gn.prototype.bytesPerElement=4,zs("StructArrayLayout2i4",Gn);class Rn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,i)}emplace(t,e,i,s){const n=3*t;return this.int16[n+0]=e,this.int16[n+1]=i,this.int16[n+2]=s,t}}Rn.prototype.bytesPerElement=6,zs("StructArrayLayout3i6",Rn);class Tn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,s){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,s)}emplace(t,e,i,s,n){const r=4*t;return this.int16[r+0]=e,this.int16[r+1]=i,this.int16[r+2]=s,this.int16[r+3]=n,t}}Tn.prototype.bytesPerElement=8,zs("StructArrayLayout4i8",Tn);class Vn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,s,n,r){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,s,n,r)}emplace(t,e,i,s,n,r,o){const a=6*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.int16[a+2]=s,this.int16[a+3]=n,this.int16[a+4]=r,this.int16[a+5]=o,t}}Vn.prototype.bytesPerElement=12,zs("StructArrayLayout2i4i12",Vn);class Wn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,s,n,r){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,s,n,r)}emplace(t,e,i,s,n,r,o){const a=4*t,l=8*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.uint8[l+4]=s,this.uint8[l+5]=n,this.uint8[l+6]=r,this.uint8[l+7]=o,t}}Wn.prototype.bytesPerElement=8,zs("StructArrayLayout2i4ub8",Wn);class zn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const s=2*t;return this.float32[s+0]=e,this.float32[s+1]=i,t}}zn.prototype.bytesPerElement=8,zs("StructArrayLayout2f8",zn);class Jn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,s,n,r,o,a,l,c){const g=this.length;return this.resize(g+1),this.emplace(g,t,e,i,s,n,r,o,a,l,c)}emplace(t,e,i,s,n,r,o,a,l,c,g){const h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=i,this.uint16[h+2]=s,this.uint16[h+3]=n,this.uint16[h+4]=r,this.uint16[h+5]=o,this.uint16[h+6]=a,this.uint16[h+7]=l,this.uint16[h+8]=c,this.uint16[h+9]=g,t}}Jn.prototype.bytesPerElement=20,zs("StructArrayLayout10ui20",Jn);class Mn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,s,n,r,o,a,l,c,g,h){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,i,s,n,r,o,a,l,c,g,h)}emplace(t,e,i,s,n,r,o,a,l,c,g,h,u){const d=12*t;return this.int16[d+0]=e,this.int16[d+1]=i,this.int16[d+2]=s,this.int16[d+3]=n,this.uint16[d+4]=r,this.uint16[d+5]=o,this.uint16[d+6]=a,this.uint16[d+7]=l,this.int16[d+8]=c,this.int16[d+9]=g,this.int16[d+10]=h,this.int16[d+11]=u,t}}Mn.prototype.bytesPerElement=24,zs("StructArrayLayout4i4ui4i24",Mn);class Fn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,i)}emplace(t,e,i,s){const n=3*t;return this.float32[n+0]=e,this.float32[n+1]=i,this.float32[n+2]=s,t}}Fn.prototype.bytesPerElement=12,zs("StructArrayLayout3f12",Fn);class Kn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}Kn.prototype.bytesPerElement=4,zs("StructArrayLayout1ul4",Kn);class Ln extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,s,n,r,o,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,i,s,n,r,o,a,l)}emplace(t,e,i,s,n,r,o,a,l,c){const g=10*t,h=5*t;return this.int16[g+0]=e,this.int16[g+1]=i,this.int16[g+2]=s,this.int16[g+3]=n,this.int16[g+4]=r,this.int16[g+5]=o,this.uint32[h+3]=a,this.uint16[g+8]=l,this.uint16[g+9]=c,t}}Ln.prototype.bytesPerElement=20,zs("StructArrayLayout6i1ul2ui20",Ln);class Pn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,s,n,r){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,s,n,r)}emplace(t,e,i,s,n,r,o){const a=6*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.int16[a+2]=s,this.int16[a+3]=n,this.int16[a+4]=r,this.int16[a+5]=o,t}}Pn.prototype.bytesPerElement=12,zs("StructArrayLayout2i2i2i12",Pn);class Xn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,s,n){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i,s,n)}emplace(t,e,i,s,n,r){const o=4*t,a=8*t;return this.float32[o+0]=e,this.float32[o+1]=i,this.float32[o+2]=s,this.int16[a+6]=n,this.int16[a+7]=r,t}}Xn.prototype.bytesPerElement=16,zs("StructArrayLayout2f1f2i16",Xn);class Hn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,s){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,s)}emplace(t,e,i,s,n){const r=12*t,o=3*t;return this.uint8[r+0]=e,this.uint8[r+1]=i,this.float32[o+1]=s,this.float32[o+2]=n,t}}Hn.prototype.bytesPerElement=12,zs("StructArrayLayout2ub2f12",Hn);class En extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,i)}emplace(t,e,i,s){const n=3*t;return this.uint16[n+0]=e,this.uint16[n+1]=i,this.uint16[n+2]=s,t}}En.prototype.bytesPerElement=6,zs("StructArrayLayout3ui6",En);class Dn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,s,n,r,o,a,l,c,g,h,u,d,p,m,I){const C=this.length;return this.resize(C+1),this.emplace(C,t,e,i,s,n,r,o,a,l,c,g,h,u,d,p,m,I)}emplace(t,e,i,s,n,r,o,a,l,c,g,h,u,d,p,m,I,C){const f=24*t,A=12*t,y=48*t;return this.int16[f+0]=e,this.int16[f+1]=i,this.uint16[f+2]=s,this.uint16[f+3]=n,this.uint32[A+2]=r,this.uint32[A+3]=o,this.uint32[A+4]=a,this.uint16[f+10]=l,this.uint16[f+11]=c,this.uint16[f+12]=g,this.float32[A+7]=h,this.float32[A+8]=u,this.uint8[y+36]=d,this.uint8[y+37]=p,this.uint8[y+38]=m,this.uint32[A+10]=I,this.int16[f+22]=C,t}}Dn.prototype.bytesPerElement=48,zs("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Dn);class Yn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,s,n,r,o,a,l,c,g,h,u,d,p,m,I,C,f,A,y,b,_,v,x,w,S,k){const B=this.length;return this.resize(B+1),this.emplace(B,t,e,i,s,n,r,o,a,l,c,g,h,u,d,p,m,I,C,f,A,y,b,_,v,x,w,S,k)}emplace(t,e,i,s,n,r,o,a,l,c,g,h,u,d,p,m,I,C,f,A,y,b,_,v,x,w,S,k,B){const Z=32*t,G=16*t;return this.int16[Z+0]=e,this.int16[Z+1]=i,this.int16[Z+2]=s,this.int16[Z+3]=n,this.int16[Z+4]=r,this.int16[Z+5]=o,this.int16[Z+6]=a,this.int16[Z+7]=l,this.uint16[Z+8]=c,this.uint16[Z+9]=g,this.uint16[Z+10]=h,this.uint16[Z+11]=u,this.uint16[Z+12]=d,this.uint16[Z+13]=p,this.uint16[Z+14]=m,this.uint16[Z+15]=I,this.uint16[Z+16]=C,this.uint16[Z+17]=f,this.uint16[Z+18]=A,this.uint16[Z+19]=y,this.uint16[Z+20]=b,this.uint16[Z+21]=_,this.uint16[Z+22]=v,this.uint32[G+12]=x,this.float32[G+13]=w,this.float32[G+14]=S,this.uint16[Z+30]=k,this.uint16[Z+31]=B,t}}Yn.prototype.bytesPerElement=64,zs("StructArrayLayout8i15ui1ul2f2ui64",Yn);class Nn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}Nn.prototype.bytesPerElement=4,zs("StructArrayLayout1f4",Nn);class On extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,i)}emplace(t,e,i,s){const n=3*t;return this.uint16[6*t+0]=e,this.float32[n+1]=i,this.float32[n+2]=s,t}}On.prototype.bytesPerElement=12,zs("StructArrayLayout1ui2f12",On);class Un extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,i)}emplace(t,e,i,s){const n=4*t;return this.uint32[2*t+0]=e,this.uint16[n+2]=i,this.uint16[n+3]=s,t}}Un.prototype.bytesPerElement=8,zs("StructArrayLayout1ul2ui8",Un);class jn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const s=2*t;return this.uint16[s+0]=e,this.uint16[s+1]=i,t}}jn.prototype.bytesPerElement=4,zs("StructArrayLayout2ui4",jn);class Qn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}Qn.prototype.bytesPerElement=2,zs("StructArrayLayout1ui2",Qn);class qn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,s){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,s)}emplace(t,e,i,s,n){const r=4*t;return this.float32[r+0]=e,this.float32[r+1]=i,this.float32[r+2]=s,this.float32[r+3]=n,t}}qn.prototype.bytesPerElement=16,zs("StructArrayLayout4f16",qn);class $n extends Sn{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new r(this.anchorPointX,this.anchorPointY)}}$n.prototype.size=20;class tr extends Ln{get(t){return new $n(this,t)}}zs("CollisionBoxArray",tr);class er extends Sn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}er.prototype.size=48;class ir extends Dn{get(t){return new er(this,t)}}zs("PlacedSymbolArray",ir);class sr extends Sn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}sr.prototype.size=64;class nr extends Yn{get(t){return new sr(this,t)}}zs("SymbolInstanceArray",nr);class rr extends Nn{getoffsetX(t){return this.float32[1*t+0]}}zs("GlyphOffsetArray",rr);class or extends Rn{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}zs("SymbolLineVertexArray",or);class ar extends Sn{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}ar.prototype.size=12;class lr extends On{get(t){return new ar(this,t)}}zs("TextAnchorOffsetArray",lr);class cr extends Sn{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}cr.prototype.size=8;class gr extends Un{get(t){return new cr(this,t)}}zs("FeatureIndexArray",gr);class hr extends Gn{}class ur extends Gn{}class dr extends Gn{}class pr extends Vn{}class mr extends Wn{}class Ir extends zn{}class Cr extends Jn{}class fr extends Mn{}class Ar extends Fn{}class yr extends Kn{}class br extends Pn{}class _r extends Hn{}class vr extends En{}class xr extends jn{}const wr=Bn([{name:"a_pos",components:2,type:"Int16"}],4),{members:Sr}=wr;class kr{constructor(t=[]){this.segments=t}prepareSegment(t,e,i,s){let n=this.segments[this.segments.length-1];return t>kr.MAX_VERTEX_ARRAY_LENGTH&&v(`Max vertices per segment is ${kr.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!n||n.vertexLength+t>kr.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==s)&&(n={vertexOffset:e.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0},void 0!==s&&(n.sortKey=s),this.segments.push(n)),n}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,i,s){return new kr([{vertexOffset:t,primitiveOffset:e,vertexLength:i,primitiveLength:s,vaos:{},sortKey:0}])}}function Br(t,e){return 256*(t=m(Math.floor(t),0,255))+m(Math.floor(e),0,255)}kr.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,zs("SegmentVector",kr);const Zr=Bn([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Gr={exports:{}},Rr={exports:{}};Rr.exports=function(t,e){var i,s,n,r,o,a,l,c;for(s=t.length-(i=3&t.length),n=e,o=3432918353,a=461845907,c=0;c>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((58964+(r>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&t.charCodeAt(c+2))<<16;case 2:l^=(255&t.charCodeAt(c+1))<<8;case 1:n^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(c)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return n^=t.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0};var Tr=Rr.exports,Vr={exports:{}};Vr.exports=function(t,e){for(var i,s=t.length,n=e^s,r=0;s>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(r)|(255&t.charCodeAt(++r))<<8|(255&t.charCodeAt(++r))<<16|(255&t.charCodeAt(++r))<<24))+((1540483477*(i>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),s-=4,++r;switch(s){case 3:n^=(255&t.charCodeAt(r+2))<<16;case 2:n^=(255&t.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&t.charCodeAt(r)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0};var Wr=Tr,zr=Vr.exports;Gr.exports=Wr,Gr.exports.murmur3=Wr,Gr.exports.murmur2=zr;var Jr=i(Gr.exports);class Mr{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,i,s){this.ids.push(Fr(t)),this.positions.push(e,i,s)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const e=Fr(t);let i=0,s=this.ids.length-1;for(;i>1;this.ids[t]>=e?s=t:i=t+1}const n=[];for(;this.ids[i]===e;)n.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return n}static serialize(t,e){const i=new Float64Array(t.ids),s=new Uint32Array(t.positions);return Kr(i,s,0,i.length-1),e&&e.push(i.buffer,s.buffer),{ids:i,positions:s}}static deserialize(t){const e=new Mr;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function Fr(t){const e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Jr(String(t))}function Kr(t,e,i,s){for(;i>1];let r=i-1,o=s+1;for(;;){do{r++}while(t[r]n);if(r>=o)break;Lr(t,r,o),Lr(e,3*r,3*o),Lr(e,3*r+1,3*o+1),Lr(e,3*r+2,3*o+2)}o-i`u_${t}`)),this.type=i}setUniform(t,e,i){t.set(i.constantOr(this.value))}getBinding(t,e,i){return"color"===this.type?new Er(t,e):new Xr(t,e)}}class Or{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setUniform(t,e,i,s){const n="u_pattern_to"===s?this.patternTo:"u_pattern_from"===s?this.patternFrom:"u_pixel_ratio_to"===s?this.pixelRatioTo:"u_pixel_ratio_from"===s?this.pixelRatioFrom:null;n&&t.set(n)}getBinding(t,e,i){return"u_pattern"===i.substr(0,9)?new Hr(t,e):new Xr(t,e)}}class Ur{constructor(t,e,i,s){this.expression=t,this.type=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===i?2:1,offset:0}))),this.paintVertexArray=new s}populatePaintArray(t,e,i,s,n){const r=this.paintVertexArray.length,o=this.expression.evaluate(new ln(0),e,{},s,[],n);this.paintVertexArray.resize(t),this._setPaintValue(r,t,o)}updatePaintArray(t,e,i,s){const n=this.expression.evaluate({zoom:0},i,s);this._setPaintValue(t,e,n)}_setPaintValue(t,e,i){if("color"===this.type){const s=Yr(i);for(let i=t;i`u_${t}_t`)),this.type=i,this.useIntegerZoom=s,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===i?4:2,offset:0}))),this.paintVertexArray=new r}populatePaintArray(t,e,i,s,n){const r=this.expression.evaluate(new ln(this.zoom),e,{},s,[],n),o=this.expression.evaluate(new ln(this.zoom+1),e,{},s,[],n),a=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(a,t,r,o)}updatePaintArray(t,e,i,s){const n=this.expression.evaluate({zoom:this.zoom},i,s),r=this.expression.evaluate({zoom:this.zoom+1},i,s);this._setPaintValue(t,e,n,r)}_setPaintValue(t,e,i,s){if("color"===this.type){const n=Yr(i),r=Yr(s);for(let i=t;i`#define HAS_UNIFORM_${t}`)))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const i=this.binders[e];if(i instanceof Ur||i instanceof jr)for(let e=0;e!0)){this.programConfigurations={};for(const s of t)this.programConfigurations[s.id]=new qr(s,e,i);this.needsUpload=!1,this._featureMap=new Mr,this._bufferOffset=0}populatePaintArrays(t,e,i,s,n,r){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(t,e,s,n,r);void 0!==e.id&&this._featureMap.add(e.id,i,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,i,s){for(const n of i)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(t,this._featureMap,e,n,s)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function to(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function eo(t,e,i){const s={color:{source:zn,composite:qn},number:{source:Nn,composite:zn}},n=function(t){return{"line-pattern":{source:Cr,composite:Cr},"fill-pattern":{source:Cr,composite:Cr},"fill-extrusion-pattern":{source:Cr,composite:Cr}}[t]}(t);return n&&n[i]||s[e][i]}zs("ConstantBinder",Nr),zs("CrossFadedConstantBinder",Or),zs("SourceExpressionBinder",Ur),zs("CrossFadedCompositeBinder",Qr),zs("CompositeExpressionBinder",jr),zs("ProgramConfiguration",qr,{omit:["_buffers"]}),zs("ProgramConfigurationSet",$r);const io=8192,so=Math.pow(2,14)-1,no=-so-1;function ro(t){const e=io/t.extent,i=t.loadGeometry();for(let t=0;ti.x+1||ri.y+1)&&v("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function oo(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?ro(t):[]}}function ao(t,e,i,s,n){t.emplaceBack(2*e+(s+1)/2,2*i+(n+1)/2)}class lo{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ur,this.indexArray=new vr,this.segments=new kr,this.programConfigurations=new $r(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){const s=this.layers[0],n=[];let r=null,o=!1;"circle"===s.type&&(r=s.layout.get("circle-sort-key"),o=!r.isConstant());for(const{feature:e,id:s,index:a,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,c=oo(e,t);if(!this.layers[0]._featureFilter.filter(new ln(this.zoom),c,i))continue;const g=o?r.evaluate(c,{},i):void 0,h={id:s,properties:e.properties,type:e.type,sourceLayerIndex:l,index:a,geometry:t?c.geometry:ro(e),patterns:{},sortKey:g};n.push(h)}o&&n.sort(((t,e)=>t.sortKey-e.sortKey));for(const s of n){const{geometry:n,index:r,sourceLayerIndex:o}=s,a=t[r].feature;this.addFeature(s,n,r,i),e.featureIndex.insert(a,n,r,o,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Sr),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,i,s){for(const i of e)for(const e of i){const i=e.x,s=e.y;if(i<0||i>=io||s<0||s>=io)continue;const n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),r=n.vertexLength;ao(this.layoutVertexArray,i,s,-1,-1),ao(this.layoutVertexArray,i,s,1,-1),ao(this.layoutVertexArray,i,s,1,1),ao(this.layoutVertexArray,i,s,-1,1),this.indexArray.emplaceBack(r,r+1,r+2),this.indexArray.emplaceBack(r,r+3,r+2),n.vertexLength+=4,n.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{},s)}}function co(t,e){for(let i=0;i1){if(po(t,e))return!0;for(let s=0;s1?i:i.sub(e)._mult(n)._add(e))}function fo(t,e){let i,s,n,r=!1;for(let o=0;oe.y!=n.y>e.y&&e.x<(n.x-s.x)*(e.y-s.y)/(n.y-s.y)+s.x&&(r=!r)}return r}function Ao(t,e){let i=!1;for(let s=0,n=t.length-1;se.y!=o.y>e.y&&e.x<(o.x-r.x)*(e.y-r.y)/(o.y-r.y)+r.x&&(i=!i)}return i}function yo(t,e,i){const s=i[0],n=i[2];if(t.xn.x&&e.x>n.x||t.yn.y&&e.y>n.y)return!1;const r=x(t,e,i[0]);return r!==x(t,e,i[1])||r!==x(t,e,i[2])||r!==x(t,e,i[3])}function bo(t,e,i){const s=e.paint.get(t).value;return"constant"===s.kind?s.value:i.programConfigurations.get(e.id).getMaxValue(t)}function _o(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function vo(t,e,i,s,n){if(!e[0]&&!e[1])return t;const o=r.convert(e)._mult(n);"viewport"===i&&o._rotate(-s);const a=[];for(let e=0;ezo(t,e)))}(l,a),u=g?c*o:c;for(const t of s)for(const e of t){const t=g?e:zo(e,a);let i=u;const s=Vo([],[e.x,e.y,0,1],a);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?i*=s[3]/r.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(i*=r.cameraToCenterDistance/s[3]),go(h,t,i))return!0}return!1}}function zo(t,e){const i=Vo([],[t.x,t.y,0,1],e);return new r(i[0]/i[3],i[1]/i[3])}class Jo extends lo{}let Mo;zs("HeatmapBucket",Jo,{omit:["layers"]});var Fo={get paint(){return Mo=Mo||new _n({"heatmap-radius":new fn(U.paint_heatmap["heatmap-radius"]),"heatmap-weight":new fn(U.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Cn(U.paint_heatmap["heatmap-intensity"]),"heatmap-color":new bn(U.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Cn(U.paint_heatmap["heatmap-opacity"])})}};function Ko(t,{width:e,height:i},s,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==e*i*s)throw new RangeError(`mismatched image size. expected: ${n.length} but got: ${e*i*s}`)}else n=new Uint8Array(e*i*s);return t.width=e,t.height=i,t.data=n,t}function Lo(t,{width:e,height:i},s){if(e===t.width&&i===t.height)return;const n=Ko({},{width:e,height:i},s);Po(t,n,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,i)},s),t.width=e,t.height=i,t.data=n.data}function Po(t,e,i,s,n,r){if(0===n.width||0===n.height)return e;if(n.width>t.width||n.height>t.height||i.x>t.width-n.width||i.y>t.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>e.width||n.height>e.height||s.x>e.width-n.width||s.y>e.height-n.height)throw new RangeError("out of range destination coordinates for image copy");const o=t.data,a=e.data;if(o===a)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l{e[t.evaluationKey]=r;const o=t.expression.evaluate(e);n.data[i+s+0]=Math.floor(255*o.r/o.a),n.data[i+s+1]=Math.floor(255*o.g/o.a),n.data[i+s+2]=Math.floor(255*o.b/o.a),n.data[i+s+3]=Math.floor(255*o.a)};if(t.clips)for(let e=0,n=0;e80*i){s=r=t[0],n=o=t[1];for(var p=i;pr&&(r=a),l>o&&(o=l);c=0!==(c=Math.max(r-s,o-n))?32767/c:0}return ea(u,d,i,s,n,c,0),d}function $o(t,e,i,s,n){var r,o;if(n===va(t,e,i,s)>0)for(r=e;r=e;r-=s)o=ya(r,t[r],t[r+1],o);return o&&pa(o,o.next)&&(ba(o),o=o.next),o}function ta(t,e){if(!t)return t;e||(e=t);var i,s=t;do{if(i=!1,s.steiner||!pa(s,s.next)&&0!==da(s.prev,s,s.next))s=s.next;else{if(ba(s),(s=e=s.prev)===s.next)break;i=!0}}while(i||s!==e);return e}function ea(t,e,i,s,n,r,o){if(t){!o&&r&&function(t,e,i,s){var n=t;do{0===n.z&&(n.z=ca(n.x,n.y,e,i,s)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,s,n,r,o,a,l,c=1;do{for(i=t,t=null,r=null,o=0;i;){for(o++,s=i,a=0,e=0;e0||l>0&&s;)0!==a&&(0===l||!s||i.z<=s.z)?(n=i,i=i.nextZ,a--):(n=s,s=s.nextZ,l--),r?r.nextZ=n:t=n,n.prevZ=r,r=n;i=s}r.nextZ=null,c*=2}while(o>1)}(n)}(t,s,n,r);for(var a,l,c=t;t.prev!==t.next;)if(a=t.prev,l=t.next,r?sa(t,s,n,r):ia(t))e.push(a.i/i|0),e.push(t.i/i|0),e.push(l.i/i|0),ba(t),t=l.next,c=l.next;else if((t=l)===c){o?1===o?ea(t=na(ta(t),e,i),e,i,s,n,r,2):2===o&&ra(t,e,i,s,n,r):ea(ta(t),e,i,s,n,r,1);break}}}function ia(t){var e=t.prev,i=t,s=t.next;if(da(e,i,s)>=0)return!1;for(var n=e.x,r=i.x,o=s.x,a=e.y,l=i.y,c=s.y,g=nr?n>o?n:o:r>o?r:o,d=a>l?a>c?a:c:l>c?l:c,p=s.next;p!==e;){if(p.x>=g&&p.x<=u&&p.y>=h&&p.y<=d&&ha(n,a,r,l,o,c,p.x,p.y)&&da(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function sa(t,e,i,s){var n=t.prev,r=t,o=t.next;if(da(n,r,o)>=0)return!1;for(var a=n.x,l=r.x,c=o.x,g=n.y,h=r.y,u=o.y,d=al?a>c?a:c:l>c?l:c,I=g>h?g>u?g:u:h>u?h:u,C=ca(d,p,e,i,s),f=ca(m,I,e,i,s),A=t.prevZ,y=t.nextZ;A&&A.z>=C&&y&&y.z<=f;){if(A.x>=d&&A.x<=m&&A.y>=p&&A.y<=I&&A!==n&&A!==o&&ha(a,g,l,h,c,u,A.x,A.y)&&da(A.prev,A,A.next)>=0)return!1;if(A=A.prevZ,y.x>=d&&y.x<=m&&y.y>=p&&y.y<=I&&y!==n&&y!==o&&ha(a,g,l,h,c,u,y.x,y.y)&&da(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(;A&&A.z>=C;){if(A.x>=d&&A.x<=m&&A.y>=p&&A.y<=I&&A!==n&&A!==o&&ha(a,g,l,h,c,u,A.x,A.y)&&da(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;y&&y.z<=f;){if(y.x>=d&&y.x<=m&&y.y>=p&&y.y<=I&&y!==n&&y!==o&&ha(a,g,l,h,c,u,y.x,y.y)&&da(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function na(t,e,i){var s=t;do{var n=s.prev,r=s.next.next;!pa(n,r)&&ma(n,s,s.next,r)&&fa(n,r)&&fa(r,n)&&(e.push(n.i/i|0),e.push(s.i/i|0),e.push(r.i/i|0),ba(s),ba(s.next),s=t=r),s=s.next}while(s!==t);return ta(s)}function ra(t,e,i,s,n,r){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&ua(o,a)){var l=Aa(o,a);return o=ta(o,o.next),l=ta(l,l.next),ea(o,e,i,s,n,r,0),void ea(l,e,i,s,n,r,0)}a=a.next}o=o.next}while(o!==t)}function oa(t,e){return t.x-e.x}function aa(t,e){var i=function(t,e){var i,s=e,n=t.x,r=t.y,o=-1/0;do{if(r<=s.y&&r>=s.next.y&&s.next.y!==s.y){var a=s.x+(r-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(a<=n&&a>o&&(o=a,i=s.x=s.x&&s.x>=g&&n!==s.x&&ha(ri.x||s.x===i.x&&la(i,s)))&&(i=s,u=l)),s=s.next}while(s!==c);return i}(t,e);if(!i)return e;var s=Aa(i,t);return ta(s,s.next),ta(i,i.next)}function la(t,e){return da(t.prev,t,e.prev)<0&&da(e.next,t,t.next)<0}function ca(t,e,i,s,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ga(t){var e=t,i=t;do{(e.x=(t-o)*(r-a)&&(t-o)*(s-a)>=(i-o)*(e-a)&&(i-o)*(r-a)>=(n-o)*(s-a)}function ua(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&ma(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(fa(t,e)&&fa(e,t)&&function(t,e){var i=t,s=!1,n=(t.x+e.x)/2,r=(t.y+e.y)/2;do{i.y>r!=i.next.y>r&&i.next.y!==i.y&&n<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(s=!s),i=i.next}while(i!==t);return s}(t,e)&&(da(t.prev,t,e.prev)||da(t,e.prev,e))||pa(t,e)&&da(t.prev,t,t.next)>0&&da(e.prev,e,e.next)>0)}function da(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function pa(t,e){return t.x===e.x&&t.y===e.y}function ma(t,e,i,s){var n=Ca(da(t,e,i)),r=Ca(da(t,e,s)),o=Ca(da(i,s,t)),a=Ca(da(i,s,e));return n!==r&&o!==a||!(0!==n||!Ia(t,i,e))||!(0!==r||!Ia(t,s,e))||!(0!==o||!Ia(i,t,s))||!(0!==a||!Ia(i,e,s))}function Ia(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Ca(t){return t>0?1:t<0?-1:0}function fa(t,e){return da(t.prev,t,t.next)<0?da(t,e,t.next)>=0&&da(t,t.prev,e)>=0:da(t,e,t.prev)<0||da(t,t.next,e)<0}function Aa(t,e){var i=new _a(t.i,t.x,t.y),s=new _a(e.i,e.x,e.y),n=t.next,r=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,s.next=i,i.prev=s,r.next=s,s.prev=r,s}function ya(t,e,i,s){var n=new _a(t,e,i);return s?(n.next=s.next,n.prev=s,s.next.prev=n,s.next=n):(n.prev=n,n.next=n),n}function ba(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function _a(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function va(t,e,i,s){for(var n=0,r=e,o=i-s;r0&&i.holes.push(s+=t[n-1].length)}return i};var xa=i(Qo.exports);function wa(t,e,i,s,n){Sa(t,e,i||0,s||t.length-1,n||Ba)}function Sa(t,e,i,s,n){for(;s>i;){if(s-i>600){var r=s-i+1,o=e-i+1,a=Math.log(r),l=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*l*(r-l)/r)*(o-r/2<0?-1:1);Sa(t,e,Math.max(i,Math.floor(e-o*l/r+c)),Math.min(s,Math.floor(e+(r-o)*l/r+c)),n)}var g=t[e],h=i,u=s;for(ka(t,i,e),n(t[s],g)>0&&ka(t,i,s);h0;)u--}0===n(t[i],g)?ka(t,i,u):ka(t,++u,s),u<=e&&(i=u+1),e<=u&&(s=u-1)}}function ka(t,e,i){var s=t[e];t[e]=t[i],t[i]=s}function Ba(t,e){return te?1:0}function Za(t,e){const i=t.length;if(i<=1)return[t];const s=[];let n,r;for(let e=0;e1)for(let t=0;tt.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new dr,this.indexArray=new vr,this.indexArray2=new xr,this.programConfigurations=new $r(t.layers,t.zoom),this.segments=new kr,this.segments2=new kr,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.hasPattern=Ra("fill",this.layers,e);const s=this.layers[0].layout.get("fill-sort-key"),n=!s.isConstant(),r=[];for(const{feature:o,id:a,index:l,sourceLayerIndex:c}of t){const t=this.layers[0]._featureFilter.needGeometry,g=oo(o,t);if(!this.layers[0]._featureFilter.filter(new ln(this.zoom),g,i))continue;const h=n?s.evaluate(g,{},i,e.availableImages):void 0,u={id:a,properties:o.properties,type:o.type,sourceLayerIndex:c,index:l,geometry:t?g.geometry:ro(o),patterns:{},sortKey:h};r.push(u)}n&&r.sort(((t,e)=>t.sortKey-e.sortKey));for(const s of r){const{geometry:n,index:r,sourceLayerIndex:o}=s;if(this.hasPattern){const t=Ta("fill",this.layers,s,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(s,n,r,i,{});e.featureIndex.insert(t[r].feature,n,r,o,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}addFeatures(t,e,i){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,jo),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,i,s,n){for(const t of Za(e,500)){let e=0;for(const i of t)e+=i.length;const i=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),s=i.vertexLength,n=[],r=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&r.push(n.length/2);const i=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),s=i.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(s+e.length-1,s),n.push(e[0].x),n.push(e[0].y);for(let t=1;t>3}if(n--,1===s||2===s)r+=t.readSVarint(),o+=t.readSVarint(),1===s&&(e&&a.push(e),e=[]),e.push(new Xa(r,o));else{if(7!==s)throw new Error("unknown command "+s);e&&e.push(e[0].clone())}}return e&&a.push(e),a},Ea.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,i=1,s=0,n=0,r=0,o=1/0,a=-1/0,l=1/0,c=-1/0;t.pos>3}if(s--,1===i||2===i)(n+=t.readSVarint())a&&(a=n),(r+=t.readSVarint())c&&(c=r);else if(7!==i)throw new Error("unknown command "+i)}return[o,l,a,c]},Ea.prototype.toGeoJSON=function(t,e,i){var s,n,r=this.extent*Math.pow(2,i),o=this.extent*t,a=this.extent*e,l=this.loadGeometry(),c=Ea.types[this.type];function g(t){for(var e=0;e>3;e=1===s?t.readString():2===s?t.readFloat():3===s?t.readDouble():4===s?t.readVarint64():5===s?t.readVarint():6===s?t.readSVarint():7===s?t.readBoolean():null}return e}(i))}Ua.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new Na(this._pbf,e,this.extent,this._keys,this._values)};var Qa=Oa;function qa(t,e,i){if(3===t){var s=new Qa(i,i.readVarint()+i.pos);s.length&&(e[s.name]=s)}}Pa.VectorTile=function(t,e){this.layers=t.readFields(qa,{},e)},Pa.VectorTileFeature=Ha,Pa.VectorTileLayer=Oa;const $a=Pa.VectorTileFeature.types,tl=Math.pow(2,13);function el(t,e,i,s,n,r,o,a){t.emplaceBack(e,i,2*Math.floor(s*tl)+o,n*tl*2,r*tl*2,Math.round(a))}class il{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new pr,this.centroidVertexArray=new hr,this.indexArray=new vr,this.programConfigurations=new $r(t.layers,t.zoom),this.segments=new kr,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.features=[],this.hasPattern=Ra("fill-extrusion",this.layers,e);for(const{feature:s,id:n,index:r,sourceLayerIndex:o}of t){const t=this.layers[0]._featureFilter.needGeometry,a=oo(s,t);if(!this.layers[0]._featureFilter.filter(new ln(this.zoom),a,i))continue;const l={id:n,sourceLayerIndex:o,index:r,geometry:t?a.geometry:ro(s),properties:s.properties,type:s.type,patterns:{}};this.hasPattern?this.features.push(Ta("fill-extrusion",this.layers,l,this.zoom,e)):this.addFeature(l,l.geometry,r,i,{}),e.featureIndex.insert(s,l.geometry,r,o,this.index,!0)}}addFeatures(t,e,i){for(const t of this.features){const{geometry:s}=t;this.addFeature(t,s,t.index,e,i)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,La),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Ka.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,e,i,s,n){const r={x:0,y:0,vertexCount:0};for(const i of Za(e,500)){let e=0;for(const t of i)e+=t.length;let s=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const t of i){if(0===t.length)continue;if(nl(t))continue;let e=0;for(let i=0;i=1){const o=t[i-1];if(!sl(n,o)){s.vertexLength+4>kr.MAX_VERTEX_ARRAY_LENGTH&&(s=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const t=n.sub(o)._perp()._unit(),i=o.dist(n);e+i>32768&&(e=0),el(this.layoutVertexArray,n.x,n.y,t.x,t.y,0,0,e),el(this.layoutVertexArray,n.x,n.y,t.x,t.y,0,1,e),r.x+=2*n.x,r.y+=2*n.y,r.vertexCount+=2,e+=i,el(this.layoutVertexArray,o.x,o.y,t.x,t.y,0,0,e),el(this.layoutVertexArray,o.x,o.y,t.x,t.y,0,1,e),r.x+=2*o.x,r.y+=2*o.y,r.vertexCount+=2;const a=s.vertexLength;this.indexArray.emplaceBack(a,a+2,a+1),this.indexArray.emplaceBack(a+1,a+2,a+3),s.vertexLength+=4,s.primitiveLength+=2}}}}if(s.vertexLength+e>kr.MAX_VERTEX_ARRAY_LENGTH&&(s=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray)),"Polygon"!==$a[t.type])continue;const n=[],o=[],a=s.vertexLength;for(const t of i)if(0!==t.length){t!==i[0]&&o.push(n.length/2);for(let e=0;eio)||t.y===e.y&&(t.y<0||t.y>io)}function nl(t){return t.every((t=>t.x<0))||t.every((t=>t.x>io))||t.every((t=>t.y<0))||t.every((t=>t.y>io))}let rl;zs("FillExtrusionBucket",il,{omit:["layers","features"]});var ol={get paint(){return rl=rl||new _n({"fill-extrusion-opacity":new Cn(U["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new fn(U["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Cn(U["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Cn(U["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new An(U["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new fn(U["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new fn(U["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Cn(U["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class al extends xn{constructor(t){super(t,ol)}createBucket(t){return new il(t)}queryRadius(){return _o(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,e,i,s,n,o,a,l){const c=vo(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),o.angle,a),g=this.paint.get("fill-extrusion-height").evaluate(e,i),h=this.paint.get("fill-extrusion-base").evaluate(e,i),u=function(t,e,i,s){const n=[];for(const i of t){const t=[i.x,i.y,0,1];Vo(t,t,e),n.push(new r(t[0]/t[3],t[1]/t[3]))}return n}(c,l),d=function(t,e,i,s){const n=[],o=[],a=s[8]*e,l=s[9]*e,c=s[10]*e,g=s[11]*e,h=s[8]*i,u=s[9]*i,d=s[10]*i,p=s[11]*i;for(const e of t){const t=[],i=[];for(const n of e){const e=n.x,o=n.y,m=s[0]*e+s[4]*o+s[12],I=s[1]*e+s[5]*o+s[13],C=s[2]*e+s[6]*o+s[14],f=s[3]*e+s[7]*o+s[15],A=C+c,y=f+g,b=m+h,_=I+u,v=C+d,x=f+p,w=new r((m+a)/y,(I+l)/y);w.z=A/y,t.push(w);const S=new r(b/x,_/x);S.z=v/x,i.push(S)}n.push(t),o.push(i)}return[n,o]}(s,h,g,l);return function(t,e,i){let s=1/0;ho(i,e)&&(s=cl(i,e[0]));for(let n=0;nt.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={}})),this.layoutVertexArray=new mr,this.layoutVertexArray2=new Ir,this.indexArray=new vr,this.programConfigurations=new $r(t.layers,t.zoom),this.segments=new kr,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.hasPattern=Ra("line",this.layers,e);const s=this.layers[0].layout.get("line-sort-key"),n=!s.isConstant(),r=[];for(const{feature:e,id:o,index:a,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,c=oo(e,t);if(!this.layers[0]._featureFilter.filter(new ln(this.zoom),c,i))continue;const g=n?s.evaluate(c,{},i):void 0,h={id:o,properties:e.properties,type:e.type,sourceLayerIndex:l,index:a,geometry:t?c.geometry:ro(e),patterns:{},sortKey:g};r.push(h)}n&&r.sort(((t,e)=>t.sortKey-e.sortKey));for(const s of r){const{geometry:n,index:r,sourceLayerIndex:o}=s;if(this.hasPattern){const t=Ta("line",this.layers,s,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(s,n,r,i,{});e.featureIndex.insert(t[r].feature,n,r,o,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}addFeatures(t,e,i){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,dl)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,hl),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,i,s,n){const r=this.layers[0].layout,o=r.get("line-join").evaluate(t,{}),a=r.get("line-cap"),l=r.get("line-miter-limit"),c=r.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const i of e)this.addLine(i,t,o,a,l,c);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,n,s)}addLine(t,e,i,s,n,r){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e=2&&t[a-1].equals(t[a-2]);)a--;let l=0;for(;l0;if(b&&e>l){const t=h.dist(u);if(t>2*c){const e=h.sub(h.sub(u)._mult(c/t)._round());this.updateDistance(u,e),this.addCurrentVertex(e,p,0,0,g),u=e}}const v=u&&d;let x=v?i:o?"butt":s;if(v&&"round"===x&&(An&&(x="bevel"),"bevel"===x&&(A>2&&(x="flipbevel"),A100)I=m.mult(-1);else{const t=A*p.add(m).mag()/p.sub(m).mag();I._perp()._mult(t*(_?-1:1))}this.addCurrentVertex(h,I,0,0,g),this.addCurrentVertex(h,I.mult(-1),0,0,g)}else if("bevel"===x||"fakeround"===x){const t=-Math.sqrt(A*A-1),e=_?t:0,i=_?0:t;if(u&&this.addCurrentVertex(h,p,e,i,g),"fakeround"===x){const t=Math.round(180*y/Math.PI/20);for(let e=1;e2*c){const e=h.add(d.sub(h)._mult(c/t)._round());this.updateDistance(h,e),this.addCurrentVertex(e,m,0,0,g),h=e}}}}addCurrentVertex(t,e,i,s,n,r=!1){const o=e.y*s-e.x,a=-e.y-e.x*s;this.addHalfVertex(t,e.x+e.y*i,e.y-e.x*i,r,!1,i,n),this.addHalfVertex(t,o,a,r,!0,-s,n),this.distance>Il/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,i,s,n,r))}addHalfVertex({x:t,y:e},i,s,n,r,o,a){const l=.5*(this.lineClips?this.scaledDistance*(Il-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(n?1:0),(e<<1)+(r?1:0),Math.round(63*i)+128,Math.round(63*s)+128,1+(0===o?0:o<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const c=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,c),a.primitiveLength++),r?this.e2=c:this.e1=c}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}}let fl,Al;zs("LineBucket",Cl,{omit:["layers","patternFeatures"]});var yl={get paint(){return Al=Al||new _n({"line-opacity":new fn(U.paint_line["line-opacity"]),"line-color":new fn(U.paint_line["line-color"]),"line-translate":new Cn(U.paint_line["line-translate"]),"line-translate-anchor":new Cn(U.paint_line["line-translate-anchor"]),"line-width":new fn(U.paint_line["line-width"]),"line-gap-width":new fn(U.paint_line["line-gap-width"]),"line-offset":new fn(U.paint_line["line-offset"]),"line-blur":new fn(U.paint_line["line-blur"]),"line-dasharray":new yn(U.paint_line["line-dasharray"]),"line-pattern":new An(U.paint_line["line-pattern"]),"line-gradient":new bn(U.paint_line["line-gradient"])})},get layout(){return fl=fl||new _n({"line-cap":new Cn(U.layout_line["line-cap"]),"line-join":new fn(U.layout_line["line-join"]),"line-miter-limit":new Cn(U.layout_line["line-miter-limit"]),"line-round-limit":new Cn(U.layout_line["line-round-limit"]),"line-sort-key":new fn(U.layout_line["line-sort-key"])})}};class bl extends fn{possiblyEvaluate(t,e){return e=new ln(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,i,s){return e=C({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,i,s)}}let _l;class vl extends xn{constructor(t){super(t,yl),this.gradientVersion=0,_l||(_l=new bl(yl.paint.properties["line-width"].specification),_l.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if("line-gradient"===t){const t=this.gradientExpression();this.stepInterpolant=!!function(t){return void 0!==t._styleExpression}(t)&&t._styleExpression.expression instanceof Xe,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=_l.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Cl(t)}queryRadius(t){const e=t,i=xl(bo("line-width",this,e),bo("line-gap-width",this,e)),s=bo("line-offset",this,e);return i/2+Math.abs(s)+_o(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,i,s,n,o,a){const l=vo(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,a),c=a/2*xl(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),g=this.paint.get("line-offset").evaluate(e,i);return g&&(s=function(t,e){const i=[];for(let s=0;s=3)for(let e=0;e0?e+2*t:t}const wl=Bn([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Sl=Bn([{name:"a_projected_pos",components:3,type:"Float32"}],4);Bn([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const kl=Bn([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Bn([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Bl=Bn([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Zl=Bn([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Gl(t,e,i){return t.sections.forEach((t=>{t.text=function(t,e,i){const s=e.layout.get("text-transform").evaluate(i,{});return"uppercase"===s?t=t.toLocaleUpperCase():"lowercase"===s&&(t=t.toLocaleLowerCase()),an.applyArabicShaping&&(t=an.applyArabicShaping(t)),t}(t.text,e,i)})),t}Bn([{name:"triangle",components:3,type:"Uint16"}]),Bn([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Bn([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),Bn([{type:"Float32",name:"offsetX"}]),Bn([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Bn([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Rl={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Tl=24,Vl=Jl,Wl=function(t,e,i,s,n){var r,o,a=8*n-s-1,l=(1<>1,g=-7,h=i?n-1:0,u=i?-1:1,d=t[e+h];for(h+=u,r=d&(1<<-g)-1,d>>=-g,g+=a;g>0;r=256*r+t[e+h],h+=u,g-=8);for(o=r&(1<<-g)-1,r>>=-g,g+=s;g>0;o=256*o+t[e+h],h+=u,g-=8);if(0===r)r=1-c;else{if(r===l)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,s),r-=c}return(d?-1:1)*o*Math.pow(2,r-s)},zl=function(t,e,i,s,n,r){var o,a,l,c=8*r-n-1,g=(1<>1,u=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=s?0:r-1,p=s?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=g):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+h>=1?u/l:u*Math.pow(2,1-h))*l>=2&&(o++,l/=2),o+h>=g?(a=0,o=g):o+h>=1?(a=(e*l-1)*Math.pow(2,n),o+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,n),o=0));n>=8;t[i+d]=255&a,d+=p,a/=256,n-=8);for(o=o<0;t[i+d]=255&o,d+=p,o/=256,c-=8);t[i+d-p]|=128*m};function Jl(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Jl.Varint=0,Jl.Fixed64=1,Jl.Bytes=2,Jl.Fixed32=5;var Ml=4294967296,Fl=1/Ml,Kl="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Ll(t){return t.type===Jl.Bytes?t.readVarint()+t.pos:t.pos+1}function Pl(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Xl(t,e,i){var s=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(s);for(var n=i.pos-1;n>=t;n--)i.buf[n+s]=i.buf[n]}function Hl(t,e){for(var i=0;i>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function tc(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}Jl.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos>3,r=this.pos;this.type=7&s,t(n,e,this),this.pos===r&&this.skip(s)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=ql(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=tc(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=ql(this.buf,this.pos)+ql(this.buf,this.pos+4)*Ml;return this.pos+=8,t},readSFixed64:function(){var t=ql(this.buf,this.pos)+tc(this.buf,this.pos+4)*Ml;return this.pos+=8,t},readFloat:function(){var t=Wl(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Wl(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,s=this.buf;return e=127&(i=s[this.pos++]),i<128?e:(e|=(127&(i=s[this.pos++]))<<7,i<128?e:(e|=(127&(i=s[this.pos++]))<<14,i<128?e:(e|=(127&(i=s[this.pos++]))<<21,i<128?e:function(t,e,i){var s,n,r=i.buf;if(s=(112&(n=r[i.pos++]))>>4,n<128)return Pl(t,s,e);if(s|=(127&(n=r[i.pos++]))<<3,n<128)return Pl(t,s,e);if(s|=(127&(n=r[i.pos++]))<<10,n<128)return Pl(t,s,e);if(s|=(127&(n=r[i.pos++]))<<17,n<128)return Pl(t,s,e);if(s|=(127&(n=r[i.pos++]))<<24,n<128)return Pl(t,s,e);if(s|=(1&(n=r[i.pos++]))<<31,n<128)return Pl(t,s,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=s[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Kl?function(t,e,i){return Kl.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){for(var s="",n=e;n239?4:l>223?3:l>191?2:1;if(n+g>i)break;1===g?l<128&&(c=l):2===g?128==(192&(r=t[n+1]))&&(c=(31&l)<<6|63&r)<=127&&(c=null):3===g?(o=t[n+2],128==(192&(r=t[n+1]))&&128==(192&o)&&((c=(15&l)<<12|(63&r)<<6|63&o)<=2047||c>=55296&&c<=57343)&&(c=null)):4===g&&(o=t[n+2],a=t[n+3],128==(192&(r=t[n+1]))&&128==(192&o)&&128==(192&a)&&((c=(15&l)<<18|(63&r)<<12|(63&o)<<6|63&a)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,g=1):c>65535&&(c-=65536,s+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),s+=String.fromCharCode(c),n+=g}return s}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Jl.Bytes)return t.push(this.readVarint(e));var i=Ll(this);for(t=t||[];this.pos127;);else if(e===Jl.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Jl.Fixed32)this.pos+=4;else{if(e!==Jl.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var i,s;if(t>=0?(i=t%4294967296|0,s=t/4294967296|0):(s=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,s=s+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,i.buf[i.pos]=127&(t>>>=7)}(i,0,e),function(t,e){var 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)))))}(s,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:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,i){for(var s,n,r=0;r55295&&s<57344){if(!n){s>56319||r+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):n=s;continue}if(s<56320){t[i++]=239,t[i++]=191,t[i++]=189,n=s;continue}s=n-55296<<10|s-56320|65536,n=null}else n&&(t[i++]=239,t[i++]=191,t[i++]=189,n=null);s<128?t[i++]=s:(s<2048?t[i++]=s>>6|192:(s<65536?t[i++]=s>>12|224:(t[i++]=s>>18|240,t[i++]=s>>12&63|128),t[i++]=s>>6&63|128),t[i++]=63&s|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&Xl(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),zl(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),zl(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i=128&&Xl(i,s,this),this.pos=i-1,this.writeVarint(s),this.pos+=s},writeMessage:function(t,e,i){this.writeTag(t,Jl.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Hl,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,El,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Nl,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Dl,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Yl,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Ol,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Ul,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,jl,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Ql,e)},writeBytesField:function(t,e){this.writeTag(t,Jl.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Jl.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Jl.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Jl.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Jl.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Jl.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Jl.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Jl.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Jl.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Jl.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var ec=i(Vl);const ic=3;function sc(t,e,i){1===t&&i.readMessage(nc,e)}function nc(t,e,i){if(3===t){const{id:t,bitmap:s,width:n,height:r,left:o,top:a,advance:l}=i.readMessage(rc,{});e.push({id:t,bitmap:new Xo({width:n+2*ic,height:r+2*ic},s),metrics:{width:n,height:r,left:o,top:a,advance:l}})}}function rc(t,e,i){1===t?e.id=i.readVarint():2===t?e.bitmap=i.readBytes():3===t?e.width=i.readVarint():4===t?e.height=i.readVarint():5===t?e.left=i.readSVarint():6===t?e.top=i.readSVarint():7===t&&(e.advance=i.readVarint())}const oc=ic;function ac(t){let e=0,i=0;for(const s of t)e+=s.w*s.h,i=Math.max(i,s.w);t.sort(((t,e)=>e.h-t.h));const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let n=0,r=0;for(const e of t)for(let t=s.length-1;t>=0;t--){const i=s[t];if(!(e.w>i.w||e.h>i.h)){if(e.x=i.x,e.y=i.y,r=Math.max(r,e.y+e.h),n=Math.max(n,e.x+e.w),e.w===i.w&&e.h===i.h){const e=s.pop();t=0&&i>=t&&Ic[this.text.charCodeAt(i)];i--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e)}substring(t,e){const i=new pc;return i.text=this.text.substring(t,e),i.sectionIndex=this.sectionIndex.slice(t,e),i.sections=this.sections,i}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}addTextSection(t,e){this.text+=t.text,this.sections.push(dc.forText(t.scale,t.fontStack||e));const i=this.sections.length-1;for(let e=0;e=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function mc(e,i,s,n,r,o,a,l,c,g,h,u,d,p,m,I){const C=pc.fromFeature(e,r);let f;u===t.ai.vertical&&C.verticalizePunctuation();const{processBidirectionalText:A,processStyledBidirectionalText:y}=an;if(A&&1===C.sections.length){f=[];const t=A(C.toString(),vc(C,g,o,i,n,p,m));for(const e of t){const t=new pc;t.text=e,t.sections=C.sections;for(let i=0;i0&&s>_&&(_=s)}else{const t=s[m.fontStack],e=t&&t[C];if(e&&e.rect)v=e.rect,y=e.metrics;else{const t=i[m.fontStack],e=t&&t[C];if(!e)continue;y=e.metrics}f=(r-m.scale)*Tl}S?(e.verticalizable=!0,b.push({glyph:C,imageName:x,x:d,y:p+f,vertical:S,scale:m.scale,fontStack:m.fontStack,sectionIndex:I,metrics:y,rect:v}),d+=w*m.scale+g):(b.push({glyph:C,imageName:x,x:d,y:p+f,vertical:S,scale:m.scale,fontStack:m.fontStack,sectionIndex:I,metrics:y,rect:v}),d+=y.advance*m.scale+g)}0!==b.length&&(m=Math.max(d-g,m),wc(b,0,b.length-1,C,_)),d=0;const v=o*r+_;y.lineOffset=Math.max(_,l),p+=v,I=Math.max(v,I),++f}var A;const y=p-uc,{horizontalAlign:b,verticalAlign:_}=xc(a);(function(t,e,i,s,n,r,o,a,l){const c=(e-i)*n;let g=0;g=r!==o?-a*s-uc:(-s*l+.5)*o;for(const e of t)for(const t of e.positionedGlyphs)t.x+=c,t.y+=g})(e.positionedLines,C,b,_,m,I,o,y,r.length),e.top+=-_*y,e.bottom=e.top+y,e.left+=-b*m,e.right=e.left+m}(_,i,s,n,f,a,l,c,u,g,d,I),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(b)&&_}const Ic={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Cc={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function fc(t,e,i,s,n,r){if(e.imageName){const t=s[e.imageName];return t?t.displaySize[0]*e.scale*Tl/r+n:0}{const s=i[e.fontStack],r=s&&s[t];return r?r.metrics.advance*e.scale+n:0}}function Ac(t,e,i,s){const n=Math.pow(t-e,2);return s?t=0;let g=0;for(let i=0;it.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Zo([]),this.placementViewportMatrix=Zo([]);const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Rc(this.zoom,i["text-size"]),this.iconSizeData=Rc(this.zoom,i["icon-size"]);const s=this.layers[0].layout,n=s.get("symbol-sort-key"),r=s.get("symbol-z-order");this.canOverlap="never"!==Tc(s,"text-overlap","text-allow-overlap")||"never"!==Tc(s,"icon-overlap","icon-allow-overlap")||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==r&&!n.isConstant(),this.sortFeaturesByY=("viewport-y"===r||"auto"===r&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===s.get("symbol-placement")&&(this.writingModes=s.get("text-writing-mode").map((e=>t.ai[e]))),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=e.sourceID}createArrays(){this.text=new Fc(new $r(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new Fc(new $r(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new rr,this.lineVertexArray=new or,this.symbolInstances=new nr,this.textAnchorOffsets=new lr}calculateGlyphDependencies(t,e,i,s,n){for(let r=0;r0)&&("constant"!==o.value.kind||o.value.value.length>0),g="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,h=r.get("symbol-sort-key");if(this.features=[],!c&&!g)return;const u=i.iconDependencies,d=i.glyphDependencies,p=i.availableImages,m=new ln(this.zoom);for(const{feature:i,id:a,index:l,sourceLayerIndex:I}of e){const e=n._featureFilter.needGeometry,C=oo(i,e);if(!n._featureFilter.filter(m,C,s))continue;let f,A;if(e||(C.geometry=ro(i)),c){const t=n.getValueAndResolveTokens("text-field",C,s,p),e=$t.factory(t);Mc(e)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===rn()||this.hasRTLText&&an.isParsed())&&(f=Gl(e,n,C))}if(g){const t=n.getValueAndResolveTokens("icon-image",C,s,p);A=t instanceof se?t:se.fromString(t)}if(!f&&!A)continue;const y=this.sortFeaturesByKey?h.evaluate(C,{},s):void 0;if(this.features.push({id:a,text:f,icon:A,index:l,sourceLayerIndex:I,geometry:C.geometry,properties:i.properties,type:Vc[i.type],sortKey:y}),A&&(u[A.name]=!0),f){const e=o.evaluate(C,{},s).join(","),i="viewport"!==r.get("text-rotation-alignment")&&"point"!==r.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(t.ai.vertical)>=0;for(const t of f.sections)if(t.image)u[t.image.name]=!0;else{const s=Ps(f.toString()),n=t.fontStack||e,r=d[n]=d[n]||{};this.calculateGlyphDependencies(t.text,r,i,this.allowVerticalPlacement,s)}}}"line"===r.get("symbol-placement")&&(this.features=function(t){const e={},i={},s=[];let n=0;function r(e){s.push(t[e]),n++}function o(t,e,n){const r=i[t];return delete i[t],i[e]=r,s[r].geometry[0].pop(),s[r].geometry[0]=s[r].geometry[0].concat(n[0]),r}function a(t,i,n){const r=e[i];return delete e[i],e[t]=r,s[r].geometry[0].shift(),s[r].geometry[0]=n[0].concat(s[r].geometry[0]),r}function l(t,e,i){const s=i?e[0][e[0].length-1]:e[0][0];return`${t}:${s.x}:${s.y}`}for(let c=0;ct.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey))}update(t,e,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,i),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,i))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){const i=this.lineVertexArray.length;if(void 0!==t.segment){let i=t.dist(e[t.segment+1]),s=t.dist(e[t.segment]);const n={};for(let s=t.segment+1;s=0;i--)n[i]={x:e[i].x,y:e[i].y,tileUnitDistanceFromAnchor:s},i>0&&(s+=e[i-1].dist(e[i]));for(let t=0;t0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){const i=t.placedSymbolArray.get(e),s=i.vertexStartIndex+4*i.numGlyphs;for(let e=i.vertexStartIndex;es[t]-s[e]||n[e]-n[t])),r}addToSortKeyRanges(t,e){const i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===e?i.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach(((t,e,i)=>{t>=0&&i.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Pc,Xc;zs("SymbolBucket",Lc,{omit:["layers","collisionBoxArray","features","compareText"]}),Lc.MAX_GLYPHS=65535,Lc.addDynamicAttributes=Jc;var Hc={get paint(){return Xc=Xc||new _n({"icon-opacity":new fn(U.paint_symbol["icon-opacity"]),"icon-color":new fn(U.paint_symbol["icon-color"]),"icon-halo-color":new fn(U.paint_symbol["icon-halo-color"]),"icon-halo-width":new fn(U.paint_symbol["icon-halo-width"]),"icon-halo-blur":new fn(U.paint_symbol["icon-halo-blur"]),"icon-translate":new Cn(U.paint_symbol["icon-translate"]),"icon-translate-anchor":new Cn(U.paint_symbol["icon-translate-anchor"]),"text-opacity":new fn(U.paint_symbol["text-opacity"]),"text-color":new fn(U.paint_symbol["text-color"],{runtimeType:mt,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new fn(U.paint_symbol["text-halo-color"]),"text-halo-width":new fn(U.paint_symbol["text-halo-width"]),"text-halo-blur":new fn(U.paint_symbol["text-halo-blur"]),"text-translate":new Cn(U.paint_symbol["text-translate"]),"text-translate-anchor":new Cn(U.paint_symbol["text-translate-anchor"])})},get layout(){return Pc=Pc||new _n({"symbol-placement":new Cn(U.layout_symbol["symbol-placement"]),"symbol-spacing":new Cn(U.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Cn(U.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new fn(U.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Cn(U.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Cn(U.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Cn(U.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Cn(U.layout_symbol["icon-ignore-placement"]),"icon-optional":new Cn(U.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Cn(U.layout_symbol["icon-rotation-alignment"]),"icon-size":new fn(U.layout_symbol["icon-size"]),"icon-text-fit":new Cn(U.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Cn(U.layout_symbol["icon-text-fit-padding"]),"icon-image":new fn(U.layout_symbol["icon-image"]),"icon-rotate":new fn(U.layout_symbol["icon-rotate"]),"icon-padding":new fn(U.layout_symbol["icon-padding"]),"icon-keep-upright":new Cn(U.layout_symbol["icon-keep-upright"]),"icon-offset":new fn(U.layout_symbol["icon-offset"]),"icon-anchor":new fn(U.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Cn(U.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Cn(U.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Cn(U.layout_symbol["text-rotation-alignment"]),"text-field":new fn(U.layout_symbol["text-field"]),"text-font":new fn(U.layout_symbol["text-font"]),"text-size":new fn(U.layout_symbol["text-size"]),"text-max-width":new fn(U.layout_symbol["text-max-width"]),"text-line-height":new Cn(U.layout_symbol["text-line-height"]),"text-letter-spacing":new fn(U.layout_symbol["text-letter-spacing"]),"text-justify":new fn(U.layout_symbol["text-justify"]),"text-radial-offset":new fn(U.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Cn(U.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new fn(U.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new fn(U.layout_symbol["text-anchor"]),"text-max-angle":new Cn(U.layout_symbol["text-max-angle"]),"text-writing-mode":new Cn(U.layout_symbol["text-writing-mode"]),"text-rotate":new fn(U.layout_symbol["text-rotate"]),"text-padding":new Cn(U.layout_symbol["text-padding"]),"text-keep-upright":new Cn(U.layout_symbol["text-keep-upright"]),"text-transform":new fn(U.layout_symbol["text-transform"]),"text-offset":new fn(U.layout_symbol["text-offset"]),"text-allow-overlap":new Cn(U.layout_symbol["text-allow-overlap"]),"text-overlap":new Cn(U.layout_symbol["text-overlap"]),"text-ignore-placement":new Cn(U.layout_symbol["text-ignore-placement"]),"text-optional":new Cn(U.layout_symbol["text-optional"])})}};class Ec{constructor(t){if(void 0===t.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:ht,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}zs("FormatSectionOverride",Ec,{omit:["defaultValue"]});class Dc extends xn{constructor(t){super(t,Hc)}recalculate(t,e){if(super.recalculate(t,e),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){const t=this.layout.get("text-writing-mode");if(t){const e=[];for(const i of t)e.indexOf(i)<0&&e.push(i);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,e,i,s){const n=this.layout.get(t).evaluate(e,{},i,s),r=this._unevaluatedLayout._values[t];return r.isDataDriven()||zi(r.value)||!n?n:function(t,e){return e.replace(/{([^{}]+)}/g,((e,i)=>t&&i in t?String(t[i]):""))}(e.properties,n)}createBucket(t){return new Lc(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Hc.paint.overridableProperties){if(!Dc.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),i=new Ec(e),s=new Wi(i,e.property.specification);let n=null;n="constant"===e.value.kind||"source"===e.value.kind?new Mi("source",s):new Fi("composite",s,e.value.zoomStops),this.paint._values[t]=new mn(e.property,n,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven())&&Dc.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const i=t.get("text-field"),s=Hc.paint.properties[e];let n=!1;const r=t=>{for(const e of t)if(s.overrides&&s.overrides.hasOverride(e))return void(n=!0)};if("constant"===i.value.kind&&i.value.value instanceof $t)r(i.value.value.sections);else if("source"===i.value.kind){const t=e=>{n||(e instanceof le&&oe(e.value)===At?r(e.value.sections):e instanceof ui?r(e.sections):e.eachChild(t))},e=i.value;e._styleExpression&&t(e._styleExpression.expression)}return n}}let Yc;var Nc={get paint(){return Yc=Yc||new _n({"background-color":new Cn(U.paint_background["background-color"]),"background-pattern":new yn(U.paint_background["background-pattern"]),"background-opacity":new Cn(U.paint_background["background-opacity"])})}};class Oc extends xn{constructor(t){super(t,Nc)}}let Uc;var jc={get paint(){return Uc=Uc||new _n({"raster-opacity":new Cn(U.paint_raster["raster-opacity"]),"raster-hue-rotate":new Cn(U.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Cn(U.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Cn(U.paint_raster["raster-brightness-max"]),"raster-saturation":new Cn(U.paint_raster["raster-saturation"]),"raster-contrast":new Cn(U.paint_raster["raster-contrast"]),"raster-resampling":new Cn(U.paint_raster["raster-resampling"]),"raster-fade-duration":new Cn(U.paint_raster["raster-fade-duration"])})}};class Qc extends xn{constructor(t){super(t,jc)}}class qc extends xn{constructor(t){super(t,{}),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class $c{constructor(t){this._callback=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._callback()}),0))}remove(){delete this._channel,this._callback=()=>{}}}const tg=6371008.8;class eg{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new eg(I(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,i=this.lat*e,s=t.lat*e,n=Math.sin(i)*Math.sin(s)+Math.cos(i)*Math.cos(s)*Math.cos((t.lng-this.lng)*e);return tg*Math.acos(Math.min(n,1))}static convert(t){if(t instanceof eg)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new eg(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new eg(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const ig=2*Math.PI*tg;function sg(t){return ig*Math.cos(t*Math.PI/180)}function ng(t){return(180+t)/360}function rg(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function og(t,e){return t/sg(e)}function ag(t){return 360*t-180}function lg(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}class cg{constructor(t,e,i=0){this.x=+t,this.y=+e,this.z=+i}static fromLngLat(t,e=0){const i=eg.convert(t);return new cg(ng(i.lng),rg(i.lat),og(e,i.lat))}toLngLat(){return new eg(ag(this.x),lg(this.y))}toAltitude(){return this.z*sg(lg(this.y))}meterInMercatorCoordinateUnits(){return 1/ig*(t=lg(this.y),1/Math.cos(t*Math.PI/180));var t}}function gg(t,e,i){var s=2*Math.PI*6378137/256/Math.pow(2,i);return[t*s-2*Math.PI*6378137/2,e*s-2*Math.PI*6378137/2]}class hg{constructor(t,e,i){if(t<0||t>25||i<0||i>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))throw new Error(`x=${e}, y=${i}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=e,this.y=i,this.key=pg(0,t,t,e,i)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,i){const s=(r=this.y,o=this.z,a=gg(256*(n=this.x),256*(r=Math.pow(2,o)-r-1),o),l=gg(256*(n+1),256*(r+1),o),a[0]+","+a[1]+","+l[0]+","+l[1]);var n,r,o,a,l;const c=function(t,e,i){let s,n="";for(let r=t;r>0;r--)s=1<1?"@2x":"").replace(/{quadkey}/g,c).replace(/{bbox-epsg-3857}/g,s)}isChildOf(t){const e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){const e=Math.pow(2,this.z);return new r((t.x*e-this.x)*io,(t.y*e-this.y)*io)}toString(){return`${this.z}/${this.x}/${this.y}`}}class ug{constructor(t,e){this.wrap=t,this.canonical=e,this.key=pg(t,e.z,e.z,e.x,e.y)}}class dg{constructor(t,e,i,s,n){if(t= z; overscaledZ = ${t}; z = ${i}`);this.overscaledZ=t,this.wrap=e,this.canonical=new hg(i,+s,+n),this.key=pg(e,t,i,s,n)}clone(){return new dg(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const e=this.canonical.z-t;return t>this.canonical.z?new dg(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new dg(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const i=this.canonical.z-t;return t>this.canonical.z?pg(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):pg(this.wrap*+e,t,t,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new dg(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,i=2*this.canonical.x,s=2*this.canonical.y;return[new dg(e,this.wrap,e,i,s),new dg(e,this.wrap,e,i+1,s),new dg(e,this.wrap,e,i,s+1),new dg(e,this.wrap,e,i+1,s+1)]}isLessThan(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.ythis.max&&(this.max=i),i=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}unpack(t,e,i){return t*this.redFactor+e*this.greenFactor+i*this.blueFactor-this.baseShift}getPixels(){return new Ho({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,i){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let s=e*this.dim,n=e*this.dim+this.dim,r=i*this.dim,o=i*this.dim+this.dim;switch(e){case-1:s=n-1;break;case 1:n=s+1}switch(i){case-1:r=o-1;break;case 1:o=r+1}const a=-e*this.dim,l=-i*this.dim;for(let e=r;e=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class Cg{constructor(t,e,i,s,n){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=i,t._y=s,this.properties=t.properties,this.id=n}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t}}class fg{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Vs(io,16,0),this.grid3D=new Vs(io,16,0),this.featureIndexArray=new gr,this.promoteId=e}insert(t,e,i,s,n,r){const o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,s,n);const a=r?this.grid3D:this.grid;for(let t=0;t=0&&s[3]>=0&&a.insert(o,s[0],s[1],s[2],s[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Pa.VectorTile(new ec(this.rawTileData)).layers,this.sourceLayerCoder=new Ig(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,i,s){this.loadVTLayers();const n=t.params||{},o=io/t.tileSize/t.scale,a=Ei(n.filter),l=t.queryGeometry,c=t.queryPadding*o,g=yg(l),h=this.grid.query(g.minX-c,g.minY-c,g.maxX+c,g.maxY+c),u=yg(t.cameraQueryGeometry),d=this.grid3D.query(u.minX-c,u.minY-c,u.maxX+c,u.maxY+c,((e,i,s,n)=>function(t,e,i,s,n){for(const r of t)if(e<=r.x&&i<=r.y&&s>=r.x&&n>=r.y)return!0;const o=[new r(e,i),new r(e,n),new r(s,n),new r(s,i)];if(t.length>2)for(const e of o)if(Ao(t,e))return!0;for(let e=0;e(u||(u=ro(e)),i.queryIntersectsFeature(l,e,s,u,this.z,t.transform,o,t.pixelPosMatrix))))}return p}loadMatchingFeature(t,e,i,s,n,r,o,a,l,c,g){const h=this.bucketLayerIDs[e];if(r&&!function(t,e){for(let i=0;i=0)return!0;return!1}(r,h))return;const u=this.sourceLayerCoder.decode(i),d=this.vtLayers[u].feature(s);if(n.needGeometry){const t=oo(d,!0);if(!n.filter(new ln(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!n.filter(new ln(this.tileID.overscaledZ),d))return;const p=this.getId(d,u);for(let e=0;e{const o=e instanceof In?e.get(r):null;return o&&o.evaluate?o.evaluate(i,s,n):o}))}function yg(t){let e=1/0,i=1/0,s=-1/0,n=-1/0;for(const r of t)e=Math.min(e,r.x),i=Math.min(i,r.y),s=Math.max(s,r.x),n=Math.max(n,r.y);return{minX:e,minY:i,maxX:s,maxY:n}}function bg(t,e){return e-t}function _g(t,e,i,s,n){const o=[];for(let a=0;a=s&&g.x>=s||(a.x>=s?a=new r(s,a.y+(s-a.x)/(g.x-a.x)*(g.y-a.y))._round():g.x>=s&&(g=new r(s,a.y+(s-a.x)/(g.x-a.x)*(g.y-a.y))._round()),a.y>=n&&g.y>=n||(a.y>=n?a=new r(a.x+(n-a.y)/(g.y-a.y)*(g.x-a.x),n)._round():g.y>=n&&(g=new r(a.x+(n-a.y)/(g.y-a.y)*(g.x-a.x),n)._round()),c&&a.equals(c[c.length-1])||(c=[a],o.push(c)),c.push(g)))))}}return o}zs("FeatureIndex",fg,{omit:["rawTileData","sourceLayerCoder"]});class vg extends r{constructor(t,e,i,s){super(t,e),this.angle=i,void 0!==s&&(this.segment=s)}clone(){return new vg(this.x,this.y,this.angle,this.segment)}}function xg(t,e,i,s,n){if(void 0===e.segment||0===i)return!0;let r=e,o=e.segment+1,a=0;for(;a>-i/2;){if(o--,o<0)return!1;a-=t[o].dist(r),r=t[o]}a+=t[o].dist(t[o+1]),o++;const l=[];let c=0;for(;as;)c-=l.shift().angleDelta;if(c>n)return!1;o++,a+=e.dist(i)}return!0}function wg(t){let e=0;for(let i=0;ic){const g=(c-l)/r,h=De.number(s.x,n.x,g),u=De.number(s.y,n.y,g),d=new vg(h,u,n.angleTo(s),i);return d._round(),!o||xg(t,d,a,o,e)?d:void 0}l+=r}}function Zg(t,e,i,s,n,r,o,a,l){const c=Sg(s,r,o),g=kg(s,n),h=g*o,u=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h=0&&C=0&&f=0&&u+c<=g){const i=new vg(C,f,m,e);i._round(),s&&!xg(t,i,r,s,n)||d.push(i)}}h+=p}return a||d.length||o||(d=Gg(t,h/2,i,s,n,r,o,!0,l)),d}zs("Anchor",vg);const Rg=lc;function Tg(t,e,i,s){const n=[],o=t.image,a=o.pixelRatio,l=o.paddedRect.w-2*Rg,c=o.paddedRect.h-2*Rg,g=t.right-t.left,h=t.bottom-t.top,u=o.stretchX||[[0,l]],d=o.stretchY||[[0,c]],p=(t,e)=>t+e[1]-e[0],m=u.reduce(p,0),I=d.reduce(p,0),C=l-m,f=c-I;let A=0,y=m,b=0,_=I,v=0,x=C,w=0,S=f;if(o.content&&s){const t=o.content;A=Vg(u,0,t[0]),b=Vg(d,0,t[1]),y=Vg(u,t[0],t[2]),_=Vg(d,t[1],t[3]),v=t[0]-A,w=t[1]-b,x=t[2]-t[0]-y,S=t[3]-t[1]-_}const k=(s,n,l,c)=>{const u=zg(s.stretch-A,y,g,t.left),d=Jg(s.fixed-v,x,s.stretch,m),p=zg(n.stretch-b,_,h,t.top),C=Jg(n.fixed-w,S,n.stretch,I),f=zg(l.stretch-A,y,g,t.left),k=Jg(l.fixed-v,x,l.stretch,m),B=zg(c.stretch-b,_,h,t.top),Z=Jg(c.fixed-w,S,c.stretch,I),G=new r(u,p),R=new r(f,p),T=new r(f,B),V=new r(u,B),W=new r(d/a,C/a),z=new r(k/a,Z/a),J=e*Math.PI/180;if(J){const t=Math.sin(J),e=Math.cos(J),i=[e,-t,t,e];G._matMult(i),R._matMult(i),V._matMult(i),T._matMult(i)}const M=s.stretch+s.fixed,F=n.stretch+n.fixed;return{tl:G,tr:R,bl:V,br:T,tex:{x:o.paddedRect.x+Rg+M,y:o.paddedRect.y+Rg+F,w:l.stretch+l.fixed-M,h:c.stretch+c.fixed-F},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:W,pixelOffsetBR:z,minFontScaleX:x/a/g,minFontScaleY:S/a/h,isSDF:i}};if(s&&(o.stretchX||o.stretchY)){const t=Wg(u,C,m),e=Wg(d,f,I);for(let i=0;i0&&(s=Math.max(10,s),this.circleDiameter=s)}else{let c=o.top*a-l[0],h=o.bottom*a+l[2],u=o.left*a-l[3],d=o.right*a+l[1];const p=o.collisionPadding;if(p&&(u-=p[0]*a,c-=p[1]*a,d+=p[2]*a,h+=p[3]*a),g){const t=new r(u,c),e=new r(d,c),i=new r(u,h),s=new r(d,h),n=g*Math.PI/180;t._rotate(n),e._rotate(n),i._rotate(n),s._rotate(n),u=Math.min(t.x,e.x,i.x,s.x),d=Math.max(t.x,e.x,i.x,s.x),c=Math.min(t.y,e.y,i.y,s.y),h=Math.max(t.y,e.y,i.y,s.y)}t.emplaceBack(e.x,e.y,u,c,d,h,i,s,n)}this.boxEndIndex=t.length}}class Fg{constructor(t=[],e=Kg){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.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:i}=this,s=e[t];for(;t>0;){const n=t-1>>1,r=e[n];if(i(s,r)>=0)break;e[t]=r,t=n}e[t]=s}_down(t){const{data:e,compare:i}=this,s=this.length>>1,n=e[t];for(;t=0)break;e[t]=r,t=s}e[t]=n}}function Kg(t,e){return te?1:0}function Lg(t,e=1,i=!1){let s=1/0,n=1/0,o=-1/0,a=-1/0;const l=t[0];for(let t=0;to)&&(o=e.x),(!t||e.y>a)&&(a=e.y)}const c=Math.min(o-s,a-n);let g=c/2;const h=new Fg([],Pg);if(0===c)return new r(s,n);for(let e=s;eu.d||!u.d)&&(u=i),i.max-u.d<=e||(g=i.h/2,h.push(new Xg(i.p.x-g,i.p.y-g,g,t)),h.push(new Xg(i.p.x+g,i.p.y-g,g,t)),h.push(new Xg(i.p.x-g,i.p.y+g,g,t)),h.push(new Xg(i.p.x+g,i.p.y+g,g,t)),d+=4)}return u.p}function Pg(t,e){return e.max-t.max}function Xg(t,e,i,s){this.p=new r(t,e),this.h=i,this.d=function(t,e){let i=!1,s=1/0;for(let n=0;nt.y!=a.y>t.y&&t.x<(a.x-n.x)*(t.y-n.y)/(a.y-n.y)+n.x&&(i=!i),s=Math.min(s,Co(t,n,a))}}return(i?1:-1)*Math.sqrt(s)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}var Hg;t.aq=void 0,(Hg=t.aq||(t.aq={}))[Hg.center=1]="center",Hg[Hg.left=2]="left",Hg[Hg.right=3]="right",Hg[Hg.top=4]="top",Hg[Hg.bottom=5]="bottom",Hg[Hg["top-left"]=6]="top-left",Hg[Hg["top-right"]=7]="top-right",Hg[Hg["bottom-left"]=8]="bottom-left",Hg[Hg["bottom-right"]=9]="bottom-right";const Eg=7,Dg=Number.POSITIVE_INFINITY;function Yg(t,e){return e[1]!==Dg?function(t,e,i){let s=0,n=0;switch(e=Math.abs(e),i=Math.abs(i),t){case"top-right":case"top-left":case"top":n=i-Eg;break;case"bottom-right":case"bottom-left":case"bottom":n=-i+Eg}switch(t){case"top-right":case"bottom-right":case"right":s=-e;break;case"top-left":case"bottom-left":case"left":s=e}return[s,n]}(t,e[0],e[1]):function(t,e){let i=0,s=0;e<0&&(e=0);const n=e/Math.SQRT2;switch(t){case"top-right":case"top-left":s=n-Eg;break;case"bottom-right":case"bottom-left":s=-n+Eg;break;case"bottom":s=-e+Eg;break;case"top":s=e-Eg}switch(t){case"top-right":case"bottom-right":i=-n;break;case"top-left":case"bottom-left":i=n;break;case"left":i=e;break;case"right":i=-e}return[i,s]}(t,e[0])}function Ng(t,e,i){var s;const n=t.layout,r=null===(s=n.get("text-variable-anchor-offset"))||void 0===s?void 0:s.evaluate(e,{},i);if(r){const t=r.values,e=[];for(let i=0;it*Tl));s.startsWith("top")?n[1]-=Eg:s.startsWith("bottom")&&(n[1]+=Eg),e[i+1]=n}return new ie(e)}const o=n.get("text-variable-anchor");if(o){let s;s=void 0!==t._unevaluatedLayout.getValue("text-radial-offset")?[n.get("text-radial-offset").evaluate(e,{},i)*Tl,Dg]:n.get("text-offset").evaluate(e,{},i).map((t=>t*Tl));const r=[];for(const t of o)r.push(t,Yg(t,s));return new ie(r)}return null}function Og(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Ug(e,i,s,n,r,o,a,l,c,g,h){let u=o.textMaxSize.evaluate(i,{});void 0===u&&(u=a);const d=e.layers[0].layout,p=d.get("icon-offset").evaluate(i,{},h),m=Qg(s.horizontal),I=a/24,C=e.tilePixelRatio*I,f=e.tilePixelRatio*u/24,A=e.tilePixelRatio*l,y=e.tilePixelRatio*d.get("symbol-spacing"),b=d.get("text-padding")*e.tilePixelRatio,_=function(t,e,i,s=1){const n=t.get("icon-padding").evaluate(e,{},i),r=n&&n.values;return[r[0]*s,r[1]*s,r[2]*s,r[3]*s]}(d,i,h,e.tilePixelRatio),x=d.get("text-max-angle")/180*Math.PI,w="viewport"!==d.get("text-rotation-alignment")&&"point"!==d.get("symbol-placement"),S="map"===d.get("icon-rotation-alignment")&&"point"!==d.get("symbol-placement"),k=d.get("symbol-placement"),B=y/2,Z=d.get("icon-text-fit");let G;n&&"none"!==Z&&(e.allowVerticalPlacement&&s.vertical&&(G=kc(n,s.vertical,Z,d.get("icon-text-fit-padding"),p,I)),m&&(n=kc(n,m,Z,d.get("icon-text-fit-padding"),p,I)));const R=(l,u)=>{u.x<0||u.x>=io||u.y<0||u.y>=io||function(e,i,s,n,r,o,a,l,c,g,h,u,d,p,m,I,C,f,A,y,b,_,x,w,S){const k=e.addToLineVertexArray(i,s);let B,Z,G,R,T=0,V=0,W=0,z=0,J=-1,M=-1;const F={};let K=Jr("");if(e.allowVerticalPlacement&&n.vertical){const t=l.layout.get("text-rotate").evaluate(b,{},w)+90;G=new Mg(c,i,g,h,u,n.vertical,d,p,m,t),a&&(R=new Mg(c,i,g,h,u,a,C,f,m,t))}if(r){const s=l.layout.get("icon-rotate").evaluate(b,{}),n="none"!==l.layout.get("icon-text-fit"),o=Tg(r,s,x,n),d=a?Tg(a,s,x,n):void 0;Z=new Mg(c,i,g,h,u,r,C,f,!1,s),T=4*o.length;const p=e.iconSizeData;let m=null;"source"===p.kind?(m=[Zc*l.layout.get("icon-size").evaluate(b,{})],m[0]>Gc&&v(`${e.layerIds[0]}: Value for "icon-size" is >= ${Bc}. Reduce your "icon-size".`)):"composite"===p.kind&&(m=[Zc*_.compositeIconSizes[0].evaluate(b,{},w),Zc*_.compositeIconSizes[1].evaluate(b,{},w)],(m[0]>Gc||m[1]>Gc)&&v(`${e.layerIds[0]}: Value for "icon-size" is >= ${Bc}. Reduce your "icon-size".`)),e.addSymbols(e.icon,o,m,y,A,b,t.ai.none,i,k.lineStartIndex,k.lineLength,-1,w),J=e.icon.placedSymbolArray.length-1,d&&(V=4*d.length,e.addSymbols(e.icon,d,m,y,A,b,t.ai.vertical,i,k.lineStartIndex,k.lineLength,-1,w),M=e.icon.placedSymbolArray.length-1)}const L=Object.keys(n.horizontal);for(const s of L){const r=n.horizontal[s];if(!B){K=Jr(r.text);const t=l.layout.get("text-rotate").evaluate(b,{},w);B=new Mg(c,i,g,h,u,r,d,p,m,t)}const a=1===r.positionedLines.length;if(W+=jg(e,i,r,o,l,m,b,I,k,n.vertical?t.ai.horizontal:t.ai.horizontalOnly,a?L:[s],F,J,_,w),a)break}n.vertical&&(z+=jg(e,i,n.vertical,o,l,m,b,I,k,t.ai.vertical,["vertical"],F,M,_,w));const P=B?B.boxStartIndex:e.collisionBoxArray.length,X=B?B.boxEndIndex:e.collisionBoxArray.length,H=G?G.boxStartIndex:e.collisionBoxArray.length,E=G?G.boxEndIndex:e.collisionBoxArray.length,D=Z?Z.boxStartIndex:e.collisionBoxArray.length,Y=Z?Z.boxEndIndex:e.collisionBoxArray.length,N=R?R.boxStartIndex:e.collisionBoxArray.length,O=R?R.boxEndIndex:e.collisionBoxArray.length;let U=-1;const j=(t,e)=>t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;U=j(B,U),U=j(G,U),U=j(Z,U),U=j(R,U);const Q=U>-1?1:0;Q&&(U*=S/Tl),e.glyphOffsetArray.length>=Lc.MAX_GLYPHS&&v("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,b.sortKey);const q=Ng(l,b,w),[$,tt]=function(e,i){const s=e.length,n=null==i?void 0:i.values;if((null==n?void 0:n.length)>0)for(let i=0;i=0?F.right:-1,F.center>=0?F.center:-1,F.left>=0?F.left:-1,F.vertical||-1,J,M,K,P,X,H,E,D,Y,N,O,g,W,z,T,V,Q,0,d,U,$,tt)}(e,u,l,s,n,r,G,e.layers[0],e.collisionBoxArray,i.index,i.sourceLayerIndex,e.index,C,[b,b,b,b],w,c,A,_,S,p,i,o,g,h,a)};if("line"===k)for(const t of _g(i.geometry,0,0,io,io)){const i=Zg(t,y,x,s.vertical||m,n,24,f,e.overscaling,io);for(const s of i)m&&qg(e,m.text,B,s)||R(t,s)}else if("line-center"===k){for(const t of i.geometry)if(t.length>1){const e=Bg(t,x,s.vertical||m,n,24,f);e&&R(t,e)}}else if("Polygon"===i.type)for(const t of Za(i.geometry,0)){const e=Lg(t,16);R(t[0],new vg(e.x,e.y,0))}else if("LineString"===i.type)for(const t of i.geometry)R(t,new vg(t[0].x,t[0].y,0));else if("Point"===i.type)for(const t of i.geometry)for(const e of t)R([e],new vg(e.x,e.y,0))}function jg(t,e,i,s,n,o,a,l,c,g,h,u,d,p,m){const I=function(t,e,i,s,n,o,a,l){const c=s.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,g=[];for(const t of e.positionedLines)for(const s of t.positionedGlyphs){if(!s.rect)continue;const o=s.rect||{};let h=oc+1,u=!0,d=1,p=0;const m=(n||l)&&s.vertical,I=s.metrics.advance*s.scale/2;if(l&&e.verticalizable&&(p=t.lineOffset/2-(s.imageName?-(Tl-s.metrics.width*s.scale)/2:(s.scale-1)*Tl)),s.imageName){const t=a[s.imageName];u=t.sdf,d=t.pixelRatio,h=lc/d}const C=n?[s.x+I,s.y]:[0,0];let f=n?[0,0]:[s.x+I+i[0],s.y+i[1]-p],A=[0,0];m&&(A=f,f=[0,0]);const y=s.metrics.isDoubleResolution?2:1,b=(s.metrics.left-h)*s.scale-I+f[0],_=(-s.metrics.top-h)*s.scale+f[1],v=b+o.w/y*s.scale/d,x=_+o.h/y*s.scale/d,w=new r(b,_),S=new r(v,_),k=new r(b,x),B=new r(v,x);if(m){const t=new r(-I,I-uc),e=-Math.PI/2,i=Tl/2-I,n=new r(5-uc-i,-(s.imageName?i:0)),o=new r(...A);w._rotateAround(e,t)._add(n)._add(o),S._rotateAround(e,t)._add(n)._add(o),k._rotateAround(e,t)._add(n)._add(o),B._rotateAround(e,t)._add(n)._add(o)}if(c){const t=Math.sin(c),e=Math.cos(c),i=[e,-t,t,e];w._matMult(i),S._matMult(i),k._matMult(i),B._matMult(i)}const Z=new r(0,0),G=new r(0,0);g.push({tl:w,tr:S,bl:k,br:B,tex:o,writingMode:e.writingMode,glyphOffset:C,sectionIndex:s.sectionIndex,isSDF:u,pixelOffsetTL:Z,pixelOffsetBR:G,minFontScaleX:0,minFontScaleY:0})}return g}(0,i,l,n,o,a,s,t.allowVerticalPlacement),C=t.textSizeData;let f=null;"source"===C.kind?(f=[Zc*n.layout.get("text-size").evaluate(a,{})],f[0]>Gc&&v(`${t.layerIds[0]}: Value for "text-size" is >= ${Bc}. Reduce your "text-size".`)):"composite"===C.kind&&(f=[Zc*p.compositeTextSizes[0].evaluate(a,{},m),Zc*p.compositeTextSizes[1].evaluate(a,{},m)],(f[0]>Gc||f[1]>Gc)&&v(`${t.layerIds[0]}: Value for "text-size" is >= ${Bc}. Reduce your "text-size".`)),t.addSymbols(t.text,I,f,l,o,a,g,e,c.lineStartIndex,c.lineLength,d,m);for(const e of h)u[e]=t.text.placedSymbolArray.length-1;return 4*I.length}function Qg(t){for(const e in t)return t[e];return null}function qg(t,e,i,s){const n=t.compareText;if(e in n){const t=n[e];for(let e=t.length-1;e>=0;e--)if(s.dist(t[e])>4;if(1!==s)throw new Error(`Got v${s} data when expected v1.`);const n=$g[15&i];if(!n)throw new Error("Unrecognized array type.");const[r]=new Uint16Array(t,2,1),[o]=new Uint32Array(t,4,1);return new th(o,r,n,t)}constructor(t,e=64,i=Float64Array,s){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=i,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const n=$g.indexOf(this.ArrayType),r=2*t*this.ArrayType.BYTES_PER_ELEMENT,o=t*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-o%8)%8;if(n<0)throw new Error(`Unexpected typed array class: ${i}.`);s&&s instanceof ArrayBuffer?(this.data=s,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+o+a,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+r+o+a),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+o+a,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=t,this.coords[this._pos++]=e,i}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return eh(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,i,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:r,nodeSize:o}=this,a=[0,n.length-1,0],l=[];for(;a.length;){const c=a.pop()||0,g=a.pop()||0,h=a.pop()||0;if(g-h<=o){for(let o=h;o<=g;o++){const a=r[2*o],c=r[2*o+1];a>=t&&a<=i&&c>=e&&c<=s&&l.push(n[o])}continue}const u=h+g>>1,d=r[2*u],p=r[2*u+1];d>=t&&d<=i&&p>=e&&p<=s&&l.push(n[u]),(0===c?t<=d:e<=p)&&(a.push(h),a.push(u-1),a.push(1-c)),(0===c?i>=d:s>=p)&&(a.push(u+1),a.push(g),a.push(1-c))}return l}within(t,e,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:n,nodeSize:r}=this,o=[0,s.length-1,0],a=[],l=i*i;for(;o.length;){const c=o.pop()||0,g=o.pop()||0,h=o.pop()||0;if(g-h<=r){for(let i=h;i<=g;i++)rh(n[2*i],n[2*i+1],t,e)<=l&&a.push(s[i]);continue}const u=h+g>>1,d=n[2*u],p=n[2*u+1];rh(d,p,t,e)<=l&&a.push(s[u]),(0===c?t-i<=d:e-i<=p)&&(o.push(h),o.push(u-1),o.push(1-c)),(0===c?t+i>=d:e+i>=p)&&(o.push(u+1),o.push(g),o.push(1-c))}return a}}function eh(t,e,i,s,n,r){if(n-s<=i)return;const o=s+n>>1;ih(t,e,o,s,n,r),eh(t,e,i,s,o-1,1-r),eh(t,e,i,o+1,n,1-r)}function ih(t,e,i,s,n,r){for(;n>s;){if(n-s>600){const o=n-s+1,a=i-s+1,l=Math.log(o),c=.5*Math.exp(2*l/3),g=.5*Math.sqrt(l*c*(o-c)/o)*(a-o/2<0?-1:1);ih(t,e,i,Math.max(s,Math.floor(i-a*c/o+g)),Math.min(n,Math.floor(i+(o-a)*c/o+g)),r)}const o=e[2*i+r];let a=s,l=n;for(sh(t,e,s,i),e[2*n+r]>o&&sh(t,e,s,n);ao;)l--}e[2*s+r]===o?sh(t,e,s,l):(l++,sh(t,e,l,n)),l<=i&&(s=l+1),i<=l&&(n=l-1)}}function sh(t,e,i,s){nh(t,i,s),nh(e,2*i,2*s),nh(e,2*i+1,2*s+1)}function nh(t,e,i){const s=t[e];t[e]=t[i],t[i]=s}function rh(t,e,i,s){const n=t-i,r=e-s;return n*n+r*r}var oh;t.bh=void 0,(oh=t.bh||(t.bh={})).create="create",oh.load="load",oh.fullLoad="fullLoad";let ah=null,lh=[];const ch=1e3/60,gh="loadTime",hh="fullLoadTime",uh={mark(t){performance.mark(t)},frame(t){const e=t;null!=ah&&lh.push(e-ah),ah=e},clearMetrics(){ah=null,lh=[],performance.clearMeasures(gh),performance.clearMeasures(hh);for(const e in t.bh)performance.clearMarks(t.bh[e])},getPerformanceMetrics(){performance.measure(gh,t.bh.create,t.bh.load),performance.measure(hh,t.bh.create,t.bh.fullLoad);const e=performance.getEntriesByName(gh)[0].duration,i=performance.getEntriesByName(hh)[0].duration,s=lh.length,n=1/(lh.reduce(((t,e)=>t+e),0)/s/1e3),r=lh.filter((t=>t>ch)).reduce(((t,e)=>t+(e-ch)/ch),0);return{loadTime:e,fullLoadTime:i,fps:n,percentDroppedFrames:r/(s+r)*100,totalFrames:s}}};t.$=function(t,e,i){var s,n,r,o,a,l,c,g,h,u,d,p,m=i[0],I=i[1],C=i[2];return e===t?(t[12]=e[0]*m+e[4]*I+e[8]*C+e[12],t[13]=e[1]*m+e[5]*I+e[9]*C+e[13],t[14]=e[2]*m+e[6]*I+e[10]*C+e[14],t[15]=e[3]*m+e[7]*I+e[11]*C+e[15]):(n=e[1],r=e[2],o=e[3],a=e[4],l=e[5],c=e[6],g=e[7],h=e[8],u=e[9],d=e[10],p=e[11],t[0]=s=e[0],t[1]=n,t[2]=r,t[3]=o,t[4]=a,t[5]=l,t[6]=c,t[7]=g,t[8]=h,t[9]=u,t[10]=d,t[11]=p,t[12]=s*m+a*I+h*C+e[12],t[13]=n*m+l*I+u*C+e[13],t[14]=r*m+c*I+d*C+e[14],t[15]=o*m+g*I+p*C+e[15]),t},t.A=Bo,t.B=De,t.C=class{constructor(t,e,i){this.receive=t=>{const e=t.data,i=e.id;if(i&&(!e.targetMapId||this.mapId===e.targetMapId))if(""===e.type){delete this.tasks[i];const t=this.cancelCallbacks[i];delete this.cancelCallbacks[i],t&&t()}else S()||e.mustQueue?(this.tasks[i]=e,this.taskQueue.push(i),this.invoker.trigger()):this.processTask(i,e)},this.process=()=>{if(!this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)},this.target=t,this.parent=e,this.mapId=i,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new $c(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=S()?t:window}send(t,e,i,s,n=!1){const r=Math.round(1e18*Math.random()).toString(36).substring(0,10);i&&(this.callbacks[r]=i);const o=[],a={id:r,type:t,hasCallback:!!i,targetMapId:s,mustQueue:n,sourceMapId:this.mapId,data:Ms(e,o)};return this.target.postMessage(a,{transfer:o}),{cancel:()=>{i&&delete this.callbacks[r],this.target.postMessage({id:r,type:"",targetMapId:s,sourceMapId:this.mapId})}}}processTask(t,e){if(""===e.type){const i=this.callbacks[t];delete this.callbacks[t],i&&(e.error?i(Fs(e.error)):i(null,Fs(e.data)))}else{let i=!1;const s=[],n=e.hasCallback?(e,n)=>{i=!0,delete this.cancelCallbacks[t];const r={id:t,type:"",sourceMapId:this.mapId,error:e?Ms(e):null,data:Ms(n,s)};this.target.postMessage(r,{transfer:s})}:t=>{i=!0};let r=null;const o=Fs(e.data);if(this.parent[e.type])r=this.parent[e.type](e.sourceMapId,o,n);else if("getWorkerSource"in this.parent){const t=e.type.split(".");r=this.parent.getWorkerSource(e.sourceMapId,t[0],o.source)[t[1]](o,n)}else n(new Error(`Could not find function ${e.type}`));!i&&r&&r.cancel&&(this.cancelCallbacks[t]=r.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},t.D=Cn,t.E=O,t.F=function(t,e){const i={};for(let s=0;s{}}},t.Y=at,t.Z=function(){var t=new Bo(16);return Bo!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t._=e,t.a=B,t.a$=class extends Qn{},t.a0=function(t,e,i){var s=i[0],n=i[1],r=i[2];return t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.a1=Go,t.a2=function(){return f++},t.a3=tr,t.a4=Lc,t.a5=function(){an.isLoading()||an.isLoaded()||"deferred"!==rn()||on()},t.a6=Ei,t.a7=oo,t.a8=ln,t.a9=Cg,t.aA=en,t.aB=function(t){t=t.slice();const e=Object.create(null);for(let i=0;i{s[t.source]?i.push({command:$.removeLayer,args:[t.id]}):r.push(t)})),i=i.concat(n),function(t,e,i){e=e||[];const s=(t=t||[]).map(rt),n=e.map(rt),r=t.reduce(ot,{}),o=e.reduce(ot,{}),a=s.slice(),l=Object.create(null);let c,g,h,u,d,p,m;for(c=0,g=0;c@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((t,i,s,n)=>{const r=s||n;return e[i]=!r||r.toLowerCase(),""})),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e},t.ab=function(t,e){const i=[];for(const s in t)s in e||i.push(s);return i},t.ac=function(t){if(null==k){const e=t.navigator?t.navigator.userAgent:null;k=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return k},t.ad=m,t.ae=function(t,e,i){var s=Math.sin(i),n=Math.cos(i),r=e[0],o=e[1],a=e[2],l=e[3],c=e[4],g=e[5],h=e[6],u=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+c*s,t[1]=o*n+g*s,t[2]=a*n+h*s,t[3]=l*n+u*s,t[4]=c*n-r*s,t[5]=g*n-o*s,t[6]=h*n-a*s,t[7]=u*n-l*s,t},t.af=function(t){var e=new Bo(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.ag=Vo,t.ah=function(t,e){let i=0,s=0;if("constant"===t.kind)s=t.layoutSize;else if("source"!==t.kind){const{interpolationType:n,minZoom:r,maxZoom:o}=t,a=n?m(Ye.interpolationFactor(n,e,r,o),0,1):0;"camera"===t.kind?s=De.number(t.minSize,t.maxSize,a):i=a}return{uSizeT:i,uSize:s}},t.aj=function(t,{uSize:e,uSizeT:i},{lowerSize:s,upperSize:n}){return"source"===t.kind?s/Zc:"composite"===t.kind?De.number(s/Zc,n/Zc,i):e},t.ak=Jc,t.al=function(t,e,i,s){const n=e.y-t.y,o=e.x-t.x,a=s.y-i.y,l=s.x-i.x,c=a*o-l*n;if(0===c)return null;const g=(l*(t.y-i.y)-a*(t.x-i.x))/c;return new r(t.x+g*o,t.y+g*n)},t.am=_g,t.an=co,t.ao=Zo,t.ap=Tl,t.ar=Tc,t.as=function(t,e){var i=e[0],s=e[1],n=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],g=e[8],h=e[9],u=e[10],d=e[11],p=e[12],m=e[13],I=e[14],C=e[15],f=i*a-s*o,A=i*l-n*o,y=i*c-r*o,b=s*l-n*a,_=s*c-r*a,v=n*c-r*l,x=g*m-h*p,w=g*I-u*p,S=g*C-d*p,k=h*I-u*m,B=h*C-d*m,Z=u*C-d*I,G=f*Z-A*B+y*k+b*S-_*w+v*x;return G?(t[0]=(a*Z-l*B+c*k)*(G=1/G),t[1]=(n*B-s*Z-r*k)*G,t[2]=(m*v-I*_+C*b)*G,t[3]=(u*_-h*v-d*b)*G,t[4]=(l*S-o*Z-c*w)*G,t[5]=(i*Z-n*S+r*w)*G,t[6]=(I*y-p*v-C*A)*G,t[7]=(g*v-u*y+d*A)*G,t[8]=(o*B-a*S+c*x)*G,t[9]=(s*S-i*B-r*x)*G,t[10]=(p*_-m*y+C*f)*G,t[11]=(h*y-g*_-d*f)*G,t[12]=(a*w-o*k-l*x)*G,t[13]=(i*k-s*w+n*x)*G,t[14]=(m*A-p*b-I*f)*G,t[15]=(g*b-h*A+u*f)*G,t):null},t.at=Og,t.au=xc,t.av=th,t.aw=function(){const t={},e=U.$version;for(const i in U.$root){const s=U.$root[i];if(s.required){let n=null;n="version"===i?e:"array"===s.type?[]:{},null!=n&&(t[i]=n)}}return t},t.ax=$,t.ay=Ks,t.az=F,t.b=function(t,e){const i=new Blob([new Uint8Array(t)],{type:"image/png"});createImageBitmap(i).then((t=>{e(null,t)})).catch((t=>{e(new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))}))},t.b0=vr,t.b1=function(t,e){var i=t[0],s=t[1],n=t[2],r=t[3],o=t[4],a=t[5],l=t[6],c=t[7],g=t[8],h=t[9],u=t[10],d=t[11],p=t[12],m=t[13],I=t[14],C=t[15],f=e[0],A=e[1],y=e[2],b=e[3],_=e[4],v=e[5],x=e[6],w=e[7],S=e[8],k=e[9],B=e[10],Z=e[11],G=e[12],R=e[13],T=e[14],V=e[15];return Math.abs(i-f)<=ko*Math.max(1,Math.abs(i),Math.abs(f))&&Math.abs(s-A)<=ko*Math.max(1,Math.abs(s),Math.abs(A))&&Math.abs(n-y)<=ko*Math.max(1,Math.abs(n),Math.abs(y))&&Math.abs(r-b)<=ko*Math.max(1,Math.abs(r),Math.abs(b))&&Math.abs(o-_)<=ko*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(a-v)<=ko*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(l-x)<=ko*Math.max(1,Math.abs(l),Math.abs(x))&&Math.abs(c-w)<=ko*Math.max(1,Math.abs(c),Math.abs(w))&&Math.abs(g-S)<=ko*Math.max(1,Math.abs(g),Math.abs(S))&&Math.abs(h-k)<=ko*Math.max(1,Math.abs(h),Math.abs(k))&&Math.abs(u-B)<=ko*Math.max(1,Math.abs(u),Math.abs(B))&&Math.abs(d-Z)<=ko*Math.max(1,Math.abs(d),Math.abs(Z))&&Math.abs(p-G)<=ko*Math.max(1,Math.abs(p),Math.abs(G))&&Math.abs(m-R)<=ko*Math.max(1,Math.abs(m),Math.abs(R))&&Math.abs(I-T)<=ko*Math.max(1,Math.abs(I),Math.abs(T))&&Math.abs(C-V)<=ko*Math.max(1,Math.abs(C),Math.abs(V))},t.b2=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.b3=function(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t[3]=e[3]*i[3],t},t.b4=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},t.b5=I,t.b6=ug,t.b7=og,t.b8=function(t,e,i,s,n){var r,o=1/Math.tan(e/2);return t[0]=o/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=n&&n!==1/0?(t[10]=(n+s)*(r=1/(s-n)),t[14]=2*n*s*r):(t[10]=-1,t[14]=-2*s),t},t.b9=function(t,e,i){var s=Math.sin(i),n=Math.cos(i),r=e[4],o=e[5],a=e[6],l=e[7],c=e[8],g=e[9],h=e[10],u=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+c*s,t[5]=o*n+g*s,t[6]=a*n+h*s,t[7]=l*n+u*s,t[8]=c*n-r*s,t[9]=g*n-o*s,t[10]=h*n-a*s,t[11]=u*n-l*s,t},t.bA=s,t.bB=Vl,t.bC=Ji,t.bD=an,t.ba=d,t.bb=p,t.bc=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},t.bd=class extends Rn{},t.be=tg,t.bf=ag,t.bg=uh,t.bi=M,t.bj=function(t,e,i=!1){if($s===Us||$s===js||$s===Qs)throw new Error("setRTLTextPlugin cannot be called multiple times.");tn=z.resolveURL(t),$s=Us,qs=e,sn(),i||on()},t.bk=rn,t.bl=function(t,e){const i={};for(let s=0;st*Tl))}let A=a?"center":s.get("text-justify").evaluate(n,{},e.canonical);const y=s.get("symbol-placement"),b="point"===y?s.get("text-max-width").evaluate(n,{},e.canonical)*Tl:0,_=()=>{e.bucket.allowVerticalPlacement&&Ps(r)&&(p.vertical=mc(m,e.glyphMap,e.glyphPositions,e.imagePositions,g,b,o,I,"left",d,C,t.ai.vertical,!0,y,u,h))};if(!a&&f){const i=new Set;if("auto"===A)for(let t=0;t{e(null,i),URL.revokeObjectURL(i.src),i.onload=null,window.requestAnimationFrame((()=>{i.src=Z}))},i.onerror=()=>e(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const s=new Blob([new Uint8Array(t)],{type:"image/png"});i.src=t.byteLength?URL.createObjectURL(s):Z},t.e=C,t.f=function(t,e){return P(C(t,{type:"json"}),e)},t.g=K,t.h=z,t.i=S,t.j=N,t.k=Y,t.l=X,t.m=P,t.n=function(t){return new ec(t).readFields(sc,[])},t.o=function(t,e,i){if(!t.length)return i(null,[]);let s=t.length;const n=new Array(t.length);let r=null;t.forEach(((t,o)=>{e(t,((t,e)=>{t&&(r=t),n[o]=e,0==--s&&i(r,n)}))}))},t.p=ac,t.q=Xo,t.r=_n,t.s=H,t.t=Zs,t.u=Ls,t.v=U,t.w=v,t.x=Ts,t.y=Bs,t.z=function([t,e,i]){return e+=90,e*=Math.PI/180,i*=Math.PI/180,{x:t*Math.cos(e)*Math.sin(i),y:t*Math.sin(e)*Math.sin(i),z:t*Math.cos(i)}}})),s(["./shared"],(function(t){class e{constructor(t){this.keyCache={},t&&this.replace(t)}replace(t){this._layerConfigs={},this._layers={},this.update(t,[])}update(e,i){for(const i of e){this._layerConfigs[i.id]=i;const e=this._layers[i.id]=t.aC(i);e._featureFilter=t.a6(e.filter),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(const t of i)delete this.keyCache[t],delete this._layerConfigs[t],delete this._layers[t];this.familiesBySource={};const s=t.bl(Object.values(this._layerConfigs),this.keyCache);for(const t of s){const e=t.map((t=>this._layers[t.id])),i=e[0];if("none"===i.visibility)continue;const s=i.source||"";let n=this.familiesBySource[s];n||(n=this.familiesBySource[s]={});const r=i.sourceLayer||"_geojsonTileLayer";let o=n[r];o||(o=n[r]=[]),o.push(e)}}}class i{constructor(e){const i={},s=[];for(const t in e){const n=e[t],r=i[t]={};for(const t in n){const e=n[+t];if(!e||0===e.bitmap.width||0===e.bitmap.height)continue;const i={x:0,y:0,w:e.bitmap.width+2,h:e.bitmap.height+2};s.push(i),r[t]={rect:i,metrics:e.metrics}}}const{w:n,h:r}=t.p(s),o=new t.q({width:n||1,height:r||1});for(const s in e){const n=e[s];for(const e in n){const r=n[+e];if(!r||0===r.bitmap.width||0===r.bitmap.height)continue;const a=i[s][e].rect;t.q.copy(r.bitmap,o,{x:0,y:0},{x:a.x+1,y:a.y+1},r.bitmap)}}this.image=o,this.positions=i}}t.bm("GlyphAtlas",i);class s{constructor(e){this.tileID=new t.O(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(e,s,r,o,a){this.status="parsing",this.data=e,this.collisionBoxArray=new t.a3;const l=new t.bn(Object.keys(e.layers).sort()),c=new t.bo(this.tileID,this.promoteId);c.bucketLayerIDs=[];const g={},h={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:r},u=s.familiesBySource[this.source];for(const i in u){const s=e.layers[i];if(!s)continue;1===s.version&&t.w(`Vector tile source "${this.source}" layer "${i}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const o=l.encode(i),a=[];for(let t=0;t=i.maxzoom||"none"!==i.visibility&&(n(e,this.zoom,r),(g[i.id]=i.createBucket({index:c.bucketLayerIDs.length,layers:e,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:o,sourceID:this.source})).populate(a,h,this.tileID.canonical),c.bucketLayerIDs.push(e.map((t=>t.id))))}}let d,p,m,I;const C=t.aH(h.glyphDependencies,(t=>Object.keys(t).map(Number)));this.inFlightDependencies.forEach((t=>null==t?void 0:t.cancel())),this.inFlightDependencies=[];const f=++this.dependencySentinel;Object.keys(C).length?this.inFlightDependencies.push(o.send("getGlyphs",{uid:this.uid,stacks:C,source:this.source,tileID:this.tileID,type:"glyphs"},((t,e)=>{f===this.dependencySentinel&&(d||(d=t,p=e,b.call(this)))}))):p={};const A=Object.keys(h.iconDependencies);A.length?this.inFlightDependencies.push(o.send("getImages",{icons:A,source:this.source,tileID:this.tileID,type:"icons"},((t,e)=>{f===this.dependencySentinel&&(d||(d=t,m=e,b.call(this)))}))):m={};const y=Object.keys(h.patternDependencies);function b(){if(d)return a(d);if(p&&m&&I){const e=new i(p),s=new t.bp(m,I);for(const i in g){const o=g[i];o instanceof t.a4?(n(o.layers,this.zoom,r),t.bq({bucket:o,glyphMap:p,glyphPositions:e.positions,imageMap:m,imagePositions:s.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):o.hasPattern&&(o instanceof t.br||o instanceof t.bs||o instanceof t.bt)&&(n(o.layers,this.zoom,r),o.addFeatures(h,this.tileID.canonical,s.patternPositions))}this.status="done",a(null,{buckets:Object.values(g).filter((t=>!t.isEmpty())),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,imageAtlas:s,glyphMap:this.returnDependencies?p:null,iconMap:this.returnDependencies?m:null,glyphPositions:this.returnDependencies?e.positions:null})}}y.length?this.inFlightDependencies.push(o.send("getImages",{icons:y,source:this.source,tileID:this.tileID,type:"patterns"},((t,e)=>{f===this.dependencySentinel&&(d||(d=t,I=e,b.call(this)))}))):I={},b.call(this)}}function n(e,i,s){const n=new t.a8(i);for(const t of e)t.recalculate(n,s)}function r(e,i){const s=t.l(e.request,((s,n,r,o)=>{if(s)i(s);else if(n)try{const e=new t.bw.VectorTile(new t.bv(n));i(null,{vectorTile:e,rawData:n,cacheControl:r,expires:o})}catch(t){const s=new Uint8Array(n);let r=`Unable to parse the tile at ${e.request.url}, `;r+=31===s[0]&&139===s[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${t.messge}`,i(new Error(r))}}));return()=>{s.cancel(),i()}}class o{constructor(t,e,i,s){this.actor=t,this.layerIndex=e,this.availableImages=i,this.loadVectorData=s||r,this.fetching={},this.loading={},this.loaded={}}loadTile(e,i){const n=e.uid;this.loading||(this.loading={});const r=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.bu(e.request),o=this.loading[n]=new s(e);o.abort=this.loadVectorData(e,((e,s)=>{if(delete this.loading[n],e||!s)return o.status="done",this.loaded[n]=o,i(e);const a=s.rawData,l={};s.expires&&(l.expires=s.expires),s.cacheControl&&(l.cacheControl=s.cacheControl);const c={};if(r){const t=r.finish();t&&(c.resourceTiming=JSON.parse(JSON.stringify(t)))}o.vectorTile=s.vectorTile,o.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,((e,s)=>{if(delete this.fetching[n],e||!s)return i(e);i(null,t.e({rawTileData:a.slice(0)},s,l,c))})),this.loaded=this.loaded||{},this.loaded[n]=o,this.fetching[n]={rawTileData:a,cacheControl:l,resourceTiming:c}}))}reloadTile(e,i){const s=this.loaded,n=e.uid;if(s&&s[n]){const r=s[n];r.showCollisionBoxes=e.showCollisionBoxes,"parsing"===r.status?r.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,((e,s)=>{if(e||!s)return i(e,s);let r;if(this.fetching[n]){const{rawTileData:e,cacheControl:i,resourceTiming:o}=this.fetching[n];delete this.fetching[n],r=t.e({rawTileData:e.slice(0)},s,i,o)}else r=s;i(null,r)})):"done"===r.status&&(r.vectorTile?r.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,i):i())}}abortTile(t,e){const i=this.loading,s=t.uid;i&&i[s]&&i[s].abort&&(i[s].abort(),delete i[s]),e()}removeTile(t,e){const i=this.loaded,s=t.uid;i&&i[s]&&delete i[s],e()}}class a{constructor(){this.loaded={}}loadTile(e,i){return t._(this,void 0,void 0,(function*(){const{uid:s,encoding:n,rawImageData:r,redFactor:o,greenFactor:a,blueFactor:l,baseShift:c}=e,g=r.width+2,h=r.height+2,u=t.a(r)?new t.R({width:g,height:h},yield t.bx(r,-1,-1,g,h)):r,d=new t.by(s,u,n,o,a,l,c);this.loaded=this.loaded||{},this.loaded[s]=d,i(null,d)}))}removeTile(t){const e=this.loaded,i=t.uid;e&&e[i]&&delete e[i]}}function l(t,e){if(0!==t.length){c(t[0],e);for(var i=1;i=Math.abs(a)?i-l+a:a-l+i,i=l}i+s>=0!=!!e&&t.reverse()}var g=t.bz((function t(e,i){var s,n=e&&e.type;if("FeatureCollection"===n)for(s=0;s>31}function S(t,e){for(var i=t.loadGeometry(),s=t.type,n=0,r=0,o=i.length,a=0;at},G=Math.fround||(R=new Float32Array(1),t=>(R[0]=+t,R[0]));var R;const T=3,V=5,W=6;class z{constructor(t){this.options=Object.assign(Object.create(Z),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){const{log:e,minZoom:i,maxZoom:s}=this.options;e&&console.time("total time");const n=`prepare ${t.length} points`;e&&console.time(n),this.points=t;const r=[];for(let e=0;e=i;t--)o=this.trees[t]=this._createTree(this._cluster(o,t));return e&&console.timeEnd("total time"),this}getClusters(t,e){let i=((t[0]+180)%360+360)%360-180;const s=Math.max(-90,Math.min(90,t[1]));let n=180===t[2]?180:((t[2]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)i=-180,n=180;else if(i>n){const t=this.getClusters([i,s,180,r],e),o=this.getClusters([-180,s,n,r],e);return t.concat(o)}const o=this.trees[this._limitZoom(e)],a=o.range(F(i),K(r),F(n),K(s)),l=o.data,c=[];for(const t of a){const e=this.stride*t;c.push(l[e+V]>1?J(l,e,this.clusterProps):this.points[l[e+T]])}return c}getChildren(t){const e=this._getOriginId(t),i=this._getOriginZoom(t),s="No cluster with the specified id.",n=this.trees[i];if(!n)throw new Error(s);const r=n.data;if(e*this.stride>=r.length)throw new Error(s);const o=this.options.radius/(this.options.extent*Math.pow(2,i-1)),a=n.within(r[e*this.stride],r[e*this.stride+1],o),l=[];for(const e of a){const i=e*this.stride;r[i+4]===t&&l.push(r[i+V]>1?J(r,i,this.clusterProps):this.points[r[i+T]])}if(0===l.length)throw new Error(s);return l}getLeaves(t,e,i){const s=[];return this._appendLeaves(s,t,e=e||10,i=i||0,0),s}getTile(t,e,i){const s=this.trees[this._limitZoom(t)],n=Math.pow(2,t),{extent:r,radius:o}=this.options,a=o/r,l=(i-a)/n,c=(i+1+a)/n,g={features:[]};return this._addTileFeatures(s.range((e-a)/n,l,(e+1+a)/n,c),s.data,e,i,n,g),0===e&&this._addTileFeatures(s.range(1-a/n,l,1,c),s.data,n,i,n,g),e===n-1&&this._addTileFeatures(s.range(0,l,a/n,c),s.data,-1,i,n,g),g.features.length?g:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const i=this.getChildren(t);if(e++,1!==i.length)break;t=i[0].properties.cluster_id}return e}_appendLeaves(t,e,i,s,n){const r=this.getChildren(e);for(const e of r){const r=e.properties;if(r&&r.cluster?n+r.point_count<=s?n+=r.point_count:n=this._appendLeaves(t,r.cluster_id,i,s,n):n1;let l,c,g;if(a)l=M(e,t,this.clusterProps),c=e[t],g=e[t+1];else{const i=this.points[e[t+T]];l=i.properties;const[s,n]=i.geometry.coordinates;c=F(s),g=K(n)}const h={type:1,geometry:[[Math.round(this.options.extent*(c*n-i)),Math.round(this.options.extent*(g*n-s))]],tags:l};let u;u=a||this.options.generateId?e[t+T]:this.points[e[t+T]].id,void 0!==u&&(h.id=u),r.features.push(h)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,e){const{radius:i,extent:s,reduce:n,minPoints:r}=this.options,o=i/(s*Math.pow(2,e)),a=t.data,l=[],c=this.stride;for(let i=0;ie&&(d+=a[i+V])}if(d>u&&d>=r){let t,r=s*u,o=g*u,p=-1;const m=(i/c<<5)+(e+1)+this.points.length;for(const s of h){const l=s*c;if(a[l+2]<=e)continue;a[l+2]=e;const g=a[l+V];r+=a[l]*g,o+=a[l+1]*g,a[l+4]=m,n&&(t||(t=this._map(a,i,!0),p=this.clusterProps.length,this.clusterProps.push(t)),n(t,this._map(a,l)))}a[i+4]=m,l.push(r/d,o/d,1/0,m,-1,d),n&&l.push(p)}else{for(let t=0;t1)for(const t of h){const i=t*c;if(!(a[i+2]<=e)){a[i+2]=e;for(let t=0;t>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e,i){if(t[e+V]>1){const s=this.clusterProps[t[e+W]];return i?Object.assign({},s):s}const s=this.points[t[e+T]].properties,n=this.options.map(s);return i&&n===s?Object.assign({},n):n}}function J(t,e,i){return{type:"Feature",id:t[e+T],properties:M(t,e,i),geometry:{type:"Point",coordinates:[(s=t[e],360*(s-.5)),L(t[e+1])]}};var s}function M(t,e,i){const s=t[e+V],n=s>=1e4?`${Math.round(s/1e3)}k`:s>=1e3?Math.round(s/100)/10+"k":s,r=t[e+W],o=-1===r?{}:Object.assign({},i[r]);return Object.assign(o,{cluster:!0,cluster_id:t[e+T],point_count:s,point_count_abbreviated:n})}function F(t){return t/360+.5}function K(t){const e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function L(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function P(t,e,i,s){for(var n,r=s,o=i-e>>1,a=i-e,l=t[e],c=t[e+1],g=t[i],h=t[i+1],u=e+3;ur)n=u,r=d;else if(d===r){var p=Math.abs(u-o);ps&&(n-e>3&&P(t,e,n,s),t[n+2]=r,i-n>3&&P(t,n,i,s))}function X(t,e,i,s,n,r){var o=n-i,a=r-s;if(0!==o||0!==a){var l=((t-i)*o+(e-s)*a)/(o*o+a*a);l>1?(i=n,s=r):l>0&&(i+=o*l,s+=a*l)}return(o=t-i)*o+(a=e-s)*a}function H(t,e,i,s){var n={id:void 0===t?null:t,type:e,geometry:i,tags:s,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,i=t.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)E(t,e);else if("Polygon"===i||"MultiLineString"===i)for(var s=0;s0&&(o+=s?(n*c-l*r)/2:Math.sqrt(Math.pow(l-n,2)+Math.pow(c-r,2))),n=l,r=c}var g=e.length-3;e[2]=1,P(e,0,g,i),e[g+2]=1,e.size=Math.abs(o),e.start=0,e.end=e.size}function O(t,e,i,s){for(var n=0;n1?1:i}function Q(t,e,i,s,n,r,o,a){if(s/=e,r>=(i/=e)&&o=s)return null;for(var l=[],c=0;c=i&&p=s)){var m=[];if("Point"===u||"MultiPoint"===u)q(h,m,i,s,n);else if("LineString"===u)$(h,m,i,s,n,!1,a.lineMetrics);else if("MultiLineString"===u)et(h,m,i,s,n,!1);else if("Polygon"===u)et(h,m,i,s,n,!0);else if("MultiPolygon"===u)for(var I=0;I=i&&o<=s&&(e.push(t[r]),e.push(t[r+1]),e.push(t[r+2]))}}function $(t,e,i,s,n,r,o){for(var a,l,c=tt(t),g=0===n?st:nt,h=t.start,u=0;ui&&(l=g(c,d,p,I,C,i),o&&(c.start=h+a*l)):f>s?A=i&&(l=g(c,d,p,I,C,i),y=!0),A>s&&f<=s&&(l=g(c,d,p,I,C,s),y=!0),!r&&y&&(o&&(c.end=h+a*l),e.push(c),c=tt(t)),o&&(h+=a)}var b=t.length-3;d=t[b],p=t[b+1],m=t[b+2],(f=0===n?d:p)>=i&&f<=s&&it(c,d,p,m),b=c.length-3,r&&b>=3&&(c[b]!==c[0]||c[b+1]!==c[1])&&it(c,c[0],c[1],c[2]),c.length&&e.push(c)}function tt(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function et(t,e,i,s,n,r){for(var o=0;oo.maxX&&(o.maxX=g),h>o.maxY&&(o.maxY=h)}return o}function gt(t,e,i,s){var n=e.geometry,r=e.type,o=[];if("Point"===r||"MultiPoint"===r)for(var a=0;a0&&e.size<(n?o:s))i.numPoints+=e.length/3;else{for(var a=[],l=0;lo)&&(i.numSimplified++,a.push(e[l]),a.push(e[l+1])),i.numPoints++;n&&function(t,e){for(var i=0,s=0,n=t.length,r=n-2;s0===e)for(s=0,n=t.length;s24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var s=function(t,e){var i=[];if("FeatureCollection"===t.type)for(var s=0;s1&&console.time("creation"),u=this.tiles[h]=ct(t,e,i,s,l),this.tileCoords.push({z:e,x:i,y:s}),c)){c>1&&console.timeEnd("creation");var d="z"+e;this.stats[d]=(this.stats[d]||0)+1,this.total++}if(u.source=t,n){if(e===l.maxZoom||e===n)continue;var p=1<1&&console.time("clipping");var m,I,C,f,A,y,b=.5*l.buffer/l.extent,_=.5-b,v=.5+b,x=1+b;m=I=C=f=null,A=Q(t,g,i-b,i+v,0,u.minX,u.maxX,l),y=Q(t,g,i+_,i+x,0,u.minX,u.maxX,l),t=null,A&&(m=Q(A,g,s-b,s+v,1,u.minY,u.maxY,l),I=Q(A,g,s+_,s+x,1,u.minY,u.maxY,l),A=null),y&&(C=Q(y,g,s-b,s+v,1,u.minY,u.maxY,l),f=Q(y,g,s+_,s+x,1,u.minY,u.maxY,l),y=null),c>1&&console.timeEnd("clipping"),a.push(m||[],e+1,2*i,2*s),a.push(I||[],e+1,2*i,2*s+1),a.push(C||[],e+1,2*i+1,2*s),a.push(f||[],e+1,2*i+1,2*s+1)}}},ut.prototype.getTile=function(t,e,i){var s=this.options,n=s.extent,r=s.debug;if(t<0||t>24)return null;var o=1<0;)c--,g=Math.floor(g/2),h=Math.floor(h/2),l=this.tiles[dt(c,g,h)];return l&&l.source?(r>1&&console.time("drilling down"),this.splitTile(l.source,c,g,h,t,e,i),r>1&&console.timeEnd("drilling down"),this.tiles[a]?at(this.tiles[a],n):null):null};class Ct extends o{constructor(e,i,s,n){super(e,i,s),this._dataUpdateable=new Map,this.loadGeoJSON=(e,i)=>{const{promoteId:s}=e;if(e.request)return t.f(e.request,((t,e,n,r)=>{this._dataUpdateable=mt(e,s)?It(e,s):void 0,i(t,e,n,r)}));if("string"==typeof e.data)try{const t=JSON.parse(e.data);this._dataUpdateable=mt(t,s)?It(t,s):void 0,i(null,t)}catch(t){i(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`))}else e.dataDiff?this._dataUpdateable?(function(t,e,i){var s,n,r,o;if(e.removeAll&&t.clear(),e.remove)for(const i of e.remove)t.delete(i);if(e.add)for(const s of e.add){const e=pt(s,i);null!=e&&t.set(e,s)}if(e.update)for(const i of e.update){let e=t.get(i.id);if(null==e)continue;const a=!i.removeAllProperties&&((null===(s=i.removeProperties)||void 0===s?void 0:s.length)>0||(null===(n=i.addOrUpdateProperties)||void 0===n?void 0:n.length)>0);if((i.newGeometry||i.removeAllProperties||a)&&(e=Object.assign({},e),t.set(i.id,e),a&&(e.properties=Object.assign({},e.properties))),i.newGeometry&&(e.geometry=i.newGeometry),i.removeAllProperties)e.properties={};else if((null===(r=i.removeProperties)||void 0===r?void 0:r.length)>0)for(const t of i.removeProperties)Object.prototype.hasOwnProperty.call(e.properties,t)&&delete e.properties[t];if((null===(o=i.addOrUpdateProperties)||void 0===o?void 0:o.length)>0)for(const{key:t,value:s}of i.addOrUpdateProperties)e.properties[t]=s}}(this._dataUpdateable,e.dataDiff,s),i(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):i(new Error(`Cannot update existing geojson data in ${e.source}`)):i(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},this.loadVectorData=this.loadGeoJSONTile,n&&(this.loadGeoJSON=n)}loadGeoJSONTile(e,i){const s=e.tileID.canonical;if(!this._geoJSONIndex)return i(null,null);const n=this._geoJSONIndex.getTile(s.z,s.x,s.y);if(!n)return i(null,null);const r=new class{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=t.N,this.length=e.length,this._features=e}feature(e){return new class{constructor(e){this._feature=e,this.extent=t.N,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))}loadGeometry(){if(1===this._feature.type){const e=[];for(const i of this._feature.geometry)e.push([new t.P(i[0],i[1])]);return e}{const e=[];for(const i of this._feature.geometry){const s=[];for(const e of i)s.push(new t.P(e[0],e[1]));e.push(s)}return e}}toGeoJSON(t,e,i){return h.call(this,t,e,i)}}(this._features[e])}}(n.features);let o=B(r);0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),i(null,{vectorTile:r,rawData:o.buffer})}loadData(e,i){var s;null===(s=this._pendingRequest)||void 0===s||s.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const n=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.bu(e.request);this._pendingCallback=i,this._pendingRequest=this.loadGeoJSON(e,((s,r)=>{if(delete this._pendingCallback,delete this._pendingRequest,s||!r)return i(s);if("object"!=typeof r)return i(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`));{g(r,!0);try{if(e.filter){const i=t.bC(e.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===i.result)throw new Error(i.value.map((t=>`${t.key}: ${t.message}`)).join(", "));const s=r.features.filter((t=>i.value.evaluate({zoom:0},t)));r={type:"FeatureCollection",features:s}}this._geoJSONIndex=e.cluster?new z(function({superclusterOptions:e,clusterProperties:i}){if(!i||!e)return e;const s={},n={},r={accumulated:null,zoom:0},o={properties:null},a=Object.keys(i);for(const e of a){const[r,o]=i[e],a=t.bC(o),l=t.bC("string"==typeof r?[r,["accumulated"],["get",e]]:r);s[e]=a.value,n[e]=l.value}return e.map=t=>{o.properties=t;const e={};for(const t of a)e[t]=s[t].evaluate(r,o);return e},e.reduce=(t,e)=>{o.properties=e;for(const e of a)r.accumulated=t[e],t[e]=n[e].evaluate(r,o)},e}(e)).load(r.features):function(t,e){return new ut(t,e)}(r,e.geojsonVtOptions)}catch(s){return i(s)}this.loaded={};const o={};if(n){const t=n.finish();t&&(o.resourceTiming={},o.resourceTiming[e.source]=JSON.parse(JSON.stringify(t)))}i(null,o)}}))}reloadTile(t,e){const i=this.loaded;return i&&i[t.uid]?super.reloadTile(t,e):this.loadTile(t,e)}removeSource(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),e()}getClusterExpansionZoom(t,e){try{e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))}catch(t){e(t)}}getClusterChildren(t,e){try{e(null,this._geoJSONIndex.getChildren(t.clusterId))}catch(t){e(t)}}getClusterLeaves(t,e){try{e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))}catch(t){e(t)}}}class ft{constructor(e){this.self=e,this.actor=new t.C(e,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:o,geojson:Ct},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(t,e)=>{if(this.workerSourceTypes[t])throw new Error(`Worker source with name "${t}" already registered.`);this.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=e=>{if(t.bD.isParsed())throw new Error("RTL text plugin already registered.");t.bD.applyArabicShaping=e.applyArabicShaping,t.bD.processBidirectionalText=e.processBidirectionalText,t.bD.processStyledBidirectionalText=e.processStyledBidirectionalText}}setReferrer(t,e){this.referrer=e}setImages(t,e,i){this.availableImages[t]=e;for(const i in this.workerSources[t]){const s=this.workerSources[t][i];for(const t in s)s[t].availableImages=e}i()}setLayers(t,e,i){this.getLayerIndex(t).replace(e),i()}updateLayers(t,e,i){this.getLayerIndex(t).update(e.layers,e.removedIds),i()}loadTile(t,e,i){this.getWorkerSource(t,e.type,e.source).loadTile(e,i)}loadDEMTile(t,e,i){this.getDEMWorkerSource(t,e.source).loadTile(e,i)}reloadTile(t,e,i){this.getWorkerSource(t,e.type,e.source).reloadTile(e,i)}abortTile(t,e,i){this.getWorkerSource(t,e.type,e.source).abortTile(e,i)}removeTile(t,e,i){this.getWorkerSource(t,e.type,e.source).removeTile(e,i)}removeDEMTile(t,e){this.getDEMWorkerSource(t,e.source).removeTile(e)}removeSource(t,e,i){if(!this.workerSources[t]||!this.workerSources[t][e.type]||!this.workerSources[t][e.type][e.source])return;const s=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==s.removeSource?s.removeSource(e,i):i()}loadWorkerSource(t,e,i){try{this.self.importScripts(e.url),i()}catch(t){i(t.toString())}}syncRTLPluginState(e,i,s){try{t.bD.setState(i);const e=t.bD.getPluginURL();if(t.bD.isLoaded()&&!t.bD.isParsed()&&null!=e){this.self.importScripts(e);const i=t.bD.isParsed();s(i?void 0:new Error(`RTL Text Plugin failed to import scripts from ${e}`),i)}}catch(t){s(t.toString())}}getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}getLayerIndex(t){let i=this.layerIndexes[t];return i||(i=this.layerIndexes[t]=new e),i}getWorkerSource(t,e,i){return this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),this.workerSources[t][e][i]||(this.workerSources[t][e][i]=new this.workerSourceTypes[e]({send:(e,i,s)=>{this.actor.send(e,i,s,t)}},this.getLayerIndex(t),this.getAvailableImages(t))),this.workerSources[t][e][i]}getDEMWorkerSource(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new a),this.demWorkerSources[t][e]}}return t.i()&&(self.worker=new ft(self)),ft})),s(["./shared"],(function(t){var e="3.6.2";class i{static testProp(t){if(!i.docStyle)return t[0];for(let e=0;e{window.removeEventListener("click",i.suppressClickInternal,!0)}),0)}static mousePos(e,i){const s=e.getBoundingClientRect();return new t.P(i.clientX-s.left-e.clientLeft,i.clientY-s.top-e.clientTop)}static touchPos(e,i){const s=e.getBoundingClientRect(),n=[];for(let r=0;r{i=[],n=0,r=0,o={}},e.addThrottleControl=t=>{const e=r++;return o[e]=t,e},e.removeThrottleControl=t=>{delete o[t],c()},e.getImage=(t,e,r=!0)=>{s.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*");const o={requestParameters:t,supportImageRefresh:r,callback:e,cancelled:!1,completed:!1,cancel:()=>{o.completed||o.cancelled||(o.cancelled=!0,o.innerRequest&&(o.innerRequest.cancel(),n--),c())}};return i.push(o),c(),o};const a=e=>{const{requestParameters:i,supportImageRefresh:s,callback:n}=e;return t.e(i,{type:"image"}),(!1!==s||t.i()||t.g(i.url)||i.headers&&!Object.keys(i.headers).reduce(((t,e)=>t&&"accept"===e),!0)?t.m:g)(i,((t,i,s,r)=>{l(e,n,t,i,s,r)}))},l=(e,i,s,r,o,a)=>{s?i(s):r instanceof HTMLImageElement||t.a(r)?i(null,r):r&&((e,i)=>{"function"==typeof createImageBitmap?t.b(e,i):t.d(e,i)})(r,((t,e)=>{null!=t?i(t):null!=e&&i(null,e,{cacheControl:o,expires:a})})),e.cancelled||(e.completed=!0,n--,c())},c=()=>{const e=(()=>{const t=Object.keys(o);let e=!1;if(t.length>0)for(const i of t)if(e=o[i](),e)break;return e})()?t.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:t.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let t=n;t0;t++){const e=i.shift();if(e.cancelled){t--;continue}const s=a(e);n++,e.innerRequest=s}},g=(e,i)=>{const s=new Image,n=e.url;let r=!1;const o=e.credentials;return o&&"include"===o?s.crossOrigin="use-credentials":(o&&"same-origin"===o||!t.s(n))&&(s.crossOrigin="anonymous"),s.fetchPriority="high",s.onload=()=>{i(null,s),s.onerror=s.onload=null},s.onerror=()=>{r||i(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.")),s.onerror=s.onload=null},s.src=n,{cancel:()=>{r=!0,s.src=""}}}}(c||(c={})),c.resetRequestQueue(),function(t){t.Glyphs="Glyphs",t.Image="Image",t.Source="Source",t.SpriteImage="SpriteImage",t.SpriteJSON="SpriteJSON",t.Style="Style",t.Tile="Tile",t.Unknown="Unknown"}(g||(g={}));class h{constructor(t){this._transformRequestFn=t}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}normalizeSpriteURL(t,e,i){const s=function(t){const e=t.match(u);if(!e)throw new Error(`Unable to parse URL "${t}"`);return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}(t);return s.path+=`${e}${i}`,function(t){const e=t.params.length?`?${t.params.join("&")}`:"";return`${t.protocol}://${t.authority}${t.path}${e}`}(s)}setTransformRequest(t){this._transformRequestFn=t}}const u=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function d(e){var i=new t.A(3);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i}var p,m=function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t};p=new t.A(3),t.A!=Float32Array&&(p[0]=0,p[1]=0,p[2]=0);var I=function(t){var e=t[0],i=t[1];return e*e+i*i};function C(t){const e=[];if("string"==typeof t)e.push({id:"default",url:t});else if(t&&t.length>0){const i=[];for(const{id:s,url:n}of t){const t=`${s}${n}`;-1===i.indexOf(t)&&(i.push(t),e.push({id:s,url:n}))}}return e}function f(e,i,s,n,r){if(n)return void e(n);if(r!==Object.values(i).length||r!==Object.values(s).length)return;const o={};for(const e in i){o[e]={};const n=t.h.getImageCanvasContext(s[e]),r=i[e];for(const t in r){const{width:i,height:s,x:a,y:l,sdf:c,pixelRatio:g,stretchX:h,stretchY:u,content:d}=r[t];o[e][t]={data:null,pixelRatio:g,sdf:c,stretchX:h,stretchY:u,content:d,spriteData:{width:i,height:s,x:a,y:l,context:n}}}}e(null,o)}!function(){var e=new t.A(2);t.A!=Float32Array&&(e[0]=0,e[1]=0)}();class A{constructor(t,e,i,s){this.context=t,this.format=i,this.texture=t.gl.createTexture(),this.update(e,s)}update(e,i,s){const{width:n,height:r}=e,o=!(this.size&&this.size[0]===n&&this.size[1]===r||s),{context:a}=this,{gl:l}=a;if(this.useMipmap=Boolean(i&&i.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!i||!1!==i.premultiply)),o)this.size=[n,r],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.a(e)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,e):l.texImage2D(l.TEXTURE_2D,0,this.format,n,r,0,this.format,l.UNSIGNED_BYTE,e.data);else{const{x:i,y:o}=s||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.a(e)?l.texSubImage2D(l.TEXTURE_2D,0,i,o,l.RGBA,l.UNSIGNED_BYTE,e):l.texSubImage2D(l.TEXTURE_2D,0,i,o,n,r,l.RGBA,l.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D)}bind(t,e,i){const{context:s}=this,{gl:n}=s;n.bindTexture(n.TEXTURE_2D,this.texture),i!==n.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=n.LINEAR),t!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,i||t),this.filter=t),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function y(t){const{userImage:e}=t;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}class b extends t.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:t,callback:e}of this.requestors)this._notify(t,e);this.requestors=[]}}getImage(e){const i=this.images[e];if(i&&!i.data&&i.spriteData){const e=i.spriteData;i.data=new t.R({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),i.spriteData=null}return i}addImage(t,e){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,e)&&(this.images[t]=e)}_validate(e,i){let s=!0;const n=i.data||i.spriteData;return this._validateStretch(i.stretchX,n&&n.width)||(this.fire(new t.j(new Error(`Image "${e}" has invalid "stretchX" value`))),s=!1),this._validateStretch(i.stretchY,n&&n.height)||(this.fire(new t.j(new Error(`Image "${e}" has invalid "stretchY" value`))),s=!1),this._validateContent(i.content,i)||(this.fire(new t.j(new Error(`Image "${e}" has invalid "content" value`))),s=!1),s}_validateStretch(t,e){if(!t)return!0;let i=0;for(const s of t){if(s[0]-1);l++,r[l]=a,o[l]=c,o[l+1]=_}for(let a=0,l=0;a{let s=this.entries[t];s||(s=this.entries[t]={glyphs:{},requests:{},ranges:{}});let n=s.glyphs[e];if(void 0!==n)return void i(null,{stack:t,id:e,glyph:n});if(n=this._tinySDF(s,t,e),n)return s.glyphs[e]=n,void i(null,{stack:t,id:e,glyph:n});const r=Math.floor(e/256);if(256*r>65535)return void i(new Error("glyphs > 65535 not supported"));if(s.ranges[r])return void i(null,{stack:t,id:e,glyph:n});if(!this.url)return void i(new Error("glyphsUrl is not set"));let o=s.requests[r];o||(o=s.requests[r]=[],w.loadGlyphRange(t,r,this.url,this.requestManager,((t,e)=>{if(e){for(const t in e)this._doesCharSupportLocalGlyph(+t)||(s.glyphs[+t]=e[+t]);s.ranges[r]=!0}for(const i of o)i(t,e);delete s.requests[r]}))),o.push(((s,n)=>{s?i(s):n&&i(null,{stack:t,id:e,glyph:n[e]||null})}))}),((t,e)=>{if(t)i(t);else if(e){const t={};for(const{stack:i,id:s,glyph:n}of e)(t[i]||(t[i]={}))[s]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics};i(null,t)}}))}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(t.u["CJK Unified Ideographs"](e)||t.u["Hangul Syllables"](e)||t.u.Hiragana(e)||t.u.Katakana(e))}_tinySDF(e,i,s){const n=this.localIdeographFontFamily;if(!n)return;if(!this._doesCharSupportLocalGlyph(s))return;let r=e.tinySDF;if(!r){let t="400";/bold/i.test(i)?t="900":/medium/i.test(i)?t="500":/light/i.test(i)&&(t="200"),r=e.tinySDF=new w.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:n,fontWeight:t})}const o=r.draw(String.fromCharCode(s));return{id:s,bitmap:new t.q({width:o.width||60,height:o.height||60},o.data),metrics:{width:o.glyphWidth/2||24,height:o.glyphHeight/2||24,left:o.glyphLeft/2+.5||0,top:o.glyphTop/2-27.5||-8,advance:o.glyphAdvance/2||24,isDoubleResolution:!0}}}}w.loadGlyphRange=function(e,i,s,n,r){const o=256*i,a=o+255,l=n.transformRequest(s.replace("{fontstack}",e).replace("{range}",`${o}-${a}`),g.Glyphs);t.l(l,((e,i)=>{if(e)r(e);else if(i){const e={};for(const s of t.n(i))e[s.id]=s;r(null,e)}}))},w.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:s=.25,fontFamily:n="sans-serif",fontWeight:r="normal",fontStyle:o="normal"}={}){this.buffer=e,this.cutoff=s,this.radius=i;const a=this.size=t+4*e,l=this._createCanvas(a),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${o} ${r} ${t}px ${n}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a)}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:s,actualBoundingBoxLeft:n,actualBoundingBoxRight:r}=this.ctx.measureText(t),o=Math.ceil(i),a=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(r-n))),l=Math.min(this.size-this.buffer,o+Math.ceil(s)),c=a+2*this.buffer,g=l+2*this.buffer,h=Math.max(c*g,0),u=new Uint8ClampedArray(h),d={data:u,width:c,height:g,glyphWidth:a,glyphHeight:l,glyphTop:o,glyphLeft:0,glyphAdvance:e};if(0===a||0===l)return d;const{ctx:p,buffer:m,gridInner:I,gridOuter:C}=this;p.clearRect(m,m,a,l),p.fillText(t,m,m+o);const f=p.getImageData(m,m,a,l);C.fill(_,0,h),I.fill(0,0,h);for(let t=0;t0?t*t:0,I[s]=t<0?t*t:0}}v(C,0,0,c,g,c,this.f,this.v,this.z),v(I,m,m,a,l,c,this.f,this.v,this.z);for(let t=0;t1&&(o=t[++r]);const l=Math.abs(a-o.left),c=Math.abs(a-o.right),g=Math.min(l,c);let h;const u=e/i*(s+1);if(o.isDash){const t=s-Math.abs(u);h=Math.sqrt(g*g+t*t)}else h=s-Math.sqrt(g*g+u*u);this.data[n+a]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(t){for(let e=t.length-1;e>=0;--e){const i=t[e],s=t[e+1];i.zeroLength?t.splice(e,1):s&&s.isDash===i.isDash&&(s.left=i.left,t.splice(e,1))}const e=t[0],i=t[t.length-1];e.isDash===i.isDash&&(e.left=i.left-this.width,i.right=e.right+this.width);const s=this.width*this.nextRow;let n=0,r=t[n];for(let e=0;e1&&(r=t[++n]);const i=Math.abs(e-r.left),o=Math.abs(e-r.right),a=Math.min(i,o);this.data[s+e]=Math.max(0,Math.min(255,(r.isDash?a:-a)+128))}}addDash(e,i){const s=i?7:0,n=2*s+1;if(this.nextRow+n>this.height)return t.w("LineAtlas out of space"),null;let r=0;for(let t=0;t{t.send(e,i,s)}),s=s||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach((t=>{t.remove()})),this.actors=[],t&&this.workerPool.release(this.id)}}function R(e,i,s){const n=function(i,n){if(i)return s(i);if(n){const i=t.F(t.e(n,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);n.vector_layers&&(i.vectorLayers=n.vector_layers,i.vectorLayerIds=i.vectorLayers.map((t=>t.id))),s(null,i)}};return e.url?t.f(i.transformRequest(e.url,g.Source),n):t.h.frame((()=>n(null,e)))}class T{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):Array.isArray(t)&&(4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(e){return this._ne=e instanceof t.L?new t.L(e.lng,e.lat):t.L.convert(e),this}setSouthWest(e){return this._sw=e instanceof t.L?new t.L(e.lng,e.lat):t.L.convert(e),this}extend(e){const i=this._sw,s=this._ne;let n,r;if(e instanceof t.L)n=e,r=e;else{if(!(e instanceof T))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(T.convert(e)):this.extend(t.L.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(t.L.convert(e)):this;if(n=e._sw,r=e._ne,!n||!r)return this}return i||s?(i.lng=Math.min(n.lng,i.lng),i.lat=Math.min(n.lat,i.lat),s.lng=Math.max(r.lng,s.lng),s.lat=Math.max(r.lat,s.lat)):(this._sw=new t.L(n.lng,n.lat),this._ne=new t.L(r.lng,r.lat)),this}getCenter(){return new t.L((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new t.L(this.getWest(),this.getNorth())}getSouthEast(){return new t.L(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:s}=t.L.convert(e);let n=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=s&&s<=this._ne.lat&&n}static convert(t){return t instanceof T?t:t?new T(t):t}static fromLngLat(e,i=0){const s=360*i/40075017,n=s/Math.cos(Math.PI/180*e.lat);return new T(new t.L(e.lng-n,e.lat-s),new t.L(e.lng+n,e.lat+s))}}class V{constructor(t,e,i){this.bounds=T.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=i||24}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(e){const i=Math.pow(2,e.z),s=Math.floor(t.G(this.bounds.getWest())*i),n=Math.floor(t.H(this.bounds.getNorth())*i),r=Math.ceil(t.G(this.bounds.getEast())*i),o=Math.ceil(t.H(this.bounds.getSouth())*i);return e.x>=s&&e.x=n&&e.y{this._loaded=!1,this.fire(new t.k("dataloading",{dataType:"source"})),this._tileJSONRequest=R(this._options,this.map._requestManager,((e,i)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e?this.fire(new t.j(e)):i&&(t.e(this,i),i.bounds&&(this.tileBounds=new V(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.k("data",{dataType:"source",sourceDataType:"content"})))}))},this.serialize=()=>t.e({},this._options),this.id=e,this.dispatcher=s,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.e(this,t.F(i,["url","scheme","tileSize","promoteId"])),this._options=t.e({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n)}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}loadTile(t,e){const i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s={request:this.map._requestManager.transformRequest(i,g.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function n(i,s){return delete t.request,t.aborted?e(null):i&&404!==i.status?e(i):(s&&s.resourceTiming&&(t.resourceTiming=s.resourceTiming),this.map._refreshExpiredTiles&&s&&t.setExpiryData(s),t.loadVectorData(s,this.map.painter),e(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}s.request.collectResourceTiming=this._collectResourceTiming,t.actor&&"expired"!==t.state?"loading"===t.state?t.reloadCallback=e:t.request=t.actor.send("reloadTile",s,n.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",s,n.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class z extends t.E{constructor(e,i,s,n){super(),this.id=e,this.dispatcher=s,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=t.e({type:"raster"},i),t.e(this,t.F(i,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new t.k("dataloading",{dataType:"source"})),this._tileJSONRequest=R(this._options,this.map._requestManager,((e,i)=>{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new t.j(e)):i&&(t.e(this,i),i.bounds&&(this.tileBounds=new V(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.k("data",{dataType:"source",sourceDataType:"content"})))}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}serialize(){return t.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,e){const i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=c.getImage(this.map._requestManager.transformRequest(i,g.Tile),((i,s,n)=>{if(delete t.request,t.aborted)t.state="unloaded",e(null);else if(i)t.state="errored",e(i);else if(s){this.map._refreshExpiredTiles&&n&&t.setExpiryData(n);const i=this.map.painter.context,r=i.gl;t.texture=this.map.painter.getTileTexture(s.width),t.texture?t.texture.update(s,{useMipmap:!0}):(t.texture=new A(i,s,r.RGBA,{useMipmap:!0}),t.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_NEAREST),i.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,i.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,i.extTextureFilterAnisotropicMax)),t.state="loaded",e(null)}}),this.map._refreshExpiredTiles)}abortTile(t,e){t.request&&(t.request.cancel(),delete t.request),e()}unloadTile(t,e){t.texture&&this.map.painter.saveTileTexture(t.texture),e()}hasTransition(){return!1}}class J extends z{constructor(e,i,s,n){super(e,i,s,n),this.type="raster-dem",this.maxzoom=22,this._options=t.e({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift}loadTile(e,i){const s=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),n=this.map._requestManager.transformRequest(s,g.Tile);function r(t,s){t&&(e.state="errored",i(t)),s&&(e.dem=s,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded",i(null))}e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.request=c.getImage(n,((s,n,o)=>t._(this,void 0,void 0,(function*(){if(delete e.request,e.aborted)e.state="unloaded",i(null);else if(s)e.state="errored",i(s);else if(n){this.map._refreshExpiredTiles&&e.setExpiryData(o);const i=t.a(n)&&t.J()?n:yield function(e){return t._(this,void 0,void 0,(function*(){if("undefined"!=typeof VideoFrame&&t.K()){const i=e.width+2,s=e.height+2;try{return new t.R({width:i,height:s},yield t.M(e,-1,-1,i,s))}catch(t){}}return t.h.getImageData(e,1)}))}(n),s={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:i,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",s,r))}}))),this.map._refreshExpiredTiles)}_getNeighboringTiles(e){const i=e.canonical,s=Math.pow(2,i.z),n=(i.x-1+s)%s,r=0===i.x?e.wrap-1:e.wrap,o=(i.x+1+s)%s,a=i.x+1===s?e.wrap+1:e.wrap,l={};return l[new t.O(e.overscaledZ,r,i.z,n,i.y).key]={backfilled:!1},l[new t.O(e.overscaledZ,a,i.z,o,i.y).key]={backfilled:!1},i.y>0&&(l[new t.O(e.overscaledZ,r,i.z,n,i.y-1).key]={backfilled:!1},l[new t.O(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.O(e.overscaledZ,a,i.z,o,i.y-1).key]={backfilled:!1}),i.y+1{this._updateWorkerData()},this.serialize=()=>t.e({},this._options,{type:this.type,data:this._data}),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=s.getActor(),this.setEventedParent(n),this._data=i.data,this._options=t.e({},i),this._collectResourceTiming=i.collectResourceTiming,void 0!==i.maxzoom&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId;const r=t.N/this.tileSize;this.workerOptions=t.e({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:(void 0!==i.buffer?i.buffer:128)*r,tolerance:(void 0!==i.tolerance?i.tolerance:.375)*r,extent:t.N,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:void 0!==i.clusterMaxZoom?i.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:t.N,radius:(i.clusterRadius||50)*r,log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions),"string"==typeof this.promoteId&&(this.workerOptions.promoteId=this.promoteId)}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t&&(void 0!==t.clusterRadius&&(this.workerOptions.superclusterOptions.radius=t.clusterRadius),void 0!==t.clusterMaxZoom&&(this.workerOptions.superclusterOptions.maxZoom=t.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(t,e){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e),this}getClusterChildren(t,e){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e),this}getClusterLeaves(t,e,i,s){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:i},s),this}_updateWorkerData(e){const i=t.e({},this.workerOptions);e?i.dataDiff=e:"string"==typeof this._data?(i.request=this.map._requestManager.transformRequest(t.h.resolveURL(this._data),g.Source),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new t.k("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,i,((e,i)=>{if(this._pendingLoads--,this._removed||i&&i.abandoned)return void this.fire(new t.k("dataabort",{dataType:"source"}));let s=null;if(i&&i.resourceTiming&&i.resourceTiming[this.id]&&(s=i.resourceTiming[this.id].slice(0)),e)return void this.fire(new t.j(e));const n={dataType:"source"};this._collectResourceTiming&&s&&s.length>0&&t.e(n,{resourceTiming:s}),this.fire(new t.k("data",Object.assign(Object.assign({},n),{sourceDataType:"metadata"}))),this.fire(new t.k("data",Object.assign(Object.assign({},n),{sourceDataType:"content"})))}))}loaded(){return 0===this._pendingLoads}loadTile(t,e){const i=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const s={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(i,s,((s,n)=>(delete t.request,t.unloadVectorData(),t.aborted?e(null):s?e(s):(t.loadVectorData(n,this.map.painter,"reloadTile"===i),e(null)))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}hasTransition(){return!1}}var F=t.Q([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class K extends t.E{constructor(e,i,s,n){super(),this.load=(e,i)=>{this._loaded=!1,this.fire(new t.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=c.getImage(this.map._requestManager.transformRequest(this.url,g.Image),((s,n)=>{this._request=null,this._loaded=!0,s?this.fire(new t.j(s)):n&&(this.image=n,e&&(this.coordinates=e),i&&i(),this._finishLoading())}))},this.prepare=()=>{if(0===Object.keys(this.tiles).length||!this.image)return;const e=this.map.painter.context,i=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,F.members)),this.boundsSegments||(this.boundsSegments=t.S.simpleSegment(0,0,4,2)),this.texture||(this.texture=new A(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let s=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,s=!0)}s&&this.fire(new t.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"image",url:this.options.url,coordinates:this.coordinates}),this.id=e,this.dispatcher=s,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(n),this.options=i}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=t.url,this.load(t.coordinates,(()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(e){this.coordinates=e;const i=e.map(t.U.fromLngLat);this.tileID=function(e){let i=1/0,s=1/0,n=-1/0,r=-1/0;for(const t of e)i=Math.min(i,t.x),s=Math.min(s,t.y),n=Math.max(n,t.x),r=Math.max(r,t.y);const o=Math.max(n-i,r-s),a=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),l=Math.pow(2,a);return new t.W(a,Math.floor((i+n)/2*l),Math.floor((s+r)/2*l))}(i),this.minzoom=this.maxzoom=this.tileID.z;const s=i.map((t=>this.tileID.getTilePoint(t)._round()));return this._boundsArray=new t.V,this._boundsArray.emplaceBack(s[0].x,s[0].y,0,0),this._boundsArray.emplaceBack(s[1].x,s[1].y,t.N,0),this._boundsArray.emplaceBack(s[3].x,s[3].y,0,t.N),this._boundsArray.emplaceBack(s[2].x,s[2].y,t.N,t.N),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new t.k("data",{dataType:"source",sourceDataType:"content"})),this}loadTile(t,e){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},e(null)):(t.state="errored",e(null))}hasTransition(){return!1}}class L extends K{constructor(e,i,s,n){super(e,i,s,n),this.load=()=>{this._loaded=!1;const e=this.options;this.urls=[];for(const t of e.urls)this.urls.push(this.map._requestManager.transformRequest(t,g.Source).url);t.X(this.urls,((e,i)=>{this._loaded=!0,e?this.fire(new t.j(e)):i&&(this.video=i,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading())}))},this.prepare=()=>{if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const e=this.map.painter.context,i=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,F.members)),this.boundsSegments||(this.boundsSegments=t.S.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new A(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let s=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,s=!0)}s&&this.fire(new t.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"video",urls:this.urls,coordinates:this.coordinates}),this.roundZoom=!0,this.type="video",this.options=i}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const i=this.video.seekable;ei.end(0)?this.fire(new t.j(new t.Y(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}hasTransition(){return this.video&&!this.video.paused}}class P extends K{constructor(e,i,s,n){super(e,i,s,n),this.load=()=>{this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())},this.prepare=()=>{let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context,s=i.gl;this.boundsBuffer||(this.boundsBuffer=i.createVertexBuffer(this._boundsArray,F.members)),this.boundsSegments||(this.boundsSegments=t.S.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new A(i,this.canvas,s.RGBA,{premultiply:!0});let n=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,n=!0)}n&&this.fire(new t.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"canvas",coordinates:this.coordinates}),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some((t=>!Array.isArray(t)||2!==t.length||t.some((t=>"number"!=typeof t))))||this.fire(new t.j(new t.Y(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.j(new t.Y(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new t.j(new t.Y(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new t.j(new t.Y(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.j(new t.Y(`sources.${e}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const X={},H=t=>{switch(t){case"geojson":return M;case"image":return K;case"raster":return z;case"raster-dem":return J;case"vector":return W;case"video":return L;case"canvas":return P}return X[t]};function E(e,i){const s=t.Z();return t.$(s,s,[1,1,0]),t.a0(s,s,[.5*e.width,.5*e.height,1]),t.a1(s,s,e.calculatePosMatrix(i.toUnwrapped()))}function D(t,e,i,s,n,r){const o=function(t,e,i){if(t)for(const s of t){const t=e[s];if(t&&t.source===i&&"fill-extrusion"===t.type)return!0}else for(const t in e){const s=e[t];if(s.source===i&&"fill-extrusion"===s.type)return!0}return!1}(n&&n.layers,e,t.id),a=r.maxPitchScaleFactor(),l=t.tilesIn(s,a,o);l.sort(Y);const c=[];for(const s of l)c.push({wrappedTileID:s.tileID.wrapped().key,queryResults:s.tile.queryRenderedFeatures(e,i,t._state,s.queryGeometry,s.cameraQueryGeometry,s.scale,n,r,a,E(t.transform,s.tileID))});const g=function(t){const e={},i={};for(const s of t){const t=s.queryResults,n=s.wrappedTileID,r=i[n]=i[n]||{};for(const i in t){const s=t[i],n=r[i]=r[i]||{},o=e[i]=e[i]||[];for(const t of s)n[t.featureIndex]||(n[t.featureIndex]=!0,o.push(t))}}return e}(c);for(const e in g)g[e].forEach((e=>{const i=e.feature,s=t.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=s}));return g}function Y(t,e){const i=t.tileID,s=e.tileID;return i.overscaledZ-s.overscaledZ||i.canonical.y-s.canonical.y||i.wrap-s.wrap||i.canonical.x-s.canonical.x}class N{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=t.a2(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const e=t+this.timeAdded;ee.getLayer(t))).filter(Boolean);if(0!==t.length){s.layers=t,s.stateDependentLayerIds&&(s.stateDependentLayers=s.stateDependentLayerIds.map((e=>t.filter((t=>t.id===e))[0])));for(const e of t)i[e.id]=s}}return i}(e.buckets,i.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.a4){if(this.hasSymbolBuckets=!0,!s)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.a4&&i.hasRTLText){this.hasRTLText=!0,t.a5();break}}this.queryPadding=0;for(const t in this.buckets){const e=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(t).queryRadius(e))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new t.a3}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const e in this.buckets){const i=this.buckets[e];i.uploadPending()&&i.upload(t)}const e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new A(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new A(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,i,s,n,r,o,a,l,c){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:s,cameraQueryGeometry:n,scale:r,tileSize:this.tileSize,pixelPosMatrix:c,transform:a,params:o,queryPadding:this.queryPadding*l},t,e,i):{}}querySourceFeatures(e,i){const s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;const n=s.loadVTLayers(),r=i&&i.sourceLayer?i.sourceLayer:"",o=n._geojsonTileLayer||n[r];if(!o)return;const a=t.a6(i&&i.filter),{z:l,x:c,y:g}=this.tileID.canonical,h={z:l,x:c,y:g};for(let i=0;it)e=!1;else if(i)if(this.expirationTime{this.remove(t,n)}),i)),this.data[s].push(n),this.order.push(s),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const i=t.wrapped().key,s=void 0===e?0:this.data[i].indexOf(e),n=this.data[i][s];return this.data[i].splice(s,1),n.timeout&&clearTimeout(n.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(n.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(t){const e=[];for(const i in this.data)for(const s of this.data[i])t(s.value)||e.push(s);for(const t of e)this.remove(t.value.tileID,t)}}class U{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,s){const n=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][n]=this.stateChanges[e][n]||{},t.e(this.stateChanges[e][n],s),null===this.deletedStates[e]){this.deletedStates[e]={};for(const t in this.state[e])t!==n&&(this.deletedStates[e][t]=null)}else if(this.deletedStates[e]&&null===this.deletedStates[e][n]){this.deletedStates[e][n]={};for(const t in this.state[e][n])s[t]||(this.deletedStates[e][n][t]=null)}else for(const t in s)this.deletedStates[e]&&this.deletedStates[e][n]&&null===this.deletedStates[e][n][t]&&delete this.deletedStates[e][n][t]}removeFeatureState(t,e,i){if(null===this.deletedStates[t])return;const s=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},i&&void 0!==e)null!==this.deletedStates[t][s]&&(this.deletedStates[t][s]=this.deletedStates[t][s]||{},this.deletedStates[t][s][i]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][s])for(i in this.deletedStates[t][s]={},this.stateChanges[t][s])this.deletedStates[t][s][i]=null;else this.deletedStates[t][s]=null;else this.deletedStates[t]=null}getState(e,i){const s=String(i),n=t.e({},(this.state[e]||{})[s],(this.stateChanges[e]||{})[s]);if(null===this.deletedStates[e])return{};if(this.deletedStates[e]){const t=this.deletedStates[e][i];if(null===t)return{};for(const e in t)delete n[e]}return n}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(e,i){const s={};for(const e in this.stateChanges){this.state[e]=this.state[e]||{};const i={};for(const s in this.stateChanges[e])this.state[e][s]||(this.state[e][s]={}),t.e(this.state[e][s],this.stateChanges[e][s]),i[s]=this.state[e][s];s[e]=i}for(const e in this.deletedStates){this.state[e]=this.state[e]||{};const i={};if(null===this.deletedStates[e])for(const t in this.state[e])i[t]={},this.state[e][t]={};else for(const t in this.deletedStates[e]){if(null===this.deletedStates[e][t])this.state[e][t]={};else for(const i of Object.keys(this.deletedStates[e][t]))delete this.state[e][t][i];i[t]=this.state[e][t]}s[e]=s[e]||{},t.e(s[e],i)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(s).length)for(const t in e)e[t].setFeatureState(s,i)}}class j extends t.E{constructor(t,e,i){super(),this.id=t,this.dispatcher=i,this.on("data",(t=>{"source"===t.dataType&&"metadata"===t.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===t.dataType&&"content"===t.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)})),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((t,e,i,s)=>{const n=new(H(e.type))(t,e,i,s);if(n.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${n.id}`);return n})(t,e,i,this),this._tiles={},this._cache=new O(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new U,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const t in this._tiles){const e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,e){return this._source.loadTile(t,e)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,(()=>{}))}_abortTile(e){this._source.abortTile&&this._source.abortTile(e,(()=>{})),this._source.fire(new t.k("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const e in this._tiles){const i=this._tiles[e];i.upload(t),i.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map((t=>t.tileID)).sort(Q).map((t=>t.key))}getRenderableIds(e){const i=[];for(const t in this._tiles)this._isIdRenderable(t,e)&&i.push(this._tiles[t]);return e?i.sort(((e,i)=>{const s=e.tileID,n=i.tileID,r=new t.P(s.canonical.x,s.canonical.y)._rotate(this.transform.angle),o=new t.P(n.canonical.x,n.canonical.y)._rotate(this.transform.angle);return s.overscaledZ-n.overscaledZ||o.y-r.y||o.x-r.x})).map((t=>t.tileID.key)):i.map((t=>t.tileID)).sort(Q).map((t=>t.key))}hasRenderableParent(t){const e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)}_isIdRenderable(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)"errored"!==this._tiles[t].state&&this._reloadTile(t,"reloading")}}_reloadTile(t,e){const i=this._tiles[t];i&&("loading"!==i.state&&(i.state=e),this._loadTile(i,this._tileLoaded.bind(this,i,t,e)))}_tileLoaded(e,i,s,n){if(n)return e.state="errored",void(404!==n.status?this._source.fire(new t.j(n,{tile:e})):this.update(this.transform,this.terrain));e.timeAdded=t.h.now(),"expired"===s&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),"raster-dem"===this.getSource().type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new t.k("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(t){const e=this.getRenderableIds();for(let s=0;s1||(Math.abs(i)>1&&(1===Math.abs(i+n)?i+=n:1===Math.abs(i-n)&&(i-=n)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,s),t.neighboringTiles&&t.neighboringTiles[r]&&(t.neighboringTiles[r].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,i,s){for(const n in this._tiles){let r=this._tiles[n];if(s[n]||!r.hasData()||r.tileID.overscaledZ<=e||r.tileID.overscaledZ>i)continue;let o=r.tileID;for(;r&&r.tileID.overscaledZ>e+1;){const t=r.tileID.scaledTo(r.tileID.overscaledZ-1);r=this._tiles[t.key],r&&r.hasData()&&(o=t)}let a=o;for(;a.overscaledZ>e;)if(a=a.scaledTo(a.overscaledZ-1),t[a.key]){s[o.key]=o;break}}}findLoadedParent(t,e){if(t.key in this._loadedParentTiles){const i=this._loadedParentTiles[t.key];return i&&i.tileID.overscaledZ>=e?i:null}for(let i=t.overscaledZ-1;i>=e;i--){const e=t.scaledTo(i),s=this._getLoadedTile(e);if(s)return s}}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)}updateCacheSize(e){const i=Math.ceil(e.width/this._source.tileSize)+1,s=Math.ceil(e.height/this._source.tileSize)+1,n=Math.floor(i*s*(null===this._maxTileCacheZoomLevels?t.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),r="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._cache.setMaxSize(r)}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){const t={};for(const i in this._tiles){const s=this._tiles[i];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+e),t[s.tileID.key]=s}this._tiles=t;for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t in this._tiles)this._setTileReloadTimer(t,this._tiles[t])}}update(e,i){if(this.transform=e,this.terrain=i,!this._sourceLoaded||this._paused)return;let s;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new t.O(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(s=e.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i}),this._source.hasTile&&(s=s.filter((t=>this._source.hasTile(t))))):s=[];const n=e.coveringZoomLevel(this._source),r=Math.max(n-j.maxOverzooming,this._source.minzoom),o=Math.max(n+j.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const t={};for(const e of s)if(e.canonical.z>this._source.minzoom){const i=e.scaledTo(e.canonical.z-1);t[i.key]=i;const s=e.scaledTo(Math.max(this._source.minzoom,Math.min(e.canonical.z,5)));t[s.key]=s}s=s.concat(Object.values(t))}const a=0===s.length&&!this._updated&&this._didEmitContent;this._updated=!0,a&&this.fire(new t.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const l=this._updateRetainedTiles(s,n);if(q(this._source.type)){const e={},a={},c=Object.keys(l),g=t.h.now();for(const t of c){const i=l[t],s=this._tiles[t];if(!s||0!==s.fadeEndTime&&s.fadeEndTime<=g)continue;const n=this.findLoadedParent(i,r);n&&(this._addTile(n.tileID),e[n.tileID.key]=n.tileID),a[t]=i}this._retainLoadedChildren(a,n,o,l);for(const t in e)l[t]||(this._coveredTiles[t]=!0,l[t]=e[t]);if(i){const t={},e={};for(const i of s)this._tiles[i.key].hasData()?t[i.key]=i:e[i.key]=i;for(const i in e){const s=e[i].children(this._source.maxzoom);this._tiles[s[0].key]&&this._tiles[s[1].key]&&this._tiles[s[2].key]&&this._tiles[s[3].key]&&(t[s[0].key]=l[s[0].key]=s[0],t[s[1].key]=l[s[1].key]=s[1],t[s[2].key]=l[s[2].key]=s[2],t[s[3].key]=l[s[3].key]=s[3],delete e[i])}for(const i in e){const s=this.findLoadedParent(e[i],this._source.minzoom);if(s){t[s.tileID.key]=l[s.tileID.key]=s.tileID;for(const e in t)t[e].isChildOf(s.tileID)&&delete t[e]}}for(const e in this._tiles)t[e]||(this._coveredTiles[e]=!0)}}for(const t in l)this._tiles[t].clearFadeHold();const c=t.ab(this._tiles,l);for(const t of c){const e=this._tiles[t];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(t)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,e){const i={},s={},n=Math.max(e-j.maxOverzooming,this._source.minzoom),r=Math.max(e+j.maxUnderzooming,this._source.minzoom),o={};for(const s of t){const t=this._addTile(s);i[s.key]=s,t.hasData()||ethis._source.maxzoom){const t=r.children(this._source.maxzoom)[0],e=this.getTile(t);if(e&&e.hasData()){i[t.key]=t;continue}}else{const t=r.children(this._source.maxzoom);if(i[t[0].key]&&i[t[1].key]&&i[t[2].key]&&i[t[3].key])continue}let o=t.wasRequested();for(let e=r.overscaledZ-1;e>=n;--e){const n=r.scaledTo(e);if(s[n.key])break;if(s[n.key]=!0,t=this.getTile(n),!t&&o&&(t=this._addTile(n)),t){const e=t.hasData();if((o||e)&&(i[n.key]=n),o=t.wasRequested(),e)break}}}return i}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let i,s=this._tiles[t].tileID;for(;s.overscaledZ>0;){if(s.key in this._loadedParentTiles){i=this._loadedParentTiles[s.key];break}e.push(s.key);const t=s.scaledTo(s.overscaledZ-1);if(i=this._getLoadedTile(t),i)break;s=t}for(const t of e)this._loadedParentTiles[t]=i}}_addTile(e){let i=this._tiles[e.key];if(i)return i;i=this._cache.getAndRemove(e),i&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));const s=i;return i||(i=new N(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,this._tileLoaded.bind(this,i,e.key,i.state))),i.uses++,this._tiles[e.key]=i,s||this._source.fire(new t.k("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(t,e){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const i=e.getExpiryTimeout();i&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),i))}_removeTile(t){const e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(e,i,s){const n=[],r=this.transform;if(!r)return n;const o=s?r.getCameraQueryGeometry(e):e,a=e.map((t=>r.pointCoordinate(t,this.terrain))),l=o.map((t=>r.pointCoordinate(t,this.terrain))),c=this.getIds();let g=1/0,h=1/0,u=-1/0,d=-1/0;for(const t of l)g=Math.min(g,t.x),h=Math.min(h,t.y),u=Math.max(u,t.x),d=Math.max(d,t.y);for(let e=0;e=0&&I[1].y+m>=0){const t=a.map((t=>o.getTilePoint(t))),e=l.map((t=>o.getTilePoint(t)));n.push({tile:s,tileID:o,queryGeometry:t,cameraQueryGeometry:e,scale:p})}}return n}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map((t=>this._tiles[t].tileID));for(const t of e)t.posMatrix=this.transform.calculatePosMatrix(t.toUnwrapped());return e}hasTransition(){if(this._source.hasTransition())return!0;if(q(this._source.type)){const e=t.h.now();for(const t in this._tiles)if(this._tiles[t].fadeEndTime>=e)return!0}return!1}setFeatureState(t,e,i){this._state.updateState(t=t||"_geojsonTileLayer",e,i)}removeFeatureState(t,e,i){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,i)}getFeatureState(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)}setDependencies(t,e,i){const s=this._tiles[t];s&&s.setDependencies(e,i)}reloadTilesForDependencies(t,e){for(const i in this._tiles)this._tiles[i].hasDependency(t,e)&&this._reloadTile(i,"reloading");this._cache.filter((i=>!i.hasDependency(t,e)))}}function Q(t,e){const i=Math.abs(2*t.wrap)-+(t.wrap<0),s=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||s-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function q(t){return"raster"===t||"image"===t||"video"===t}j.maxOverzooming=10,j.maxUnderzooming=3;const $="mapboxgl_preloaded_worker_pool";class tt{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length{t.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[$]}numActive(){return Object.keys(this.active).length}}const et=Math.floor(t.h.hardwareConcurrency/2);let it;function st(){return it||(it=new tt),it}tt.workerCount=t.ac(globalThis)?Math.max(Math.min(et,3),1):1;class nt{constructor(t,e){this.reset(t,e)}reset(t,e){this.points=t||[],this._distances=[0];for(let t=1;t0?(n-o)/a:0;return this.points[r].mult(1-l).add(this.points[i].mult(l))}}function rt(t,e){let i=!0;return"always"===t||"never"!==t&&"never"!==e||(i=!1),i}class ot{constructor(t,e,i){const s=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(let t=0;tthis.width||s<0||e>this.height)return[];const a=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=s){if(n)return[{key:null,x1:t,y1:e,x2:i,y2:s}];for(let t=0;t0}hitTestCircle(t,e,i,s,n){const r=t-i,o=t+i,a=e-i,l=e+i;if(o<0||r>this.width||l<0||a>this.height)return!1;const c=[];return this._forEachCell(r,a,o,l,this._queryCellCircle,c,{hitTest:!0,overlapMode:s,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},n),c.length>0}_queryCell(t,e,i,s,n,r,o,a){const{seenUids:l,hitTest:c,overlapMode:g}=o,h=this.boxCells[n];if(null!==h){const n=this.bboxes;for(const o of h)if(!l.box[o]){l.box[o]=!0;const h=4*o,u=this.boxKeys[o];if(t<=n[h+2]&&e<=n[h+3]&&i>=n[h+0]&&s>=n[h+1]&&(!a||a(u))&&(!c||!rt(g,u.overlapMode))&&(r.push({key:u,x1:n[h],y1:n[h+1],x2:n[h+2],y2:n[h+3]}),c))return!0}}const u=this.circleCells[n];if(null!==u){const n=this.circles;for(const o of u)if(!l.circle[o]){l.circle[o]=!0;const h=3*o,u=this.circleKeys[o];if(this._circleAndRectCollide(n[h],n[h+1],n[h+2],t,e,i,s)&&(!a||a(u))&&(!c||!rt(g,u.overlapMode))){const t=n[h],e=n[h+1],i=n[h+2];if(r.push({key:u,x1:t-i,y1:e-i,x2:t+i,y2:e+i}),c)return!0}}}return!1}_queryCellCircle(t,e,i,s,n,r,o,a){const{circle:l,seenUids:c,overlapMode:g}=o,h=this.boxCells[n];if(null!==h){const t=this.bboxes;for(const e of h)if(!c.box[e]){c.box[e]=!0;const i=4*e,s=this.boxKeys[e];if(this._circleAndRectCollide(l.x,l.y,l.radius,t[i+0],t[i+1],t[i+2],t[i+3])&&(!a||a(s))&&!rt(g,s.overlapMode))return r.push(!0),!0}}const u=this.circleCells[n];if(null!==u){const t=this.circles;for(const e of u)if(!c.circle[e]){c.circle[e]=!0;const i=3*e,s=this.circleKeys[e];if(this._circlesCollide(t[i],t[i+1],t[i+2],l.x,l.y,l.radius)&&(!a||a(s))&&!rt(g,s.overlapMode))return r.push(!0),!0}}}_forEachCell(t,e,i,s,n,r,o,a){const l=this._convertToXCellCoord(t),c=this._convertToYCellCoord(e),g=this._convertToXCellCoord(i),h=this._convertToYCellCoord(s);for(let u=l;u<=g;u++)for(let l=c;l<=h;l++)if(n.call(this,t,e,i,s,this.xCellCount*l+u,r,o,a))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,i,s,n,r){const o=s-t,a=n-e,l=i+r;return l*l>o*o+a*a}_circleAndRectCollide(t,e,i,s,n,r,o){const a=(r-s)/2,l=Math.abs(t-(s+a));if(l>a+i)return!1;const c=(o-n)/2,g=Math.abs(e-(n+c));if(g>c+i)return!1;if(l<=a||g<=c)return!0;const h=l-a,u=g-c;return h*h+u*u<=i*i}}function at(e,i,s,n,r){const o=t.Z();return i?(t.a0(o,o,[1/r,1/r,1]),s||t.ae(o,o,n.angle)):t.a1(o,n.labelPlaneMatrix,e),o}function lt(e,i,s,n,r){if(i){const i=t.af(e);return t.a0(i,i,[r,r,1]),s||t.ae(i,i,-n.angle),i}return n.glCoordMatrix}function ct(e,i,s){let n;s?(n=[e.x,e.y,s(e.x,e.y),1],t.ag(n,n,i)):(n=[e.x,e.y,0,1],vt(n,n,i));const r=n[3];return{point:new t.P(n[0]/r,n[1]/r),signedDistanceFromCamera:r}}function gt(t,e){return.5+t/e*.5}function ht(t,e){const i=t[0]/t[3],s=t[1]/t[3];return i>=-e[0]&&i<=e[0]&&s>=-e[1]&&s<=e[1]}function ut(e,i,s,n,r,o,a,l,c,g){const h=n?e.textSizeData:e.iconSizeData,u=t.ah(h,s.transform.zoom),d=[256/s.width*2+1,256/s.height*2+1],p=n?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;p.clear();const m=e.lineVertexArray,I=n?e.text.placedSymbolArray:e.icon.placedSymbolArray,C=s.transform.width/s.transform.height;let f=!1;for(let n=0;nMath.abs(s.x-i.x)*n?{useVertical:!0}:(e===t.ai.vertical?i.ys.x)?{needsFlipping:!0}:null}function mt(e,i,s,n,r,o,a,l,c,g,h,u,d,p,m,I){const C=i/24,f=e.lineOffsetX*C,A=e.lineOffsetY*C;let y;if(e.numGlyphs>1){const t=e.glyphStartIndex+e.numGlyphs,i=e.lineStartIndex,r=e.lineStartIndex+e.lineLength,g=dt(C,l,f,A,s,h,u,e,c,o,d,m,I);if(!g)return{notEnoughRoom:!0};const b=ct(g.first.point,a,I).point,_=ct(g.last.point,a,I).point;if(n&&!s){const t=pt(e.writingMode,b,_,p);if(t)return t}y=[g.first];for(let n=e.glyphStartIndex+1;n0?o.point:It(u,n,i,1,r,I),l=pt(e.writingMode,i,a,p);if(l)return l}const i=yt(C*l.getoffsetX(e.glyphStartIndex),f,A,s,h,u,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,c,o,d,m,I);if(!i)return{notEnoughRoom:!0};y=[i]}for(const e of y)t.ak(g,e.point,e.angle);return{}}function It(t,e,i,s,n,r){const o=ct(t.add(t.sub(e)._unit()),n,r).point,a=i.sub(o);return i.add(a._mult(s/a.mag()))}function Ct(e,i){const{projectionCache:s,lineVertexArray:n,labelPlaneMatrix:r,tileAnchorPoint:o,distanceFromAnchor:a,getElevation:l,previousVertex:c,direction:g,absOffsetX:h}=i;if(s.projections[e])return s.projections[e];const u=new t.P(n.getx(e),n.gety(e)),d=ct(u,r,l);if(d.signedDistanceFromCamera>0)return s.projections[e]=d.point,d.point;const p=e-g;return It(0===a?o:new t.P(n.getx(p),n.gety(p)),u,c,h-a+1,r,l)}function ft(t,e,i){return t._unit()._perp()._mult(e*i)}function At(e,i,s,n,r,o,a,l){const{projectionCache:c,direction:g}=l;if(c.offsets[e])return c.offsets[e];const h=s.add(i);if(e+g=r)return c.offsets[e]=h,h;const u=Ct(e+g,l),d=ft(u.sub(s),a,g),p=s.add(d),m=u.add(d);return c.offsets[e]=t.al(o,h,p,m)||h,c.offsets[e]}function yt(t,e,i,s,n,r,o,a,l,c,g,h,u,d){const p=s?t-e:t+e;let m=p>0?1:-1,I=0;s&&(m*=-1,I=Math.PI),m<0&&(I+=Math.PI);let C,f,A=m>0?a+o:a+o+1,y=n,b=n,_=0,v=0;const x=Math.abs(p),w=[];let S;for(;_+v<=x;){if(A+=m,A=l)return null;_+=v,b=y,f=C;const t={projectionCache:h,lineVertexArray:c,labelPlaneMatrix:g,tileAnchorPoint:r,distanceFromAnchor:_,getElevation:d,previousVertex:b,direction:m,absOffsetX:x};if(y=Ct(A,t),0===i)w.push(b),S=y.sub(b);else{let e;const s=y.sub(b);e=0===s.mag()?ft(Ct(A+m,t).sub(y),i,m):ft(s,i,m),f||(f=b.add(e)),C=At(A,e,y,a,l,f,i,t),w.push(f),S=C.sub(f)}v=S.mag()}const k=S._mult((x-_)/v)._add(f||b),B=I+Math.atan2(y.y-b.y,y.x-b.x);return w.push(k),{point:k,angle:u?B:0,path:w}}const bt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function _t(t,e){for(let i=0;i=1;t--)g.push(o.path[t]);for(let t=1;tct(t,l,p)));g=t.some((t=>t.signedDistanceFromCamera<=0))?[]:t.map((t=>t.point))}let C=[];if(g.length>0){const e=g[0].clone(),i=g[0].clone();for(let t=1;t=s.x&&i.x<=n.x&&e.y>=s.y&&i.y<=n.y?[g]:i.xn.x||i.yn.y?[]:t.am([g],s.x,s.y,n.x,n.y)}for(const t of C){r.reset(t,.25*i);let s=0;s=r.length<=.5*i?1:Math.ceil(r.paddedLength/I)+1;for(let t=0;t=this.screenRightBoundary||sthis.screenBottomBoundary}isInsideGrid(t,e,i,s){return i>=0&&t=0&&et.collisionGroupID===e}}return this.collisionGroups[t]}}function Vt(e,i,s,n,r){const{horizontalAlign:o,verticalAlign:a}=t.au(e);return new t.P(-(o-.5)*i+n[0]*r,-(a-.5)*s+n[1]*r)}function Wt(e,i,s,n,r,o){const{x1:a,x2:l,y1:c,y2:g,anchorPointX:h,anchorPointY:u}=e,d=new t.P(i,s);return n&&d._rotate(r?o:-o),{x1:a+d.x,y1:c+d.y,x2:l+d.x,y2:g+d.y,anchorPointX:h,anchorPointY:u}}class zt{constructor(t,e,i,s,n){this.transform=t.clone(),this.terrain=e,this.collisionIndex=new wt(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new Tt(s),this.collisionCircleArrays={},this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(e,i,s,n){const r=s.getBucket(i),o=s.latestFeatureIndex;if(!r||!o||i.id!==r.layerIds[0])return;const a=s.collisionBoxArray,l=r.layers[0].layout,c=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),g=s.tileSize/t.N,h=this.transform.calculatePosMatrix(s.tileID.toUnwrapped()),u="map"===l.get("text-pitch-alignment"),d="map"===l.get("text-rotation-alignment"),p=St(s,1,this.transform.zoom),m=at(h,u,d,this.transform,p);let I=null;if(u){const e=lt(h,u,d,this.transform,p);I=t.a1([],this.transform.labelPlaneMatrix,e)}this.retainedQueryData[r.bucketInstanceId]=new Rt(r.bucketInstanceId,o,r.sourceLayerIndex,r.index,s.tileID);const C={bucket:r,layout:l,posMatrix:h,textLabelPlaneMatrix:m,labelToScreenMatrix:I,scale:c,textPixelRatio:g,holdingForFade:s.holdingForFade(),collisionBoxArray:a,partiallyEvaluatedTextSize:t.ah(r.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(r.sourceID)};if(n)for(const t of r.sortKeyRanges){const{sortKey:i,symbolInstanceStart:s,symbolInstanceEnd:n}=t;e.push({sortKey:i,symbolInstanceStart:s,symbolInstanceEnd:n,parameters:C})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:r.symbolInstances.length,parameters:C})}attemptAnchorPlacement(e,i,s,n,r,o,a,l,c,g,h,u,d,p,m,I){const C=t.aq[e.textAnchor],f=[e.textOffset0,e.textOffset1],A=Vt(C,s,n,f,r),y=this.collisionIndex.placeCollisionBox(Wt(i,A.x,A.y,o,a,this.transform.angle),h,l,c,g.predicate,I);if((!m||0!==this.collisionIndex.placeCollisionBox(Wt(m,A.x,A.y,o,a,this.transform.angle),h,l,c,g.predicate,I).box.length)&&y.box.length>0){let t;if(this.prevPlacement&&this.prevPlacement.variableOffsets[u.crossTileID]&&this.prevPlacement.placements[u.crossTileID]&&this.prevPlacement.placements[u.crossTileID].text&&(t=this.prevPlacement.variableOffsets[u.crossTileID].anchor),0===u.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[u.crossTileID]={textOffset:f,width:s,height:n,anchor:C,textBoxScale:r,prevAnchor:t},this.markUsedJustification(d,C,u,p),d.allowVerticalPlacement&&(this.markUsedOrientation(d,p,u),this.placedOrientations[u.crossTileID]=p),{shift:A,placedGlyphBoxes:y}}}placeLayerBucketPart(e,i,s){const{bucket:n,layout:r,posMatrix:o,textLabelPlaneMatrix:a,labelToScreenMatrix:l,textPixelRatio:c,holdingForFade:g,collisionBoxArray:h,partiallyEvaluatedTextSize:u,collisionGroup:d}=e.parameters,p=r.get("text-optional"),m=r.get("icon-optional"),I=t.ar(r,"text-overlap","text-allow-overlap"),C="always"===I,f=t.ar(r,"icon-overlap","icon-allow-overlap"),A="always"===f,y="map"===r.get("text-rotation-alignment"),b="map"===r.get("text-pitch-alignment"),_="none"!==r.get("icon-text-fit"),v="viewport-y"===r.get("symbol-z-order"),x=C&&(A||!n.hasIconData()||m),w=A&&(C||!n.hasTextData()||p);!n.collisionArrays&&h&&n.deserializeCollisionBoxes(h);const S=this.retainedQueryData[n.bucketInstanceId].tileID,k=this.terrain?(t,e)=>this.terrain.getElevation(S,t,e):null,B=(e,h)=>{var A,v;if(i[e.crossTileID])return;if(g)return void(this.placements[e.crossTileID]=new Zt(!1,!1,!1));let S=!1,B=!1,Z=!0,G=null,R={box:null,offscreen:null},T={box:null,offscreen:null},V=null,W=null,z=null,J=0,M=0,F=0;h.textFeatureIndex?J=h.textFeatureIndex:e.useRuntimeCollisionCircles&&(J=e.featureIndex),h.verticalTextFeatureIndex&&(M=h.verticalTextFeatureIndex);const K=h.textBox;if(K){const i=i=>{let s=t.ai.horizontal;if(n.allowVerticalPlacement&&!i&&this.prevPlacement){const t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,s=t,this.markUsedOrientation(n,s,e))}return s},s=(i,s)=>{if(n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&h.verticalTextBox){for(const e of n.writingModes)if(e===t.ai.vertical?(R=s(),T=R):R=i(),R&&R.box&&R.box.length)break}else R=i()},r=e.textAnchorOffsetStartIndex,a=e.textAnchorOffsetEndIndex;if(a===r){const r=(t,i)=>{const s=this.collisionIndex.placeCollisionBox(t,I,c,o,d.predicate,k);return s&&s.box&&s.box.length&&(this.markUsedOrientation(n,i,e),this.placedOrientations[e.crossTileID]=i),s};s((()=>r(K,t.ai.horizontal)),(()=>{const i=h.verticalTextBox;return n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i?r(i,t.ai.vertical):{box:null,offscreen:null}})),i(R&&R.box&&R.box.length)}else{let l=t.aq[null===(v=null===(A=this.prevPlacement)||void 0===A?void 0:A.variableOffsets[e.crossTileID])||void 0===v?void 0:v.anchor];const g=(t,i,s)=>{const g=t.x2-t.x1,h=t.y2-t.y1,u=e.textBoxScale,p=_&&"never"===f?i:null;let m={box:[],offscreen:!1},C="never"===I?1:2,A="never";l&&C++;for(let i=0;ig(K,h.iconBox,t.ai.horizontal)),(()=>{const i=h.verticalTextBox;return n.allowVerticalPlacement&&!(R&&R.box&&R.box.length)&&e.numVerticalGlyphVertices>0&&i?g(i,h.verticalIconBox,t.ai.vertical):{box:null,offscreen:null}})),R&&(S=R.box,Z=R.offscreen);const u=i(R&&R.box);if(!S&&this.prevPlacement){const t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(n,t.anchor,e,u))}}}if(V=R,S=V&&V.box&&V.box.length>0,Z=V&&V.offscreen,e.useRuntimeCollisionCircles){const i=n.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),c=t.aj(n.textSizeData,u,i),g=r.get("text-padding");W=this.collisionIndex.placeCollisionCircles(I,i,n.lineVertexArray,n.glyphOffsetArray,c,o,a,l,s,b,d.predicate,e.collisionCircleDiameter,g,k),W.circles.length&&W.collisionDetected&&!s&&t.w("Collisions detected, but collision boxes are not shown"),S=C||W.circles.length>0&&!W.collisionDetected,Z=Z&&W.offscreen}if(h.iconFeatureIndex&&(F=h.iconFeatureIndex),h.iconBox){const t=t=>{const e=_&&G?Wt(t,G.x,G.y,y,b,this.transform.angle):t;return this.collisionIndex.placeCollisionBox(e,f,c,o,d.predicate,k)};T&&T.box&&T.box.length&&h.verticalIconBox?(z=t(h.verticalIconBox),B=z.box.length>0):(z=t(h.iconBox),B=z.box.length>0),Z=Z&&z.offscreen}const L=p||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,P=m||0===e.numIconVertices;if(L||P?P?L||(B=B&&S):S=B&&S:B=S=B&&S,S&&V&&V.box&&this.collisionIndex.insertCollisionBox(V.box,I,r.get("text-ignore-placement"),n.bucketInstanceId,T&&T.box&&M?M:J,d.ID),B&&z&&this.collisionIndex.insertCollisionBox(z.box,f,r.get("icon-ignore-placement"),n.bucketInstanceId,F,d.ID),W&&(S&&this.collisionIndex.insertCollisionCircles(W.circles,I,r.get("text-ignore-placement"),n.bucketInstanceId,J,d.ID),s)){const t=n.bucketInstanceId;let e=this.collisionCircleArrays[t];void 0===e&&(e=this.collisionCircleArrays[t]=new Gt);for(let t=0;t=0;--e){const i=t[e];B(n.symbolInstances.get(i),n.collisionArrays[i])}}else for(let t=e.symbolInstanceStart;t=0&&(e.text.placedSymbolArray.get(t).crossTileID=r>=0&&t!==r?0:s.crossTileID)}markUsedOrientation(e,i,s){const n=i===t.ai.horizontal||i===t.ai.horizontalOnly?i:0,r=i===t.ai.vertical?i:0,o=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(const t of o)e.text.placedSymbolArray.get(t).placedOrientation=n;s.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).placedOrientation=r)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const e=this.prevPlacement;let i=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;const s=e?e.symbolFadeChange(t):1,n=e?e.opacities:{},r=e?e.variableOffsets:{},o=e?e.placedOrientations:{};for(const t in this.placements){const e=this.placements[t],r=n[t];r?(this.opacities[t]=new Bt(r,s,e.text,e.icon),i=i||e.text!==r.text.placed||e.icon!==r.icon.placed):(this.opacities[t]=new Bt(null,s,e.text,e.icon,e.skipFade),i=i||e.text||e.icon)}for(const t in n){const e=n[t];if(!this.opacities[t]){const n=new Bt(e,s,!1,!1);n.isHidden()||(this.opacities[t]=n,i=i||e.text.placed||e.icon.placed)}}for(const t in r)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=r[t]);for(const t in o)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=o[t]);if(e&&void 0===e.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)}updateLayerOpacities(t,e){const i={};for(const s of e){const e=s.getBucket(t);e&&s.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,i,s.collisionBoxArray)}}updateBucketOpacities(e,i,s){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const n=e.layers[0],r=n.layout,o=new Bt(null,0,!1,!1,!0),a=r.get("text-allow-overlap"),l=r.get("icon-allow-overlap"),c=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),g="map"===r.get("text-rotation-alignment"),h="map"===r.get("text-pitch-alignment"),u="none"!==r.get("icon-text-fit"),d=new Bt(null,0,a&&(l||!e.hasIconData()||r.get("icon-optional")),l&&(a||!e.hasTextData()||r.get("text-optional")),!0);!e.collisionArrays&&s&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(s);const p=(t,e,i)=>{for(let s=0;s0,C=this.placedOrientations[n.crossTileID],f=C===t.ai.vertical,A=C===t.ai.horizontal||C===t.ai.horizontalOnly;if(r>0||a>0){const t=Et(m.text);p(e.text,r,f?Dt:t),p(e.text,a,A?Dt:t);const i=m.text.isHidden();[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=i||f?1:0)})),n.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).hidden=i||A?1:0);const s=this.variableOffsets[n.crossTileID];s&&this.markUsedJustification(e,s.anchor,n,C);const o=this.placedOrientations[n.crossTileID];o&&(this.markUsedJustification(e,"left",n,o),this.markUsedOrientation(e,o,n))}if(I){const t=Et(m.icon),i=!(u&&n.verticalPlacedIconSymbolIndex&&f);n.placedIconSymbolIndex>=0&&(p(e.icon,n.numIconVertices,i?t:Dt),e.icon.placedSymbolArray.get(n.placedIconSymbolIndex).hidden=m.icon.isHidden()),n.verticalPlacedIconSymbolIndex>=0&&(p(e.icon,n.numVerticalIconVertices,i?Dt:t),e.icon.placedSymbolArray.get(n.verticalPlacedIconSymbolIndex).hidden=m.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const i=e.collisionArrays[s];if(i){let s=new t.P(0,0);if(i.textBox||i.verticalTextBox){let t=!0;if(c){const e=this.variableOffsets[l];e?(s=Vt(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),g&&s._rotate(h?this.transform.angle:-this.transform.angle)):t=!1}i.textBox&&Jt(e.textCollisionBox.collisionVertexArray,m.text.placed,!t||f,s.x,s.y),i.verticalTextBox&&Jt(e.textCollisionBox.collisionVertexArray,m.text.placed,!t||A,s.x,s.y)}const n=Boolean(!A&&i.verticalIconBox);i.iconBox&&Jt(e.iconCollisionBox.collisionVertexArray,m.icon.placed,n,u?s.x:0,u?s.y:0),i.verticalIconBox&&Jt(e.iconCollisionBox.collisionVertexArray,m.icon.placed,!n,u?s.x:0,u?s.y:0)}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);if(e.bucketInstanceId in this.collisionCircleArrays){const t=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=t.invProjMatrix,e.placementViewportMatrix=t.viewportMatrix,e.collisionCircleArray=t.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTimet}setStale(){this.stale=!0}}function Jt(t,e,i,s,n){t.emplaceBack(e?1:0,i?1:0,s||0,n||0),t.emplaceBack(e?1:0,i?1:0,s||0,n||0),t.emplaceBack(e?1:0,i?1:0,s||0,n||0),t.emplaceBack(e?1:0,i?1:0,s||0,n||0)}const Mt=Math.pow(2,25),Ft=Math.pow(2,24),Kt=Math.pow(2,17),Lt=Math.pow(2,16),Pt=Math.pow(2,9),Xt=Math.pow(2,8),Ht=Math.pow(2,1);function Et(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;const e=t.placed?1:0,i=Math.floor(127*t.opacity);return i*Mt+e*Ft+i*Kt+e*Lt+i*Pt+e*Xt+i*Ht+e}const Dt=0;class Yt{constructor(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,e,i,s,n){const r=this._bucketParts;for(;this._currentTileIndext.sortKey-e.sortKey)));this._currentPartIndex!this._forceFullPlacement&&t.h.now()-n>2;for(;this._currentPlacementIndex>=0;){const t=i[e[this._currentPlacementIndex]],n=this.placement.collisionIndex.transform.zoom;if("symbol"===t.type&&(!t.minzoom||t.minzoom<=n)&&(!t.maxzoom||t.maxzoom>n)){if(this._inProgressLayer||(this._inProgressLayer=new Yt(t)),this._inProgressLayer.continuePlacement(s[t.source],this.placement,this._showCollisionBoxes,t,r))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Ot=512/t.N/2;class Ut{constructor(e,i,s){this.tileID=e,this.bucketInstanceId=s,this._symbolsByKey={};const n=new Map;for(let t=0;t({x:Math.floor(t.anchorX*Ot),y:Math.floor(t.anchorY*Ot)}))),crossTileIDs:i.map((t=>t.crossTileID))};if(s.positions.length>128){const e=new t.av(s.positions.length,16,Uint16Array);for(const{x:t,y:i}of s.positions)e.add(t,i);e.finish(),delete s.positions,s.index=e}this._symbolsByKey[e]=s}}getScaledCoordinates(e,i){const{x:s,y:n,z:r}=this.tileID.canonical,{x:o,y:a,z:l}=i.canonical,c=Ot/Math.pow(2,l-r),g=(a*t.N+e.anchorY)*c,h=n*t.N*Ot;return{x:Math.floor((o*t.N+e.anchorX)*c-s*t.N*Ot),y:Math.floor(g-h)}}findMatches(t,e,i){const s=this.tileID.canonical.zt))}}class jt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Qt{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const e=Math.round((t-this.lng)/360);if(0!==e)for(const t in this.indexes){const i=this.indexes[t],s={};for(const t in i){const n=i[t];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+e),s[n.tileID.key]=n}this.indexes[t]=s}this.lng=t}addBucket(t,e,i){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let t=0;tt.overscaledZ)for(const i in n){const r=n[i];r.tileID.isChildOf(t)&&r.findMatches(e.symbolInstances,t,s)}else{const r=n[t.scaledTo(Number(i)).key];r&&r.findMatches(e.symbolInstances,t,s)}}for(let t=0;t{e[t]=!0}));for(const t in this.layerIndexes)e[t]||delete this.layerIndexes[t]}}const $t=(e,i)=>t.x(e,i&&i.filter((t=>"source.canvas"!==t.identifier))),te=t.F(t.ax,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),ee=t.F(t.ax,["setCenter","setZoom","setBearing","setPitch"]),ie=t.aw();class se extends t.E{constructor(e,i={}){super(),this.map=e,this.dispatcher=new G(st(),this,e._getMapId()),this.imageManager=new b,this.imageManager.setEventedParent(this),this.glyphManager=new w(e._requestManager,i.localIdeographFontFamily),this.lineAtlas=new Z(256,512),this.crossTileSymbolIndex=new qt,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.ay,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",t.az());const s=this;this._rtlTextPluginCallback=se.registerForPluginStateChange((e=>{s.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:e.pluginStatus,pluginURL:e.pluginURL},((e,i)=>{if(t.aA(e),i&&i.every((t=>t)))for(const t in s.sourceCaches){const e=s.sourceCaches[t].getSource().type;"vector"!==e&&"geojson"!==e||s.sourceCaches[t].reload()}}))})),this.on("data",(t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;const e=this.sourceCaches[t.sourceId];if(!e)return;const i=e.getSource();if(i&&i.vectorLayerIds)for(const t in this._layers){const e=this._layers[t];e.source===i.id&&this._validateLayer(e)}}))}loadURL(e,i={},s){this.fire(new t.k("dataloading",{dataType:"style"})),i.validate="boolean"!=typeof i.validate||i.validate;const n=this.map._requestManager.transformRequest(e,g.Style);this._request=t.f(n,((e,n)=>{this._request=null,e?this.fire(new t.j(e)):n&&this._load(n,i,s)}))}loadJSON(e,i={},s){this.fire(new t.k("dataloading",{dataType:"style"})),this._request=t.h.frame((()=>{this._request=null,i.validate=!1!==i.validate,this._load(e,i,s)}))}loadEmpty(){this.fire(new t.k("dataloading",{dataType:"style"})),this._load(ie,{validate:!1})}_load(e,i,s){var n;const r=i.transformStyle?i.transformStyle(s,e):e;if(!i.validate||!$t(this,t.y(r))){this._loaded=!0,this.stylesheet=r;for(const t in r.sources)this.addSource(t,r.sources[t],{validate:!1});r.sprite?this._loadSprite(r.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(r.glyphs),this._createLayers(),this.light=new B(this.stylesheet.light),this.map.setTerrain(null!==(n=this.stylesheet.terrain)&&void 0!==n?n:null),this.fire(new t.k("data",{dataType:"style"})),this.fire(new t.k("style.load"))}}_createLayers(){const e=t.aB(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",e),this._order=e.map((t=>t.id)),this._layers={},this._serializedLayers=null;for(const i of e){const e=t.aC(i);e.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=e}}_loadSprite(e,i=!1,s=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(e,i,s,n){const r=C(e),o=r.length,a=s>1?"@2x":"",l={},h={},u={};for(const{id:e,url:s}of r){const r=i.transformRequest(i.normalizeSpriteURL(s,a,".json"),g.SpriteJSON),d=`${e}_${r.url}`;l[d]=t.f(r,((t,i)=>{delete l[d],h[e]=i,f(n,h,u,t,o)}));const p=i.transformRequest(i.normalizeSpriteURL(s,a,".png"),g.SpriteImage),m=`${e}_${p.url}`;l[m]=c.getImage(p,((t,i)=>{delete l[m],u[e]=i,f(n,h,u,t,o)}))}return{cancel(){for(const t of Object.values(l))t.cancel()}}}(e,this.map._requestManager,this.map.getPixelRatio(),((e,n)=>{if(this._spriteRequest=null,e)this.fire(new t.j(e));else if(n)for(const t in n){this._spritesImagesIds[t]=[];const e=this._spritesImagesIds[t]?this._spritesImagesIds[t].filter((t=>!(t in n))):[];for(const t of e)this.imageManager.removeImage(t),this._changedImages[t]=!0;for(const e in n[t]){const s="default"===t?e:`${t}:${e}`;this._spritesImagesIds[t].push(s),s in this.imageManager.images?this.imageManager.updateImage(s,n[t][e],!1):this.imageManager.addImage(s,n[t][e]),i&&(this._changedImages[s]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.k("data",{dataType:"style"})),s&&s(e)}))}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.k("data",{dataType:"style"}))}_validateLayer(e){const i=this.sourceCaches[e.source];if(!i)return;const s=e.sourceLayer;if(!s)return;const n=i.getSource();("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(s))&&this.fire(new t.j(new Error(`Source layer "${s}" does not exist on source "${n.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t){const e=this._serializedAllLayers();if(!t||0===t.length)return Object.values(e);const i=[];for(const s of t)e[s]&&i.push(e[s]);return i}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const e=Object.keys(this._layers);for(const i of e){const e=this._layers[i];"custom"!==e.type&&(t[i]=e.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const i=this._changed;if(this._changed){const t=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(t.length||i.length)&&this._updateWorkerLayers(t,i);for(const t in this._updatedSources){const e=this._updatedSources[t];if("reload"===e)this._reloadSource(t);else{if("clear"!==e)throw new Error(`Invalid action ${e}`);this._clearSource(t)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates()}const s={};for(const t in this.sourceCaches){const e=this.sourceCaches[t];s[t]=e.used,e.used=!1}for(const t of this._order){const i=this._layers[t];i.recalculate(e,this._availableImages),!i.isHidden(e.zoom)&&i.source&&(this.sourceCaches[i.source].used=!0)}for(const e in s){const i=this.sourceCaches[e];s[e]!==i.used&&i.fire(new t.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:e}))}this.light.recalculate(e),this.z=e.zoom,i&&this.fire(new t.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,e){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(t),removedIds:e})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,i={}){this._checkLoaded();const s=this.serialize();if(e=i.transformStyle?i.transformStyle(s,e):e,$t(this,t.y(e)))return!1;(e=t.aD(e)).layers=t.aB(e.layers);const n=t.aE(s,e).filter((t=>!(t.command in ee)));if(0===n.length)return!1;const r=n.filter((t=>!(t.command in te)));if(r.length>0)throw new Error(`Unimplemented: ${r.map((t=>t.command)).join(", ")}.`);for(const t of n)"setTransition"!==t.command&&this[t.command].apply(this,t.args);return this.stylesheet=e,this._serializedLayers=null,!0}addImage(e,i){if(this.getImage(e))return this.fire(new t.j(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,i),this._afterImageUpdated(e)}updateImage(t,e){this.imageManager.updateImage(t,e)}getImage(t){return this.imageManager.getImage(t)}removeImage(e){if(!this.getImage(e))return this.fire(new t.j(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,i,s={}){if(this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error(`Source "${e}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(t.y.source,`sources.${e}`,i,null,s))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const n=this.sourceCaches[e]=new j(e,i,this.dispatcher);n.style=this,n.setEventedParent(this,(()=>({isSourceLoaded:n.loaded(),source:n.serialize(),sourceId:e}))),n.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(const i in this._layers)if(this._layers[i].source===e)return this.fire(new t.j(new Error(`Source "${e}" cannot be removed while layer "${i}" is using it.`)));const i=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],i.fire(new t.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,e){if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error(`There is no source with this ID=${t}`);const i=this.sourceCaches[t].getSource();if("geojson"!==i.type)throw new Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(e),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(e,i,s={}){this._checkLoaded();const n=e.id;if(this.getLayer(n))return void this.fire(new t.j(new Error(`Layer "${n}" already exists on this map.`)));let r;if("custom"===e.type){if($t(this,t.aF(e)))return;r=t.aC(e)}else{if("source"in e&&"object"==typeof e.source&&(this.addSource(n,e.source),e=t.aD(e),e=t.e(e,{source:n})),this._validate(t.y.layer,`layers.${n}`,e,{arrayIndex:-1},s))return;r=t.aC(e),this._validateLayer(r),r.setEventedParent(this,{layer:{id:n}})}const o=i?this._order.indexOf(i):this._order.length;if(i&&-1===o)this.fire(new t.j(new Error(`Cannot add layer "${n}" before non-existing layer "${i}".`)));else{if(this._order.splice(o,0,n),this._layerOrderChanged=!0,this._layers[n]=r,this._removedLayers[n]&&r.source&&"custom"!==r.type){const t=this._removedLayers[n];delete this._removedLayers[n],t.type!==r.type?this._updatedSources[r.source]="clear":(this._updatedSources[r.source]="reload",this.sourceCaches[r.source].pause())}this._updateLayer(r),r.onAdd&&r.onAdd(this.map)}}moveLayer(e,i){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new t.j(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===i)return;const s=this._order.indexOf(e);this._order.splice(s,1);const n=i?this._order.indexOf(i):this._order.length;i&&-1===n?this.fire(new t.j(new Error(`Cannot move layer "${e}" before non-existing layer "${i}".`))):(this._order.splice(n,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const i=this._layers[e];if(!i)return void this.fire(new t.j(new Error(`Cannot remove non-existing layer "${e}".`)));i.setEventedParent(null);const s=this._order.indexOf(e);this._order.splice(s,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(e,i,s){this._checkLoaded();const n=this.getLayer(e);n?n.minzoom===i&&n.maxzoom===s||(null!=i&&(n.minzoom=i),null!=s&&(n.maxzoom=s),this._updateLayer(n)):this.fire(new t.j(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,i,s={}){this._checkLoaded();const n=this.getLayer(e);if(n){if(!t.aG(n.filter,i))return null==i?(n.filter=void 0,void this._updateLayer(n)):void(this._validate(t.y.filter,`layers.${n.id}.filter`,i,null,s)||(n.filter=t.aD(i),this._updateLayer(n)))}else this.fire(new t.j(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return t.aD(this.getLayer(e).filter)}setLayoutProperty(e,i,s,n={}){this._checkLoaded();const r=this.getLayer(e);r?t.aG(r.getLayoutProperty(i),s)||(r.setLayoutProperty(i,s,n),this._updateLayer(r)):this.fire(new t.j(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,i){const s=this.getLayer(e);if(s)return s.getLayoutProperty(i);this.fire(new t.j(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,i,s,n={}){this._checkLoaded();const r=this.getLayer(e);r?t.aG(r.getPaintProperty(i),s)||(r.setPaintProperty(i,s,n)&&this._updateLayer(r),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.j(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(e,i){this._checkLoaded();const s=e.source,n=e.sourceLayer,r=this.sourceCaches[s];if(void 0===r)return void this.fire(new t.j(new Error(`The source '${s}' does not exist in the map's style.`)));const o=r.getSource().type;"geojson"===o&&n?this.fire(new t.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==o||n?(void 0===e.id&&this.fire(new t.j(new Error("The feature id parameter must be provided."))),r.setFeatureState(n,e.id,i)):this.fire(new t.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,i){this._checkLoaded();const s=e.source,n=this.sourceCaches[s];if(void 0===n)return void this.fire(new t.j(new Error(`The source '${s}' does not exist in the map's style.`)));const r=n.getSource().type,o="vector"===r?e.sourceLayer:void 0;"vector"!==r||o?i&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.j(new Error("A feature id is required to remove its specific state property."))):n.removeFeatureState(o,e.id,i):this.fire(new t.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const i=e.source,s=e.sourceLayer,n=this.sourceCaches[i];if(void 0!==n)return"vector"!==n.getSource().type||s?(void 0===e.id&&this.fire(new t.j(new Error("The feature id parameter must be provided."))),n.getFeatureState(s,e.id)):void this.fire(new t.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new t.j(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return t.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=t.aH(this.sourceCaches,(t=>t.serialize())),i=this._serializeByIds(this._order),s=this.map.getTerrain()||void 0,n=this.stylesheet;return t.aI({version:n.version,name:n.name,metadata:n.metadata,light:n.light,center:n.center,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,sprite:n.sprite,glyphs:n.glyphs,transition:n.transition,sources:e,layers:i,terrain:s},(t=>void 0!==t))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const e=t=>"fill-extrusion"===this._layers[t].type,i={},s=[];for(let n=this._order.length-1;n>=0;n--){const r=this._order[n];if(e(r)){i[r]=n;for(const e of t){const t=e[r];if(t)for(const e of t)s.push(e)}}}s.sort(((t,e)=>e.intersectionZ-t.intersectionZ));const n=[];for(let r=this._order.length-1;r>=0;r--){const o=this._order[r];if(e(o))for(let t=s.length-1;t>=0;t--){const e=s[t].feature;if(i[e.layer.id]{const s=i.featureSortOrder;if(s){const i=s.indexOf(t.featureIndex);return s.indexOf(e.featureIndex)-i}return e.featureIndex-t.featureIndex}));for(const t of n)e.push(t)}}for(const e in a)a[e].forEach((s=>{const n=s.feature,r=i[t[e].source].getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=r}));return a}(this._layers,o,this.sourceCaches,e,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(r)}querySourceFeatures(e,i){i&&i.filter&&this._validate(t.y.filter,"querySourceFeatures.filter",i.filter,null,i);const s=this.sourceCaches[e];return s?function(t,e){const i=t.getRenderableIds().map((e=>t.getTileByID(e))),s=[],n={};for(let t=0;t{X[t]=e})(t,e),e.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:e.workerSourceURL},i):i(null,null))}getLight(){return this.light.getLight()}setLight(e,i={}){this._checkLoaded();const s=this.light.getLight();let n=!1;for(const i in e)if(!t.aG(e[i],s[i])){n=!0;break}if(!n)return;const r={now:t.h.now(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,i),this.light.updateTransitions(r)}_validate(e,i,s,n,r={}){return(!r||!1!==r.validate)&&$t(this,e.call(t.y,t.e({key:i,style:this.serialize(),value:s,styleSpec:t.v},n)))}_remove(e=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),t.aJ.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.sourceCaches){const e=this.sourceCaches[t];e.setEventedParent(null),e.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(e)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const e in this.sourceCaches)this.sourceCaches[e].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(e,i,s,n,r=!1){let o=!1,a=!1;const l={};for(const t of this._order){const i=this._layers[t];if("symbol"!==i.type)continue;if(!l[i.source]){const t=this.sourceCaches[i.source];l[i.source]=t.getRenderableIds(!0).map((e=>t.getTileByID(e))).sort(((t,e)=>e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1)))}const s=this.crossTileSymbolIndex.addLayer(i,l[i.source],e.center.lng);o=o||s}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((r=r||this._layerOrderChanged||0===s)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(t.h.now(),e.zoom))&&(this.pauseablePlacement=new Nt(e,this.map.terrain,this._order,r,i,s,n,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(t.h.now()),a=!0),o&&this.pauseablePlacement.placement.setStale()),a||o)for(const t of this._order){const e=this._layers[t];"symbol"===e.type&&this.placement.updateLayerOpacities(e,l[e.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(t.h.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,e,i){this.imageManager.getImages(e.icons,i),this._updateTilesForChangedImages();const s=this.sourceCaches[e.source];s&&s.setDependencies(e.tileID.key,e.type,e.icons)}getGlyphs(t,e,i){this.glyphManager.getGlyphs(e.stacks,i);const s=this.sourceCaches[e.source];s&&s.setDependencies(e.tileID.key,e.type,[""])}getResource(e,i,s){return t.m(i,s)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,i={}){this._checkLoaded(),e&&this._validate(t.y.glyphs,"glyphs",e,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,i,s={},n){this._checkLoaded();const r=[{id:e,url:i}],o=[...C(this.stylesheet.sprite),...r];this._validate(t.y.sprite,"sprite",o,null,s)||(this.stylesheet.sprite=o,this._loadSprite(r,!0,n))}removeSprite(e){this._checkLoaded();const i=C(this.stylesheet.sprite);if(i.find((t=>t.id===e))){if(this._spritesImagesIds[e])for(const t of this._spritesImagesIds[e])this.imageManager.removeImage(t),this._changedImages[t]=!0;i.splice(i.findIndex((t=>t.id===e)),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.k("data",{dataType:"style"}))}else this.fire(new t.j(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return C(this.stylesheet.sprite)}setSprite(e,i={},s){this._checkLoaded(),e&&this._validate(t.y.sprite,"sprite",e,null,i)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,s):(this._unloadSprite(),s&&s(null)))}}se.registerForPluginStateChange=t.aK;var ne=t.Q([{name:"a_pos",type:"Int16",components:2}]),re="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const oe={prelude:ae("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\n","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}"),background:ae("uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:ae("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:ae("varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:ae("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:ae("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}"),heatmapTexture:ae("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:ae("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:ae("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:ae("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:ae("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),fillOutline:ae("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillOutlinePattern:ae("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillPattern:ae("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),fillExtrusion:ae("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),fillExtrusionPattern:ae("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),hillshadePrepare:ae("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:ae("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:ae("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:ae("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:ae("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:ae("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),raster:ae("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:ae("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}"),symbolSDF:ae("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:ae("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),terrain:ae("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",re),terrainDepth:ae("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",re),terrainCoords:ae("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",re)};function ae(t,e){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,s=e.match(/attribute ([\w]+) ([\w]+)/g),n=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),r=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=r?r.concat(n):n,a={};return{fragmentSource:t=t.replace(i,((t,e,i,s,n)=>(a[n]=!0,"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nvarying ${i} ${s} ${n};\n#else\nuniform ${i} ${s} u_${n};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${n}\n ${i} ${s} ${n} = u_${n};\n#endif\n`))),vertexSource:e=e.replace(i,((t,e,i,s,n)=>{const r="float"===s?"vec2":"vec4",o=n.match(/color/)?"color":r;return a[n]?"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nattribute ${i} ${r} a_${n};\nvarying ${i} ${s} ${n};\n#else\nuniform ${i} ${s} u_${n};\n#endif\n`:"vec4"===o?`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = a_${n};\n#else\n ${i} ${s} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = unpack_mix_${o}(a_${n}, u_${n}_t);\n#else\n ${i} ${s} ${n} = u_${n};\n#endif\n`:"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nattribute ${i} ${r} a_${n};\n#else\nuniform ${i} ${s} u_${n};\n#endif\n`:"vec4"===o?`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${s} ${n} = a_${n};\n#else\n ${i} ${s} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${s} ${n} = unpack_mix_${o}(a_${n}, u_${n}_t);\n#else\n ${i} ${s} ${n} = u_${n};\n#endif\n`})),staticAttributes:s,staticUniforms:o}}class le{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,e,i,s,n,r,o,a,l){this.context=t;let c=this.boundPaintVertexBuffers.length!==s.length;for(let t=0;!c&&t({u_depth:new t.aL(e,i.u_depth),u_terrain:new t.aL(e,i.u_terrain),u_terrain_dim:new t.aM(e,i.u_terrain_dim),u_terrain_matrix:new t.aN(e,i.u_terrain_matrix),u_terrain_unpack:new t.aO(e,i.u_terrain_unpack),u_terrain_exaggeration:new t.aM(e,i.u_terrain_exaggeration)}))(e,b),this.binderUniforms=s?s.getUniforms(e,b):[]}draw(t,e,i,s,n,r,o,a,l,c,g,h,u,d,p,m,I,C){const f=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(s),t.setColorMode(n),t.setCullFace(r),a){t.activeTexture.set(f.TEXTURE2),f.bindTexture(f.TEXTURE_2D,a.depthTexture),t.activeTexture.set(f.TEXTURE3),f.bindTexture(f.TEXTURE_2D,a.texture);for(const t in this.terrainUniforms)this.terrainUniforms[t].set(a[t])}for(const t in this.fixedUniforms)this.fixedUniforms[t].set(o[t]);p&&p.setUniforms(t,this.binderUniforms,u,{zoom:d});let A=0;switch(e){case f.LINES:A=2;break;case f.TRIANGLES:A=3;break;case f.LINE_STRIP:A=1}for(const i of h.get()){const s=i.vaos||(i.vaos={});(s[l]||(s[l]=new le)).bind(t,this,c,p?p.getPaintVertexBuffers():[],g,i.vertexOffset,m,I,C),f.drawElements(e,i.primitiveLength*A,f.UNSIGNED_SHORT,i.primitiveOffset*A*2)}}}function he(t,e,i){const s=1/St(i,1,e.transform.tileZoom),n=Math.pow(2,i.tileID.overscaledZ),r=i.tileSize*Math.pow(2,e.transform.tileZoom)/n,o=r*(i.tileID.canonical.x+i.tileID.wrap*n),a=r*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[s,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[o>>16,a>>16],u_pixel_coord_lower:[65535&o,65535&a]}}const ue=(e,i,s,n)=>{const r=i.style.light,o=r.properties.get("position"),a=[o.x,o.y,o.z],l=function(){var e=new t.A(9);return t.A!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}();"viewport"===r.properties.get("anchor")&&function(t,e){var i=Math.sin(e),s=Math.cos(e);t[0]=s,t[1]=i,t[2]=0,t[3]=-i,t[4]=s,t[5]=0,t[6]=0,t[7]=0,t[8]=1}(l,-i.transform.angle),function(t,e,i){var s=e[0],n=e[1],r=e[2];t[0]=s*i[0]+n*i[3]+r*i[6],t[1]=s*i[1]+n*i[4]+r*i[7],t[2]=s*i[2]+n*i[5]+r*i[8]}(a,a,l);const c=r.properties.get("color");return{u_matrix:e,u_lightpos:a,u_lightintensity:r.properties.get("intensity"),u_lightcolor:[c.r,c.g,c.b],u_vertical_gradient:+s,u_opacity:n}},de=(e,i,s,n,r,o,a)=>t.e(ue(e,i,s,n),he(o,i,a),{u_height_factor:-Math.pow(2,r.overscaledZ)/a.tileSize/8}),pe=t=>({u_matrix:t}),me=(e,i,s,n)=>t.e(pe(e),he(s,i,n)),Ie=(t,e)=>({u_matrix:t,u_world:e}),Ce=(e,i,s,n,r)=>t.e(me(e,i,s,n),{u_world:r}),fe=(t,e,i,s)=>{const n=t.transform;let r,o;if("map"===s.paint.get("circle-pitch-alignment")){const t=St(i,1,n.zoom);r=!0,o=[t,t]}else r=!1,o=n.pixelsToGLUnits;return{u_camera_to_center_distance:n.cameraToCenterDistance,u_scale_with_map:+("map"===s.paint.get("circle-pitch-scale")),u_matrix:t.translatePosMatrix(e.posMatrix,i,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_pitch_with_map:+r,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:o}},Ae=(t,e,i)=>{const s=St(i,1,e.zoom),n=Math.pow(2,e.zoom-i.tileID.overscaledZ),r=i.tileID.overscaleFactor();return{u_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:s,u_extrude_scale:[e.pixelsToGLUnits[0]/(s*n),e.pixelsToGLUnits[1]/(s*n)],u_overscale_factor:r}},ye=(t,e,i=1)=>({u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:i}),be=t=>({u_matrix:t}),_e=(t,e,i,s)=>({u_matrix:t,u_extrude_scale:St(e,1,i),u_intensity:s});function ve(e,i){const s=Math.pow(2,i.canonical.z),n=i.canonical.y;return[new t.U(0,n/s).toLngLat().lat,new t.U(0,(n+1)/s).toLngLat().lat]}const xe=(t,e,i,s)=>{const n=t.transform;return{u_matrix:Ze(t,e,i,s),u_ratio:1/St(e,1,n.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/n.pixelsToGLUnits[0],1/n.pixelsToGLUnits[1]]}},we=(e,i,s,n,r)=>t.e(xe(e,i,s,r),{u_image:0,u_image_height:n}),Se=(t,e,i,s,n)=>{const r=t.transform,o=Be(e,r);return{u_matrix:Ze(t,e,i,n),u_texsize:e.imageAtlasTexture.size,u_ratio:1/St(e,1,r.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[o,s.fromScale,s.toScale],u_fade:s.t,u_units_to_pixels:[1/r.pixelsToGLUnits[0],1/r.pixelsToGLUnits[1]]}},ke=(e,i,s,n,r,o)=>{const a=e.lineAtlas,l=Be(i,e.transform),c="round"===s.layout.get("line-cap"),g=a.getDash(n.from,c),h=a.getDash(n.to,c),u=g.width*r.fromScale,d=h.width*r.toScale;return t.e(xe(e,i,s,o),{u_patternscale_a:[l/u,-g.height/2],u_patternscale_b:[l/d,-h.height/2],u_sdfgamma:a.width/(256*Math.min(u,d)*e.pixelRatio)/2,u_image:0,u_tex_y_a:g.y,u_tex_y_b:h.y,u_mix:r.t})};function Be(t,e){return 1/St(t,1,e.tileZoom)}function Ze(t,e,i,s){return t.translatePosMatrix(s?s.posMatrix:e.tileID.posMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Ge=(t,e,i,s,n)=>{return{u_matrix:t,u_tl_parent:e,u_scale_parent:i,u_buffer_scale:1,u_fade_t:s.mix,u_opacity:s.opacity*n.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:n.paint.get("raster-brightness-min"),u_brightness_high:n.paint.get("raster-brightness-max"),u_saturation_factor:(o=n.paint.get("raster-saturation"),o>0?1-1/(1.001-o):-o),u_contrast_factor:(r=n.paint.get("raster-contrast"),r>0?1/(1-r):1+r),u_spin_weights:Re(n.paint.get("raster-hue-rotate"))};var r,o};function Re(t){t*=Math.PI/180;const e=Math.sin(t),i=Math.cos(t);return[(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}const Te=(t,e,i,s,n,r,o,a,l,c)=>{const g=n.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:g.cameraToCenterDistance,u_pitch:g.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:g.width/g.height,u_fade_change:n.options.fadeDuration?n.symbolFadeChange:1,u_matrix:r,u_label_plane_matrix:o,u_coord_matrix:a,u_is_text:+l,u_pitch_with_map:+s,u_texsize:c,u_texture:0}},Ve=(e,i,s,n,r,o,a,l,c,g,h)=>{const u=r.transform;return t.e(Te(e,i,s,n,r,o,a,l,c,g),{u_gamma_scale:n?Math.cos(u._pitch)*u.cameraToCenterDistance:1,u_device_pixel_ratio:r.pixelRatio,u_is_halo:+h})},We=(e,i,s,n,r,o,a,l,c,g)=>t.e(Ve(e,i,s,n,r,o,a,l,!0,c,!0),{u_texsize_icon:g,u_texture_icon:1}),ze=(t,e,i)=>({u_matrix:t,u_opacity:e,u_color:i}),Je=(e,i,s,n,r,o)=>t.e(function(t,e,i,s){const n=i.imageManager.getPattern(t.from.toString()),r=i.imageManager.getPattern(t.to.toString()),{width:o,height:a}=i.imageManager.getPixelSize(),l=Math.pow(2,s.tileID.overscaledZ),c=s.tileSize*Math.pow(2,i.transform.tileZoom)/l,g=c*(s.tileID.canonical.x+s.tileID.wrap*l),h=c*s.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:n.tl,u_pattern_br_a:n.br,u_pattern_tl_b:r.tl,u_pattern_br_b:r.br,u_texsize:[o,a],u_mix:e.t,u_pattern_size_a:n.displaySize,u_pattern_size_b:r.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/St(s,1,i.transform.tileZoom),u_pixel_coord_upper:[g>>16,h>>16],u_pixel_coord_lower:[65535&g,65535&h]}}(n,o,s,r),{u_matrix:e,u_opacity:i}),Me={fillExtrusion:(e,i)=>({u_matrix:new t.aN(e,i.u_matrix),u_lightpos:new t.aP(e,i.u_lightpos),u_lightintensity:new t.aM(e,i.u_lightintensity),u_lightcolor:new t.aP(e,i.u_lightcolor),u_vertical_gradient:new t.aM(e,i.u_vertical_gradient),u_opacity:new t.aM(e,i.u_opacity)}),fillExtrusionPattern:(e,i)=>({u_matrix:new t.aN(e,i.u_matrix),u_lightpos:new t.aP(e,i.u_lightpos),u_lightintensity:new t.aM(e,i.u_lightintensity),u_lightcolor:new t.aP(e,i.u_lightcolor),u_vertical_gradient:new t.aM(e,i.u_vertical_gradient),u_height_factor:new t.aM(e,i.u_height_factor),u_image:new t.aL(e,i.u_image),u_texsize:new t.aQ(e,i.u_texsize),u_pixel_coord_upper:new t.aQ(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.aQ(e,i.u_pixel_coord_lower),u_scale:new t.aP(e,i.u_scale),u_fade:new t.aM(e,i.u_fade),u_opacity:new t.aM(e,i.u_opacity)}),fill:(e,i)=>({u_matrix:new t.aN(e,i.u_matrix)}),fillPattern:(e,i)=>({u_matrix:new t.aN(e,i.u_matrix),u_image:new t.aL(e,i.u_image),u_texsize:new t.aQ(e,i.u_texsize),u_pixel_coord_upper:new t.aQ(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.aQ(e,i.u_pixel_coord_lower),u_scale:new t.aP(e,i.u_scale),u_fade:new t.aM(e,i.u_fade)}),fillOutline:(e,i)=>({u_matrix:new t.aN(e,i.u_matrix),u_world:new t.aQ(e,i.u_world)}),fillOutlinePattern:(e,i)=>({u_matrix:new t.aN(e,i.u_matrix),u_world:new t.aQ(e,i.u_world),u_image:new t.aL(e,i.u_image),u_texsize:new t.aQ(e,i.u_texsize),u_pixel_coord_upper:new t.aQ(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.aQ(e,i.u_pixel_coord_lower),u_scale:new t.aP(e,i.u_scale),u_fade:new t.aM(e,i.u_fade)}),circle:(e,i)=>({u_camera_to_center_distance:new t.aM(e,i.u_camera_to_center_distance),u_scale_with_map:new t.aL(e,i.u_scale_with_map),u_pitch_with_map:new t.aL(e,i.u_pitch_with_map),u_extrude_scale:new t.aQ(e,i.u_extrude_scale),u_device_pixel_ratio:new t.aM(e,i.u_device_pixel_ratio),u_matrix:new t.aN(e,i.u_matrix)}),collisionBox:(e,i)=>({u_matrix:new t.aN(e,i.u_matrix),u_camera_to_center_distance:new t.aM(e,i.u_camera_to_center_distance),u_pixels_to_tile_units:new t.aM(e,i.u_pixels_to_tile_units),u_extrude_scale:new t.aQ(e,i.u_extrude_scale),u_overscale_factor:new t.aM(e,i.u_overscale_factor)}),collisionCircle:(e,i)=>({u_matrix:new t.aN(e,i.u_matrix),u_inv_matrix:new t.aN(e,i.u_inv_matrix),u_camera_to_center_distance:new t.aM(e,i.u_camera_to_center_distance),u_viewport_size:new t.aQ(e,i.u_viewport_size)}),debug:(e,i)=>({u_color:new t.aR(e,i.u_color),u_matrix:new t.aN(e,i.u_matrix),u_overlay:new t.aL(e,i.u_overlay),u_overlay_scale:new t.aM(e,i.u_overlay_scale)}),clippingMask:(e,i)=>({u_matrix:new t.aN(e,i.u_matrix)}),heatmap:(e,i)=>({u_extrude_scale:new t.aM(e,i.u_extrude_scale),u_intensity:new t.aM(e,i.u_intensity),u_matrix:new t.aN(e,i.u_matrix)}),heatmapTexture:(e,i)=>({u_matrix:new t.aN(e,i.u_matrix),u_world:new t.aQ(e,i.u_world),u_image:new t.aL(e,i.u_image),u_color_ramp:new t.aL(e,i.u_color_ramp),u_opacity:new t.aM(e,i.u_opacity)}),hillshade:(e,i)=>({u_matrix:new t.aN(e,i.u_matrix),u_image:new t.aL(e,i.u_image),u_latrange:new t.aQ(e,i.u_latrange),u_light:new t.aQ(e,i.u_light),u_shadow:new t.aR(e,i.u_shadow),u_highlight:new t.aR(e,i.u_highlight),u_accent:new t.aR(e,i.u_accent)}),hillshadePrepare:(e,i)=>({u_matrix:new t.aN(e,i.u_matrix),u_image:new t.aL(e,i.u_image),u_dimension:new t.aQ(e,i.u_dimension),u_zoom:new t.aM(e,i.u_zoom),u_unpack:new t.aO(e,i.u_unpack)}),line:(e,i)=>({u_matrix:new t.aN(e,i.u_matrix),u_ratio:new t.aM(e,i.u_ratio),u_device_pixel_ratio:new t.aM(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.aQ(e,i.u_units_to_pixels)}),lineGradient:(e,i)=>({u_matrix:new t.aN(e,i.u_matrix),u_ratio:new t.aM(e,i.u_ratio),u_device_pixel_ratio:new t.aM(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.aQ(e,i.u_units_to_pixels),u_image:new t.aL(e,i.u_image),u_image_height:new t.aM(e,i.u_image_height)}),linePattern:(e,i)=>({u_matrix:new t.aN(e,i.u_matrix),u_texsize:new t.aQ(e,i.u_texsize),u_ratio:new t.aM(e,i.u_ratio),u_device_pixel_ratio:new t.aM(e,i.u_device_pixel_ratio),u_image:new t.aL(e,i.u_image),u_units_to_pixels:new t.aQ(e,i.u_units_to_pixels),u_scale:new t.aP(e,i.u_scale),u_fade:new t.aM(e,i.u_fade)}),lineSDF:(e,i)=>({u_matrix:new t.aN(e,i.u_matrix),u_ratio:new t.aM(e,i.u_ratio),u_device_pixel_ratio:new t.aM(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.aQ(e,i.u_units_to_pixels),u_patternscale_a:new t.aQ(e,i.u_patternscale_a),u_patternscale_b:new t.aQ(e,i.u_patternscale_b),u_sdfgamma:new t.aM(e,i.u_sdfgamma),u_image:new t.aL(e,i.u_image),u_tex_y_a:new t.aM(e,i.u_tex_y_a),u_tex_y_b:new t.aM(e,i.u_tex_y_b),u_mix:new t.aM(e,i.u_mix)}),raster:(e,i)=>({u_matrix:new t.aN(e,i.u_matrix),u_tl_parent:new t.aQ(e,i.u_tl_parent),u_scale_parent:new t.aM(e,i.u_scale_parent),u_buffer_scale:new t.aM(e,i.u_buffer_scale),u_fade_t:new t.aM(e,i.u_fade_t),u_opacity:new t.aM(e,i.u_opacity),u_image0:new t.aL(e,i.u_image0),u_image1:new t.aL(e,i.u_image1),u_brightness_low:new t.aM(e,i.u_brightness_low),u_brightness_high:new t.aM(e,i.u_brightness_high),u_saturation_factor:new t.aM(e,i.u_saturation_factor),u_contrast_factor:new t.aM(e,i.u_contrast_factor),u_spin_weights:new t.aP(e,i.u_spin_weights)}),symbolIcon:(e,i)=>({u_is_size_zoom_constant:new t.aL(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.aL(e,i.u_is_size_feature_constant),u_size_t:new t.aM(e,i.u_size_t),u_size:new t.aM(e,i.u_size),u_camera_to_center_distance:new t.aM(e,i.u_camera_to_center_distance),u_pitch:new t.aM(e,i.u_pitch),u_rotate_symbol:new t.aL(e,i.u_rotate_symbol),u_aspect_ratio:new t.aM(e,i.u_aspect_ratio),u_fade_change:new t.aM(e,i.u_fade_change),u_matrix:new t.aN(e,i.u_matrix),u_label_plane_matrix:new t.aN(e,i.u_label_plane_matrix),u_coord_matrix:new t.aN(e,i.u_coord_matrix),u_is_text:new t.aL(e,i.u_is_text),u_pitch_with_map:new t.aL(e,i.u_pitch_with_map),u_texsize:new t.aQ(e,i.u_texsize),u_texture:new t.aL(e,i.u_texture)}),symbolSDF:(e,i)=>({u_is_size_zoom_constant:new t.aL(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.aL(e,i.u_is_size_feature_constant),u_size_t:new t.aM(e,i.u_size_t),u_size:new t.aM(e,i.u_size),u_camera_to_center_distance:new t.aM(e,i.u_camera_to_center_distance),u_pitch:new t.aM(e,i.u_pitch),u_rotate_symbol:new t.aL(e,i.u_rotate_symbol),u_aspect_ratio:new t.aM(e,i.u_aspect_ratio),u_fade_change:new t.aM(e,i.u_fade_change),u_matrix:new t.aN(e,i.u_matrix),u_label_plane_matrix:new t.aN(e,i.u_label_plane_matrix),u_coord_matrix:new t.aN(e,i.u_coord_matrix),u_is_text:new t.aL(e,i.u_is_text),u_pitch_with_map:new t.aL(e,i.u_pitch_with_map),u_texsize:new t.aQ(e,i.u_texsize),u_texture:new t.aL(e,i.u_texture),u_gamma_scale:new t.aM(e,i.u_gamma_scale),u_device_pixel_ratio:new t.aM(e,i.u_device_pixel_ratio),u_is_halo:new t.aL(e,i.u_is_halo)}),symbolTextAndIcon:(e,i)=>({u_is_size_zoom_constant:new t.aL(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.aL(e,i.u_is_size_feature_constant),u_size_t:new t.aM(e,i.u_size_t),u_size:new t.aM(e,i.u_size),u_camera_to_center_distance:new t.aM(e,i.u_camera_to_center_distance),u_pitch:new t.aM(e,i.u_pitch),u_rotate_symbol:new t.aL(e,i.u_rotate_symbol),u_aspect_ratio:new t.aM(e,i.u_aspect_ratio),u_fade_change:new t.aM(e,i.u_fade_change),u_matrix:new t.aN(e,i.u_matrix),u_label_plane_matrix:new t.aN(e,i.u_label_plane_matrix),u_coord_matrix:new t.aN(e,i.u_coord_matrix),u_is_text:new t.aL(e,i.u_is_text),u_pitch_with_map:new t.aL(e,i.u_pitch_with_map),u_texsize:new t.aQ(e,i.u_texsize),u_texsize_icon:new t.aQ(e,i.u_texsize_icon),u_texture:new t.aL(e,i.u_texture),u_texture_icon:new t.aL(e,i.u_texture_icon),u_gamma_scale:new t.aM(e,i.u_gamma_scale),u_device_pixel_ratio:new t.aM(e,i.u_device_pixel_ratio),u_is_halo:new t.aL(e,i.u_is_halo)}),background:(e,i)=>({u_matrix:new t.aN(e,i.u_matrix),u_opacity:new t.aM(e,i.u_opacity),u_color:new t.aR(e,i.u_color)}),backgroundPattern:(e,i)=>({u_matrix:new t.aN(e,i.u_matrix),u_opacity:new t.aM(e,i.u_opacity),u_image:new t.aL(e,i.u_image),u_pattern_tl_a:new t.aQ(e,i.u_pattern_tl_a),u_pattern_br_a:new t.aQ(e,i.u_pattern_br_a),u_pattern_tl_b:new t.aQ(e,i.u_pattern_tl_b),u_pattern_br_b:new t.aQ(e,i.u_pattern_br_b),u_texsize:new t.aQ(e,i.u_texsize),u_mix:new t.aM(e,i.u_mix),u_pattern_size_a:new t.aQ(e,i.u_pattern_size_a),u_pattern_size_b:new t.aQ(e,i.u_pattern_size_b),u_scale_a:new t.aM(e,i.u_scale_a),u_scale_b:new t.aM(e,i.u_scale_b),u_pixel_coord_upper:new t.aQ(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.aQ(e,i.u_pixel_coord_lower),u_tile_units_to_pixels:new t.aM(e,i.u_tile_units_to_pixels)}),terrain:(e,i)=>({u_matrix:new t.aN(e,i.u_matrix),u_texture:new t.aL(e,i.u_texture),u_ele_delta:new t.aM(e,i.u_ele_delta)}),terrainDepth:(e,i)=>({u_matrix:new t.aN(e,i.u_matrix),u_ele_delta:new t.aM(e,i.u_ele_delta)}),terrainCoords:(e,i)=>({u_matrix:new t.aN(e,i.u_matrix),u_texture:new t.aL(e,i.u_texture),u_terrain_coords_id:new t.aM(e,i.u_terrain_coords_id),u_ele_delta:new t.aM(e,i.u_ele_delta)})};class Fe{constructor(t,e,i){this.context=t;const s=t.gl;this.buffer=s.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),s.bufferData(s.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?s.DYNAMIC_DRAW:s.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const e=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ke={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Le{constructor(t,e,i,s){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=s,this.context=t;const n=t.gl;this.buffer=n.createBuffer(),t.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,e){for(let i=0;i0){const i=t.Z(),s=f;t.aU(i,C.placementInvProjMatrix,e.transform.glCoordMatrix),t.aU(i,i,C.placementViewportMatrix),h.push({circleArray:y,circleOffset:d,transform:s,invTransform:i,coord:m}),u+=y.length/4,d=u}A&&g.draw(l,c.LINES,Bi.disabled,Gi.disabled,e.colorModeForRenderPass(),Ri.disabled,Ae(f,e.transform,I),e.style.map.terrain&&e.style.map.terrain.getTerrainData(m),s.id,A.layoutVertexBuffer,A.indexBuffer,A.segments,null,e.transform.zoom,null,null,A.collisionVertexBuffer)}if(!a||!h.length)return;const p=e.useProgram("collisionCircle"),m=new t.aV;m.resize(4*u),m._trim();let I=0;for(const t of h)for(let e=0;e=0&&(m[I.associatedIconIndex]={shiftedAnchor:w,angle:S})}else _t(I.numGlyphs,d)}if(g){p.clear();const i=e.icon.placedSymbolArray;for(let e=0;ee.style.map.terrain.getElevation(l,t,i):null,i="map"===s.layout.get("text-rotation-alignment");ut(c,l.posMatrix,e,r,J,M,C,g,i,t)}const L=e.translatePosMatrix(l.posMatrix,n,o,a),P=f||r&&v||K?Wi:J,X=e.translatePosMatrix(M,n,o,a,!0),H=d&&0!==s.paint.get(r?"text-halo-width":"icon-halo-width").constantOr(1);let E;E=d?c.iconsInText?We(_.kind,k,A,C,e,L,P,X,Z,V):Ve(_.kind,k,A,C,e,L,P,X,r,Z,!0):Te(_.kind,k,A,C,e,L,P,X,r,Z);const D={program:S,buffers:h,uniformValues:E,atlasTexture:G,atlasTextureIcon:W,atlasInterpolation:R,atlasInterpolationIcon:T,isSDF:d,hasHalo:H};if(y&&c.canOverlap){b=!0;const e=h.segments.get();for(const i of e)x.push({segments:new t.S([i]),sortKey:i.sortKey,state:D,terrainData:B})}else x.push({segments:h.segments,sortKey:0,state:D,terrainData:B})}b&&x.sort(((t,e)=>t.sortKey-e.sortKey));for(const t of x){const i=t.state;if(d.activeTexture.set(p.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,p.CLAMP_TO_EDGE),i.atlasTextureIcon&&(d.activeTexture.set(p.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,p.CLAMP_TO_EDGE)),i.isSDF){const n=i.uniformValues;i.hasHalo&&(n.u_is_halo=1,Ki(i.buffers,t.segments,s,e,i.program,_,h,u,n,t.terrainData)),n.u_is_halo=0}Ki(i.buffers,t.segments,s,e,i.program,_,h,u,i.uniformValues,t.terrainData)}}function Ki(t,e,i,s,n,r,o,a,l,c){const g=s.context;n.draw(g,g.gl.TRIANGLES,r,o,a,Ri.disabled,l,c,i.id,t.layoutVertexBuffer,t.indexBuffer,e,i.paint,s.transform.zoom,t.programConfigurations.get(i.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function Li(t,e,i,s,n){if(!i||!s||!s.imageAtlas)return;const r=s.imageAtlas.patternPositions;let o=r[i.to.toString()],a=r[i.from.toString()];if(!o&&a&&(o=a),!a&&o&&(a=o),!o||!a){const t=n.getPaintProperty(e);o=r[t],a=r[t]}o&&a&&t.setConstantPatternPositions(o,a)}function Pi(t,e,i,s,n,r,o){const a=t.context.gl,l="fill-pattern",c=i.paint.get(l),g=c&&c.constantOr(1),h=i.getCrossfadeParameters();let u,d,p,m,I;o?(d=g&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",u=a.LINES):(d=g?"fillPattern":"fill",u=a.TRIANGLES);const C=c.constantOr(null);for(const c of s){const s=e.getTile(c);if(g&&!s.patternsLoaded())continue;const f=s.getBucket(i);if(!f)continue;const A=f.programConfigurations.get(i.id),y=t.useProgram(d,A),b=t.style.map.terrain&&t.style.map.terrain.getTerrainData(c);g&&(t.context.activeTexture.set(a.TEXTURE0),s.imageAtlasTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE),A.updatePaintBuffers(h)),Li(A,l,C,s,i);const _=b?c:null,v=t.translatePosMatrix(_?_.posMatrix:c.posMatrix,s,i.paint.get("fill-translate"),i.paint.get("fill-translate-anchor"));if(o){m=f.indexBuffer2,I=f.segments2;const e=[a.drawingBufferWidth,a.drawingBufferHeight];p="fillOutlinePattern"===d&&g?Ce(v,t,h,s,e):Ie(v,e)}else m=f.indexBuffer,I=f.segments,p=g?me(v,t,h,s):pe(v);y.draw(t.context,u,n,t.stencilModeForClipping(c),r,Ri.disabled,p,b,i.id,f.layoutVertexBuffer,m,I,i.paint,t.transform.zoom,A)}}function Xi(t,e,i,s,n,r,o){const a=t.context,l=a.gl,c="fill-extrusion-pattern",g=i.paint.get(c),h=g.constantOr(1),u=i.getCrossfadeParameters(),d=i.paint.get("fill-extrusion-opacity"),p=g.constantOr(null);for(const g of s){const s=e.getTile(g),m=s.getBucket(i);if(!m)continue;const I=t.style.map.terrain&&t.style.map.terrain.getTerrainData(g),C=m.programConfigurations.get(i.id),f=t.useProgram(h?"fillExtrusionPattern":"fillExtrusion",C);h&&(t.context.activeTexture.set(l.TEXTURE0),s.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),C.updatePaintBuffers(u)),Li(C,c,p,s,i);const A=t.translatePosMatrix(g.posMatrix,s,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),y=i.paint.get("fill-extrusion-vertical-gradient"),b=h?de(A,t,y,d,g,u,s):ue(A,t,y,d);f.draw(a,a.gl.TRIANGLES,n,r,o,Ri.backCCW,b,I,i.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,i.paint,t.transform.zoom,C,t.style.map.terrain&&m.centroidVertexBuffer)}}function Hi(t,e,i,s,n,r,o){const a=t.context,l=a.gl,c=i.fbo;if(!c)return;const g=t.useProgram("hillshade"),h=t.style.map.terrain&&t.style.map.terrain.getTerrainData(e);a.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,c.colorAttachment.get()),g.draw(a,l.TRIANGLES,n,r,o,Ri.disabled,((t,e,i,s)=>{const n=i.paint.get("hillshade-shadow-color"),r=i.paint.get("hillshade-highlight-color"),o=i.paint.get("hillshade-accent-color");let a=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===i.paint.get("hillshade-illumination-anchor")&&(a-=t.transform.angle);const l=!t.options.moving;return{u_matrix:s?s.posMatrix:t.transform.calculatePosMatrix(e.tileID.toUnwrapped(),l),u_image:0,u_latrange:ve(0,e.tileID),u_light:[i.paint.get("hillshade-exaggeration"),a],u_shadow:n,u_highlight:r,u_accent:o}})(t,i,s,h?e:null),h,s.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}function Ei(e,i,s,n,r,o){const a=e.context,l=a.gl,c=i.dem;if(c&&c.data){const g=c.dim,h=c.stride,u=c.getPixels();if(a.activeTexture.set(l.TEXTURE1),a.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||e.getTileTexture(h),i.demTexture){const t=i.demTexture;t.update(u,{premultiply:!1}),t.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else i.demTexture=new A(a,u,l.RGBA,{premultiply:!1}),i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);a.activeTexture.set(l.TEXTURE0);let d=i.fbo;if(!d){const t=new A(a,{width:g,height:g,data:null},l.RGBA);t.bind(l.LINEAR,l.CLAMP_TO_EDGE),d=i.fbo=a.createFramebuffer(g,g,!0,!1),d.colorAttachment.set(t.texture)}a.bindFramebuffer.set(d.framebuffer),a.viewport.set([0,0,g,g]),e.useProgram("hillshadePrepare").draw(a,l.TRIANGLES,n,r,o,Ri.disabled,((e,i)=>{const s=i.stride,n=t.Z();return t.aS(n,0,t.N,-t.N,0,0,1),t.$(n,n,[0,-t.N,0]),{u_matrix:n,u_image:1,u_dimension:[s,s],u_zoom:e.overscaledZ,u_unpack:i.getUnpackVector()}})(i.tileID,c),null,s.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),i.needsHillshadePrepare=!1}}function Di(e,i,s,n,r,o){const a=n.paint.get("raster-fade-duration");if(!o&&a>0){const n=t.h.now(),o=(n-e.timeAdded)/a,l=i?(n-i.timeAdded)/a:-1,c=s.getSource(),g=r.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),h=!i||Math.abs(i.tileID.overscaledZ-g)>Math.abs(e.tileID.overscaledZ-g),u=h&&e.refreshedUponExpiration?1:t.ad(h?o:1-l,0,1);return e.refreshedUponExpiration&&o>=1&&(e.refreshedUponExpiration=!1),i?{opacity:1,mix:1-u}:{opacity:u,mix:0}}return{opacity:1,mix:0}}const Yi=new t.aT(1,0,0,1),Ni=new t.aT(0,1,0,1),Oi=new t.aT(0,0,1,1),Ui=new t.aT(1,0,1,1),ji=new t.aT(0,1,1,1);function Qi(t,e,i,s){$i(t,0,e+i/2,t.transform.width,i,s)}function qi(t,e,i,s){$i(t,e-i/2,0,i,t.transform.height,s)}function $i(t,e,i,s,n,r){const o=t.context,a=o.gl;a.enable(a.SCISSOR_TEST),a.scissor(e*t.pixelRatio,i*t.pixelRatio,s*t.pixelRatio,n*t.pixelRatio),o.clear({color:r}),a.disable(a.SCISSOR_TEST)}function ts(e,i,s){const n=e.context,r=n.gl,o=s.posMatrix,a=e.useProgram("debug"),l=Bi.disabled,c=Gi.disabled,g=e.colorModeForRenderPass(),h="$debug",u=e.style.map.terrain&&e.style.map.terrain.getTerrainData(s);n.activeTexture.set(r.TEXTURE0);const d=i.getTileByID(s.key).latestRawTileData,p=Math.floor((d&&d.byteLength||0)/1024),m=i.getTile(s).tileSize,I=512/Math.min(m,512)*(s.overscaledZ/e.transform.zoom)*.5;let C=s.canonical.toString();s.overscaledZ!==s.canonical.z&&(C+=` => ${s.overscaledZ}`),function(t,e){t.initDebugOverlayCanvas();const i=t.debugOverlayCanvas,s=t.context.gl,n=t.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,i.width,i.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(e,5,5),n.strokeText(e,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE)}(e,`${C} ${p}kB`),a.draw(n,r.TRIANGLES,l,c,Si.alphaBlended,Ri.disabled,ye(o,t.aT.transparent,I),null,h,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),a.draw(n,r.LINE_STRIP,l,c,g,Ri.disabled,ye(o,t.aT.red),u,h,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function es(t,e,i){const s=t.context,n=s.gl,r=t.colorModeForRenderPass(),o=new Bi(n.LEQUAL,Bi.ReadWrite,t.depthRangeFor3D),a=t.useProgram("terrain"),l=e.getTerrainMesh();s.bindFramebuffer.set(null),s.viewport.set([0,0,t.width,t.height]);for(const c of i){const i=t.renderToTexture.getTexture(c),g=e.getTerrainData(c.tileID);s.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,i.texture);const h={u_matrix:t.transform.calculatePosMatrix(c.tileID.toUnwrapped()),u_texture:0,u_ele_delta:e.getMeshFrameDelta(t.transform.zoom)};a.draw(s,n.TRIANGLES,o,Gi.disabled,r,Ri.backCCW,h,g,"terrain",l.vertexBuffer,l.indexBuffer,l.segments)}}class is{constructor(e,i){this.context=new ki(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:t.Z(),renderTime:0},this.setup(),this.numSublayers=j.maxUnderzooming+j.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new qt}resize(t,e,i){if(this.width=Math.floor(t*i),this.height=Math.floor(e*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const t of this.style._order)this.style._layers[t].resize()}setup(){const e=this.context,i=new t.a_;i.emplaceBack(0,0),i.emplaceBack(t.N,0),i.emplaceBack(0,t.N),i.emplaceBack(t.N,t.N),this.tileExtentBuffer=e.createVertexBuffer(i,ne.members),this.tileExtentSegments=t.S.simpleSegment(0,0,4,2);const s=new t.a_;s.emplaceBack(0,0),s.emplaceBack(t.N,0),s.emplaceBack(0,t.N),s.emplaceBack(t.N,t.N),this.debugBuffer=e.createVertexBuffer(s,ne.members),this.debugSegments=t.S.simpleSegment(0,0,4,5);const n=new t.V;n.emplaceBack(0,0,0,0),n.emplaceBack(t.N,0,t.N,0),n.emplaceBack(0,t.N,0,t.N),n.emplaceBack(t.N,t.N,t.N,t.N),this.rasterBoundsBuffer=e.createVertexBuffer(n,F.members),this.rasterBoundsSegments=t.S.simpleSegment(0,0,4,2);const r=new t.a_;r.emplaceBack(0,0),r.emplaceBack(1,0),r.emplaceBack(0,1),r.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(r,ne.members),this.viewportSegments=t.S.simpleSegment(0,0,4,2);const o=new t.a$;o.emplaceBack(0),o.emplaceBack(1),o.emplaceBack(3),o.emplaceBack(2),o.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(o);const a=new t.b0;a.emplaceBack(0,1,2),a.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(a);const l=this.context.gl;this.stencilClearMode=new Gi({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO)}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const s=t.Z();t.aS(s,0,this.width,this.height,0,0,1),t.a0(s,s,[i.drawingBufferWidth,i.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,i.TRIANGLES,Bi.disabled,this.stencilClearMode,Si.disabled,Ri.disabled,be(s),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,e){if(this.currentStencilSource===t.source||!t.isTileClipped()||!e||!e.length)return;this.currentStencilSource=t.source;const i=this.context,s=i.gl;this.nextStencilID+e.length>256&&this.clearStencil(),i.setColorMode(Si.disabled),i.setDepthMode(Bi.disabled);const n=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const t of e){const e=this._tileClippingMaskIDs[t.key]=this.nextStencilID++,r=this.style.map.terrain&&this.style.map.terrain.getTerrainData(t);n.draw(i,s.TRIANGLES,Bi.disabled,new Gi({func:s.ALWAYS,mask:0},e,255,s.KEEP,s.KEEP,s.REPLACE),Si.disabled,Ri.disabled,be(t.posMatrix),r,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,e=this.context.gl;return new Gi({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){const e=this.context.gl;return new Gi({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}stencilConfigForOverlap(t){const e=this.context.gl,i=t.sort(((t,e)=>e.overscaledZ-t.overscaledZ)),s=i[i.length-1].overscaledZ,n=i[0].overscaledZ-s+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();const t={};for(let i=0;i=0;this.currentLayer--){const t=this.style._layers[s[this.currentLayer]],e=n[t.source],i=r[t.source];this._renderTileClippingMasks(t,i),this.renderLayer(this,e,t,i)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayeri.source&&!i.isHidden(e)?[t.sourceCaches[i.source]]:[])),n=s.filter((t=>"vector"===t.getSource().type)),r=s.filter((t=>"vector"!==t.getSource().type)),o=t=>{(!i||i.getSource().maxzoomo(t))),i||r.forEach((t=>o(t))),i}(this.style,this.transform.zoom);t&&function(t,e,i){for(let s=0;si.style.map.terrain.getElevation(r,t,e):null)}}}(n,e,s,i,s.layout.get("text-rotation-alignment"),s.layout.get("text-pitch-alignment"),r),0!==s.paint.get("icon-opacity").constantOr(1)&&Fi(e,i,s,n,!1,s.paint.get("icon-translate"),s.paint.get("icon-translate-anchor"),s.layout.get("icon-rotation-alignment"),s.layout.get("icon-pitch-alignment"),s.layout.get("icon-keep-upright"),o,a),0!==s.paint.get("text-opacity").constantOr(1)&&Fi(e,i,s,n,!0,s.paint.get("text-translate"),s.paint.get("text-translate-anchor"),s.layout.get("text-rotation-alignment"),s.layout.get("text-pitch-alignment"),s.layout.get("text-keep-upright"),o,a),i.map.showCollisionBoxes&&(Vi(e,i,s,n,s.paint.get("text-translate"),s.paint.get("text-translate-anchor"),!0),Vi(e,i,s,n,s.paint.get("icon-translate"),s.paint.get("icon-translate-anchor"),!1))}(e,i,s,n,this.style.placement.variableOffsets);break;case"circle":!function(e,i,s,n){if("translucent"!==e.renderPass)return;const r=s.paint.get("circle-opacity"),o=s.paint.get("circle-stroke-width"),a=s.paint.get("circle-stroke-opacity"),l=!s.layout.get("circle-sort-key").isConstant();if(0===r.constantOr(1)&&(0===o.constantOr(1)||0===a.constantOr(1)))return;const c=e.context,g=c.gl,h=e.depthModeForSublayer(0,Bi.ReadOnly),u=Gi.disabled,d=e.colorModeForRenderPass(),p=[];for(let r=0;rt.sortKey-e.sortKey));for(const t of p){const{programConfiguration:i,program:n,layoutVertexBuffer:r,indexBuffer:o,uniformValues:a,terrainData:l}=t.state;n.draw(c,g.TRIANGLES,h,u,d,Ri.disabled,a,l,s.id,r,o,t.segments,s.paint,e.transform.zoom,i)}}(e,i,s,n);break;case"heatmap":!function(e,i,s,n){if(0!==s.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){const r=e.context,o=r.gl,a=Gi.disabled,l=new Si([o.ONE,o.ONE],t.aT.transparent,[!0,!0,!0,!0]);!function(t,e,i){const s=t.gl;t.activeTexture.set(s.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);let n=i.heatmapFbo;if(n)s.bindTexture(s.TEXTURE_2D,n.colorAttachment.get()),t.bindFramebuffer.set(n.framebuffer);else{const r=s.createTexture();s.bindTexture(s.TEXTURE_2D,r),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),n=i.heatmapFbo=t.createFramebuffer(e.width/4,e.height/4,!1,!1),function(t,e,i,s){var n,r;const o=t.gl,a=null!==(n=t.HALF_FLOAT)&&void 0!==n?n:o.UNSIGNED_BYTE,l=null!==(r=t.RGBA16F)&&void 0!==r?r:o.RGBA;o.texImage2D(o.TEXTURE_2D,0,l,e.width/4,e.height/4,0,o.RGBA,a,null),s.colorAttachment.set(i)}(t,e,r,n)}}(r,e,s),r.clear({color:t.aT.transparent});for(let t=0;t{const r=t.Z();t.aS(r,0,e.width,e.height,0,0,1);const o=e.context.gl;return{u_matrix:r,u_world:[o.drawingBufferWidth,o.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:i.paint.get("heatmap-opacity")}})(e,i),null,i.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,i.paint,e.transform.zoom)}(e,s))}(e,i,s,n);break;case"line":!function(e,i,s,n){if("translucent"!==e.renderPass)return;const r=s.paint.get("line-opacity"),o=s.paint.get("line-width");if(0===r.constantOr(1)||0===o.constantOr(1))return;const a=e.depthModeForSublayer(0,Bi.ReadOnly),l=e.colorModeForRenderPass(),c=s.paint.get("line-dasharray"),g=s.paint.get("line-pattern"),h=g.constantOr(1),u=s.paint.get("line-gradient"),d=s.getCrossfadeParameters(),p=h?"linePattern":c?"lineSDF":u?"lineGradient":"line",m=e.context,I=m.gl;let C=!0;for(const r of n){const n=i.getTile(r);if(h&&!n.patternsLoaded())continue;const o=n.getBucket(s);if(!o)continue;const f=o.programConfigurations.get(s.id),y=e.context.program.get(),b=e.useProgram(p,f),_=C||b.program!==y,v=e.style.map.terrain&&e.style.map.terrain.getTerrainData(r),x=g.constantOr(null);if(x&&n.imageAtlas){const t=n.imageAtlas,e=t.patternPositions[x.to.toString()],i=t.patternPositions[x.from.toString()];e&&i&&f.setConstantPatternPositions(e,i)}const w=v?r:null,S=h?Se(e,n,s,d,w):c?ke(e,n,s,c,d,w):u?we(e,n,s,o.lineClipsArray.length,w):xe(e,n,s,w);if(h)m.activeTexture.set(I.TEXTURE0),n.imageAtlasTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE),f.updatePaintBuffers(d);else if(c&&(_||e.lineAtlas.dirty))m.activeTexture.set(I.TEXTURE0),e.lineAtlas.bind(m);else if(u){const n=o.gradients[s.id];let a=n.texture;if(s.gradientVersion!==n.version){let l=256;if(s.stepInterpolant){const s=i.getSource().maxzoom,n=r.canonical.z===s?Math.ceil(1<0?e.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const e=this.imageManager.getPattern(t.from.toString()),i=this.imageManager.getPattern(t.to.toString());return!e||!i}useProgram(t,e){this.cache=this.cache||{};const i=t+(e?e.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[i]||(this.cache[i]=new ge(this.context,oe[t],e,Me[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[i]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new A(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:e}=this.context.gl;return this.width!==t||this.height!==e}}class ss{constructor(t,e){this.points=t,this.planes=e}static fromInvProjectionMatrix(e,i,s){const n=Math.pow(2,s),r=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((s=>{const r=1/(s=t.ag([],s,e))[3]/i*n;return t.b3(s,s,[r,r,1/s[3],r])})),o=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((t=>{const e=function(t,e){var i=e[0],s=e[1],n=e[2],r=i*i+s*s+n*n;return r>0&&(r=1/Math.sqrt(r)),t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}([],function(t,e,i){var s=e[0],n=e[1],r=e[2],o=i[0],a=i[1],l=i[2];return t[0]=n*l-r*a,t[1]=r*o-s*l,t[2]=s*a-n*o,t}([],m([],r[t[0]],r[t[1]]),m([],r[t[2]],r[t[1]]))),i=-((s=e)[0]*(n=r[t[1]])[0]+s[1]*n[1]+s[2]*n[2]);var s,n;return e.concat(i)}));return new ss(r,o)}}class ns{constructor(t,e){this.min=t,this.max=e,this.center=function(t,e,i){return t[0]=.5*e[0],t[1]=.5*e[1],t[2]=.5*e[2],t}([],function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t}([],this.min,this.max))}quadrant(t){const e=[t%2==0,t<2],i=d(this.min),s=d(this.max);for(let t=0;t=0&&o++;if(0===o)return 0;o!==i.length&&(s=!1)}if(s)return 2;for(let t=0;t<3;t++){let i=Number.MAX_VALUE,s=-Number.MAX_VALUE;for(let n=0;nthis.max[t]-this.min[t])return 0}return 1}}class rs{constructor(t=0,e=0,i=0,s=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(i)||i<0||isNaN(s)||s<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=i,this.right=s}interpolate(e,i,s){return null!=i.top&&null!=e.top&&(this.top=t.B.number(e.top,i.top,s)),null!=i.bottom&&null!=e.bottom&&(this.bottom=t.B.number(e.bottom,i.bottom,s)),null!=i.left&&null!=e.left&&(this.left=t.B.number(e.left,i.left,s)),null!=i.right&&null!=e.right&&(this.right=t.B.number(e.right,i.right,s)),this}getCenter(e,i){const s=t.ad((this.left+e-this.right)/2,0,e),n=t.ad((this.top+i-this.bottom)/2,0,i);return new t.P(s,n)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new rs(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class os{constructor(e,i,s,n,r){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=void 0===r||!!r,this._minZoom=e||0,this._maxZoom=i||22,this._minPitch=null==s?0:s,this._maxPitch=null==n?60:n,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.L(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new rs,this._posMatrixCache={},this._alignedPosMatrixCache={},this._minEleveationForCurrentTile=0}clone(){const t=new os(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this._minEleveationForCurrentTile=t._minEleveationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new t.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){const i=-t.b5(e,-180,180)*Math.PI/180;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=function(){var e=new t.A(4);return t.A!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}(),function(t,e,i){var s=e[0],n=e[1],r=e[2],o=e[3],a=Math.sin(i),l=Math.cos(i);t[0]=s*l+r*a,t[1]=n*l+o*a,t[2]=s*-a+r*l,t[3]=n*-a+o*l}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){const i=t.ad(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.tileZoom=Math.max(0,Math.floor(e)),this.scale=this.zoomScale(e),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,i){this._unmodified=!1,this._edgeInsets.interpolate(t,e,i),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)}getVisibleUnwrappedCoordinates(e){const i=[new t.b6(0,e)];if(this._renderWorldCopies){const s=this.pointCoordinate(new t.P(0,0)),n=this.pointCoordinate(new t.P(this.width,0)),r=this.pointCoordinate(new t.P(this.width,this.height)),o=this.pointCoordinate(new t.P(0,this.height)),a=Math.floor(Math.min(s.x,n.x,r.x,o.x)),l=Math.floor(Math.max(s.x,n.x,r.x,o.x)),c=1;for(let s=a-c;s<=l+c;s++)0!==s&&i.push(new t.b6(s,e))}return i}coveringTiles(e){var i,s;let n=this.coveringZoomLevel(e);const r=n;if(void 0!==e.minzoom&&ne.maxzoom&&(n=e.maxzoom);const o=this.pointCoordinate(this.getCameraPoint()),a=t.U.fromLngLat(this.center),l=Math.pow(2,n),c=[l*o.x,l*o.y,0],g=[l*a.x,l*a.y,0],h=ss.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,n);let u=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(u=n);const d=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,p=t=>({aabb:new ns([t*l,0,0],[(t+1)*l,l,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),m=[],C=[],f=n,A=e.reparseOverscaled?r:n;if(this._renderWorldCopies)for(let t=1;t<=3;t++)m.push(p(-t)),m.push(p(t));for(m.push(p(0));m.length>0;){const n=m.pop(),r=n.x,o=n.y;let a=n.fullyVisible;if(!a){const t=n.aabb.intersects(h);if(0===t)continue;a=2===t}const l=e.terrain?c:g,p=n.aabb.distanceX(l),y=n.aabb.distanceY(l),b=Math.max(Math.abs(p),Math.abs(y));if(n.zoom===f||b>d+(1<=u){const e=f-n.zoom,i=c[0]-.5-(r<>1),h=n.zoom+1;let u=n.aabb.quadrant(l);if(e.terrain){const r=new t.O(h,n.wrap,h,c,g),o=e.terrain.getMinMaxElevation(r),a=null!==(i=o.minElevation)&&void 0!==i?i:this.elevation,l=null!==(s=o.maxElevation)&&void 0!==s?s:this.elevation;u=new ns([u.min[0],u.min[1],a],[u.max[0],u.max[1],l])}m.push({aabb:u,zoom:h,x:c,y:g,wrap:n.wrap,fullyVisible:a})}}return C.sort(((t,e)=>t.distanceSq-e.distanceSq)).map((t=>t.tileID))}resize(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(e){const i=t.ad(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.P(t.G(e.lng)*this.worldSize,t.H(i)*this.worldSize)}unproject(e){return new t.U(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(e){const i=this.pointLocation(this.centerPoint,e),s=e.getElevationForLngLatZoom(i,this.tileZoom);if(!(this.elevation-s))return;const n=this.getCameraPosition(),r=t.U.fromLngLat(n.lngLat,n.altitude),o=t.U.fromLngLat(i,s),a=r.x-o.x,l=r.y-o.y,c=r.z-o.z,g=Math.sqrt(a*a+l*l+c*c),h=this.scaleZoom(this.cameraToCenterDistance/g/this.tileSize);this._elevation=s,this._center=i,this.zoom=h}setLocationAtPoint(e,i){const s=this.pointCoordinate(i),n=this.pointCoordinate(this.centerPoint),r=this.locationCoordinate(e),o=new t.U(r.x-(s.x-n.x),r.y-(s.y-n.y));this.center=this.coordinateLocation(o),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,e){return e?this.coordinatePoint(this.locationCoordinate(t),e.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,e){return this.coordinateLocation(this.pointCoordinate(t,e))}locationCoordinate(e){return t.U.fromLngLat(e)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(e,i){if(i){const t=i.pointCoordinate(e);if(null!=t)return t}const s=[e.x,e.y,0,1],n=[e.x,e.y,1,1];t.ag(s,s,this.pixelMatrixInverse),t.ag(n,n,this.pixelMatrixInverse);const r=s[3],o=n[3],a=s[1]/r,l=n[1]/o,c=s[2]/r,g=n[2]/o,h=c===g?0:(0-c)/(g-c);return new t.U(t.B.number(s[0]/r,n[0]/o,h)/this.worldSize,t.B.number(a,l,h)/this.worldSize)}coordinatePoint(e,i=0,s=this.pixelMatrix){const n=[e.x*this.worldSize,e.y*this.worldSize,i,1];return t.ag(n,n,s),new t.P(n[0]/n[3],n[1]/n[3])}getBounds(){const e=Math.max(0,this.height/2-this.getHorizon());return(new T).extend(this.pointLocation(new t.P(0,e))).extend(this.pointLocation(new t.P(this.width,e))).extend(this.pointLocation(new t.P(this.width,this.height))).extend(this.pointLocation(new t.P(0,this.height)))}getMaxBounds(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new T([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(e,i=!1){const s=e.key,n=i?this._alignedPosMatrixCache:this._posMatrixCache;if(n[s])return n[s];const r=e.canonical,o=this.worldSize/this.zoomScale(r.z),a=r.x+Math.pow(2,r.z)*e.wrap,l=t.ao(new Float64Array(16));return t.$(l,l,[a*o,r.y*o,0]),t.a0(l,l,[o/t.N,o/t.N,1]),t.a1(l,i?this.alignedProjMatrix:this.projMatrix,l),n[s]=new Float32Array(l),n[s]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let e,i,s,n,r=-90,o=90,a=-180,l=180;const c=this.size,g=this._unmodified;if(this.latRange){const i=this.latRange;r=t.H(i[1])*this.worldSize,o=t.H(i[0])*this.worldSize,e=o-ro&&(n=o-e)}if(this.lngRange){const e=(a+l)/2,i=t.b5(h.x,e-this.worldSize/2,e+this.worldSize/2),n=c.x/2;i-nl&&(s=l-n)}void 0===s&&void 0===n||(this.center=this.unproject(new t.P(void 0!==s?s:h.x,void 0!==n?n:h.y)).wrap()),this._unmodified=g,this._constraining=!1}_calcMatrices(){if(!this.height)return;const e=this.centerOffset,i=this.point.x,s=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=t.b7(1,this.center.lat)*this.worldSize;let n=t.ao(new Float64Array(16));t.a0(n,n,[this.width/2,-this.height/2,1]),t.$(n,n,[1,-1,0]),this.labelPlaneMatrix=n,n=t.ao(new Float64Array(16)),t.a0(n,n,[1,-1,1]),t.$(n,n,[-1,-1,0]),t.a0(n,n,[2/this.width,2/this.height,1]),this.glCoordMatrix=n;const r=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),o=Math.min(this.elevation,this._minEleveationForCurrentTile),a=r-o*this._pixelPerMeter/Math.cos(this._pitch),l=o<0?a:r,c=Math.PI/2+this._pitch,g=this._fov*(.5+e.y/this.height),h=Math.sin(g)*l/Math.sin(t.ad(Math.PI-c-g,.01,Math.PI-.01)),u=this.getHorizon(),d=2*Math.atan(u/this.cameraToCenterDistance)*(.5+e.y/(2*u)),p=Math.sin(d)*l/Math.sin(t.ad(Math.PI-c-d,.01,Math.PI-.01)),m=Math.min(h,p),I=1.01*(Math.cos(Math.PI/2-this._pitch)*m+l),C=this.height/50;n=new Float64Array(16),t.b8(n,this._fov,this.width/this.height,C,I),n[8]=2*-e.x/this.width,n[9]=2*e.y/this.height,t.a0(n,n,[1,-1,1]),t.$(n,n,[0,0,-this.cameraToCenterDistance]),t.b9(n,n,this._pitch),t.ae(n,n,this.angle),t.$(n,n,[-i,-s,0]),this.mercatorMatrix=t.a0([],n,[this.worldSize,this.worldSize,this.worldSize]),t.a0(n,n,[1,1,this._pixelPerMeter]),this.pixelMatrix=t.a1(new Float64Array(16),this.labelPlaneMatrix,n),t.$(n,n,[0,0,-this.elevation]),this.projMatrix=n,this.invProjMatrix=t.as([],n),this.pixelMatrix3D=t.a1(new Float64Array(16),this.labelPlaneMatrix,n);const f=this.width%2/2,A=this.height%2/2,y=Math.cos(this.angle),b=Math.sin(this.angle),_=i-Math.round(i)+y*f+b*A,v=s-Math.round(s)+y*A+b*f,x=new Float64Array(n);if(t.$(x,x,[_>.5?_-1:_,v>.5?v-1:v,0]),this.alignedProjMatrix=x,n=t.as(new Float64Array(16),this.pixelMatrix),!n)throw new Error("failed to invert matrix");this.pixelMatrixInverse=n,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const e=this.pointCoordinate(new t.P(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.ag(i,i,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.P(0,e))}getCameraQueryGeometry(e){const i=this.getCameraPoint();if(1===e.length)return[e[0],i];{let s=i.x,n=i.y,r=i.x,o=i.y;for(const t of e)s=Math.min(s,t.x),n=Math.min(n,t.y),r=Math.max(r,t.x),o=Math.max(o,t.y);return[new t.P(s,n),new t.P(r,n),new t.P(r,o),new t.P(s,o),new t.P(s,n)]}}}function as(t,e){let i,s=!1,n=null,r=null;const o=()=>{n=null,s&&(t.apply(r,i),n=setTimeout(o,e),s=!1)};return(...t)=>(s=!0,r=this,i=t,n||o(),n)}class ls{constructor(t){this._getCurrentHash=()=>{const t=window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map((t=>t.split("="))).forEach((t=>{t[0]===this._hashName&&(e=t)})),(e&&e[1]||"").split("/")}return t.split("/")},this._onHashChange=()=>{const t=this._getCurrentHash();if(t.length>=3&&!t.some((t=>isNaN(t)))){const e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch(t){}},this._updateHash=as(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const e=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,s=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.pow(10,s),r=Math.round(e.lng*n)/n,o=Math.round(e.lat*n)/n,a=this._map.getBearing(),l=this._map.getPitch();let c="";if(c+=t?`/${r}/${o}/${i}`:`${i}/${o}/${r}`,(a||l)&&(c+="/"+Math.round(10*a)/10),l&&(c+=`/${Math.round(l)}`),this._hashName){const t=this._hashName;let e=!1;const i=window.location.hash.slice(1).split("&").map((i=>{const s=i.split("=")[0];return s===t?(e=!0,`${s}=${c}`):i})).filter((t=>t));return e||i.push(`${t}=${c}`),`#${i.join("&")}`}return`#${c}`}}const cs={linearity:.3,easing:t.ba(0,0,.3,1)},gs=t.e({deceleration:2500,maxSpeed:1400},cs),hs=t.e({deceleration:20,maxSpeed:1400},cs),us=t.e({deceleration:1e3,maxSpeed:360},cs),ds=t.e({deceleration:1e3,maxSpeed:90},cs);class ps{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:t.h.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=t.h.now();for(;e.length>0&&i-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,pan:new t.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:t}of this._inertiaBuffer)i.zoom+=t.zoomDelta||0,i.bearing+=t.bearingDelta||0,i.pitch+=t.pitchDelta||0,t.panDelta&&i.pan._add(t.panDelta),t.around&&(i.around=t.around),t.pinchAround&&(i.pinchAround=t.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(i.pan.mag()){const r=Is(i.pan.mag(),s,t.e({},gs,e||{}));n.offset=i.pan.mult(r.amount/i.pan.mag()),n.center=this._map.transform.center,ms(n,r)}if(i.zoom){const t=Is(i.zoom,s,hs);n.zoom=this._map.transform.zoom+t.amount,ms(n,t)}if(i.bearing){const e=Is(i.bearing,s,us);n.bearing=this._map.transform.bearing+t.ad(e.amount,-179,179),ms(n,e)}if(i.pitch){const t=Is(i.pitch,s,ds);n.pitch=this._map.transform.pitch+t.amount,ms(n,t)}if(n.zoom||n.bearing){const t=void 0===i.pinchAround?i.around:i.pinchAround;n.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),t.e(n,{noMoveStart:!0})}}function ms(t,e){(!t.duration||t.durations.unproject(t))),l=o.reduce(((t,e,i,s)=>t.add(e.div(s.length))),new t.P(0,0));super(e,{points:o,point:l,lngLats:a,lngLat:s.unproject(l),originalEvent:n}),this._defaultPrevented=!1}}class As extends t.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,i){super(t,{originalEvent:i}),this._defaultPrevented=!1}}class ys{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new As(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new Cs(t.type,this._map,t))}mouseup(t){this._map.fire(new Cs(t.type,this._map,t))}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new Cs(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Cs(t.type,this._map,t))}mouseover(t){this._map.fire(new Cs(t.type,this._map,t))}mouseout(t){this._map.fire(new Cs(t.type,this._map,t))}touchstart(t){return this._firePreventable(new fs(t.type,this._map,t))}touchmove(t){this._map.fire(new fs(t.type,this._map,t))}touchend(t){this._map.fire(new fs(t.type,this._map,t))}touchcancel(t){this._map.fire(new fs(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class bs{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Cs(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Cs("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Cs(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class _s{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.pointLocation(t.P.convert(e),this._map.terrain)}}class vs{constructor(t,e){this._map=t,this._tr=new _s(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(i.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)}mousemoveWindow(t,e){if(!this._active)return;const s=e;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)t.fitScreenCoordinates(n,r,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(i.remove(this._box),this._box=null),i.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new t.k(e,{originalEvent:i}))}}function xs(t,e){if(t.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${t.length}, points ${e.length}`);const i={};for(let s=0;sthis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),s.length===this.numTouches&&(this.centroid=function(e){const i=new t.P(0,0);for(const t of e)i._add(t);return i.div(e.length)}(i),this.touches=xs(s,i)))}touchmove(t,e,i){if(this.aborted||!this.centroid)return;const s=xs(i,e);for(const t in this.touches){const e=s[t];(!e||e.dist(this.touches[t])>30)&&(this.aborted=!0)}}touchend(t,e,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class Ss{constructor(t){this.singleTap=new ws(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,e,i){this.singleTap.touchstart(t,e,i)}touchmove(t,e,i){this.singleTap.touchmove(t,e,i)}touchend(t,e,i){const s=this.singleTap.touchend(t,e,i);if(s){const e=t.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(s)<30;if(e&&i||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=s,this.count===this.numTaps)return this.reset(),s}}}class ks{constructor(t){this._tr=new _s(t),this._zoomIn=new Ss({numTouches:1,numTaps:2}),this._zoomOut=new Ss({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,e,i){this._zoomIn.touchstart(t,e,i),this._zoomOut.touchstart(t,e,i)}touchmove(t,e,i){this._zoomIn.touchmove(t,e,i),this._zoomOut.touchmove(t,e,i)}touchend(t,e,i){const s=this._zoomIn.touchend(t,e,i),n=this._zoomOut.touchend(t,e,i),r=this._tr;return s?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:r.zoom+1,around:r.unproject(s)},{originalEvent:t})}):n?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:r.zoom-1,around:r.unproject(n)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Bs{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const e=this._moveFunction(...t);if(e.bearingDelta||e.pitchDelta||e.around||e.panDelta)return this._active=!0,e}dragStart(t,e){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=e.length?e[0]:e,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,e){if(!this.isEnabled())return;const i=this._lastPoint;if(!i)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const s=e.length?e[0]:e;return!this._moved&&s.dist(i){t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=function(t){t.preventDefault()}},Vs=({enable:t,clickTolerance:e,bearingDegreesPerPixelMoved:s=.8})=>{const n=new Gs({checkCorrectEvent:t=>0===i.mouseButton(t)&&t.ctrlKey||2===i.mouseButton(t)});return new Bs({clickTolerance:e,move:(t,e)=>({bearingDelta:(e.x-t.x)*s}),moveStateManager:n,enable:t,assignEvents:Ts})},Ws=({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:s=-.5})=>{const n=new Gs({checkCorrectEvent:t=>0===i.mouseButton(t)&&t.ctrlKey||2===i.mouseButton(t)});return new Bs({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*s}),moveStateManager:n,enable:t,assignEvents:Ts})};class zs{constructor(t,e){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=e,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new t.P(0,0),setTimeout((()=>{this._cancelCooperativeMessage=!1}),200)}touchstart(t,e,i){return this._calculateTransform(t,e,i)}touchmove(t,e,i){if(this._map._cooperativeGestures&&(2===this._minTouches&&i.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,i.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(i.length0&&(this._active=!0);const n=xs(s,i),r=new t.P(0,0),o=new t.P(0,0);let a=0;for(const t in n){const e=n[t],i=this._touches[t];i&&(r._add(e),o._add(e.sub(i)),a++,n[t]=e)}if(this._touches=n,aMath.abs(t.x)}class Hs extends Js{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,e,i){super.touchstart(t,e,i),this._currentTouchCount=i.length}_start(t){this._lastPoints=t,Xs(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,e,i){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const s=t[0].sub(this._lastPoints[0]),n=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(s,n,i.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(s.y+n.y)/2*-.5}):void 0}gestureBeginsVertically(t,e,i){if(void 0!==this._valid)return this._valid;const s=t.mag()>=2,n=e.mag()>=2;if(!s&&!n)return;if(!s||!n)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const r=t.y>0==e.y>0;return Xs(t)&&Xs(e)&&r}}const Es={panStep:100,bearingStep:15,pitchStep:10};class Ds{constructor(t){this._tr=new _s(t);const e=Es;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let e=0,i=0,s=0,n=0,r=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?i=-1:(t.preventDefault(),n=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),n=1);break;case 38:t.shiftKey?s=1:(t.preventDefault(),r=-1);break;case 40:t.shiftKey?s=-1:(t.preventDefault(),r=1);break;default:return}return this._rotationDisabled&&(i=0,s=0),{cameraAnimation:o=>{const a=this._tr;o.easeTo({duration:300,easeId:"keyboardHandler",easing:Ys,zoom:e?Math.round(a.zoom)+e*(t.shiftKey?2:1):a.zoom,bearing:a.bearing+i*this._bearingStep,pitch:a.pitch+s*this._pitchStep,offset:[-n*this._panStep,-r*this._panStep],center:a.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Ys(t){return t*(2-t)}const Ns=4.000244140625;class Os{constructor(t,e){this._onTimeout=t=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},this._map=t,this._tr=new _s(t),this._el=t.getCanvasContainer(),this._triggerRenderFrame=e,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around)}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(e){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!e[this._map._metaKey])return;e.preventDefault()}let i=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const s=t.h.now(),n=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,0!==i&&i%Ns==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(n*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const s=i.mousePos(this._el,e),n=this._tr;this._around=t.L.convert(this._aroundCenter?n.center:n.unproject(s)),this._aroundPoint=n.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const e=this._tr.transform;if(0!==this._delta){const t="wheel"===this._type&&Math.abs(this._delta)>Ns?this._wheelZoomRate:this._defaultZoomRate;let i=2/(1+Math.exp(-Math.abs(this._delta*t)));this._delta<0&&0!==i&&(i=1/i);const s="number"==typeof this._targetZoom?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(s*i))),"wheel"===this._type&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i="number"==typeof this._targetZoom?this._targetZoom:e.zoom,s=this._startZoom,n=this._easing;let r,o=!1;if("wheel"===this._type&&s&&n){const e=Math.min((t.h.now()-this._lastWheelEventTime)/200,1),a=n(e);r=t.B.number(s,i,a),e<1?this._frameId||(this._frameId=!0):o=!0}else r=i,o=!0;return this._active=!0,o&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!o,zoomDelta:r-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=t.bb;if(this._prevEase){const e=this._prevEase,s=(t.h.now()-e.start)/e.duration,n=e.easing(s+.01)-e.easing(s),r=.27/Math.sqrt(n*n+1e-4)*.01,o=Math.sqrt(.0729-r*r);i=t.ba(r,o,.25,1)}return this._prevEase={start:t.h.now(),duration:e,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Us{constructor(t,e){this._clickZoom=t,this._tapZoom=e}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class js{constructor(t){this._tr=new _s(t),this.reset()}reset(){this._active=!1}dblclick(t,e){return t.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(e)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Qs{constructor(){this._tap=new Ss({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,e,i){if(!this._swipePoint)if(this._tapTime){const s=e[0],n=t.timeStamp-this._tapTime<500,r=this._tapPoint.dist(s)<30;n&&r?i.length>0&&(this._swipePoint=s,this._swipeTouch=i[0].identifier):this.reset()}else this._tap.touchstart(t,e,i)}touchmove(t,e,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const s=e[0],n=s.y-this._swipePoint.y;return this._swipePoint=s,t.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(t,e,i)}touchend(t,e,i){if(this._tapTime)this._swipePoint&&0===i.length&&this.reset();else{const s=this._tap.touchend(t,e,i);s&&(this._tapTime=t.timeStamp,this._tapPoint=s)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class qs{constructor(t,e,i){this._el=t,this._mousePan=e,this._touchPan=i}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class $s{constructor(t,e,i){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=i}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class tn{constructor(t,e,i,s){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=s,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const en=t=>t.zoom||t.drag||t.pitch||t.rotate;class sn extends t.k{}function nn(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}class rn{constructor(t,e){this.handleWindowEvent=t=>{this.handleEvent(t,`${t.type}Window`)},this.handleEvent=(t,e)=>{if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;const s="renderFrame"===t.type?void 0:t,n={needsRenderFrame:!1},r={},o={},a=t.touches,l=a?this._getMapTouches(a):void 0,c=l?i.touchPos(this._el,l):i.mousePos(this._el,t);for(const{handlerName:i,handler:a,allowed:g}of this._handlers){if(!a.isEnabled())continue;let h;this._blockedByActive(o,g,i)?a.reset():a[e||t.type]&&(h=a[e||t.type](t,c,l),this.mergeHandlerResult(n,r,h,i,s),h&&h.needsRenderFrame&&this._triggerRenderFrame()),(h||a.isActive())&&(o[i]=a)}const g={};for(const t in this._previousActiveHandlers)o[t]||(g[t]=s);this._previousActiveHandlers=o,(Object.keys(g).length||nn(n))&&(this._changes.push([n,r,g]),this._triggerRenderFrame()),(Object.keys(o).length||nn(n))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:h}=n;h&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],h(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ps(t),this._bearingSnap=e.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(e);const s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[window,"blur",void 0]];for(const[t,e,s]of this._listeners)i.addEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,s)}destroy(){for(const[t,e,s]of this._listeners)i.removeEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(t){const e=this._map,s=e.getCanvasContainer();this._add("mapEvent",new ys(e,t));const n=e.boxZoom=new vs(e,t);this._add("boxZoom",n),t.interactive&&t.boxZoom&&n.enable();const r=new ks(e),o=new js(e);e.doubleClickZoom=new Us(o,r),this._add("tapZoom",r),this._add("clickZoom",o),t.interactive&&t.doubleClickZoom&&e.doubleClickZoom.enable();const a=new Qs;this._add("tapDragZoom",a);const l=e.touchPitch=new Hs(e);this._add("touchPitch",l),t.interactive&&t.touchPitch&&e.touchPitch.enable(t.touchPitch);const c=Vs(t),g=Ws(t);e.dragRotate=new $s(t,c,g),this._add("mouseRotate",c,["mousePitch"]),this._add("mousePitch",g,["mouseRotate"]),t.interactive&&t.dragRotate&&e.dragRotate.enable();const h=(({enable:t,clickTolerance:e})=>{const s=new Gs({checkCorrectEvent:t=>0===i.mouseButton(t)&&!t.ctrlKey});return new Bs({clickTolerance:e,move:(t,e)=>({around:e,panDelta:e.sub(t)}),activateOnStart:!0,moveStateManager:s,enable:t,assignEvents:Ts})})(t),u=new zs(t,e);e.dragPan=new qs(s,h,u),this._add("mousePan",h),this._add("touchPan",u,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&e.dragPan.enable(t.dragPan);const d=new Ps,p=new Ks;e.touchZoomRotate=new tn(s,p,d,a),this._add("touchRotate",d,["touchPan","touchZoom"]),this._add("touchZoom",p,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&e.touchZoomRotate.enable(t.touchZoomRotate);const m=e.scrollZoom=new Os(e,(()=>this._triggerRenderFrame()));this._add("scrollZoom",m,["mousePan"]),t.interactive&&t.scrollZoom&&e.scrollZoom.enable(t.scrollZoom);const I=e.keyboard=new Ds(e);this._add("keyboard",I),t.interactive&&t.keyboard&&e.keyboard.enable(),this._add("blockableMapEvent",new bs(e))}_add(t,e,i){this._handlers.push({handlerName:t,handler:e,allowed:i}),this._handlersById[t]=e}stop(t){if(!this._updatingCamera){for(const{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(en(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,e,i){for(const s in t)if(s!==i&&(!e||e.indexOf(s)<0))return!0;return!1}_getMapTouches(t){const e=[];for(const i of t)this._el.contains(i.target)&&e.push(i);return e}mergeHandlerResult(e,i,s,n,r){if(!s)return;t.e(e,s);const o={handlerName:n,originalEvent:s.originalEvent||r};void 0!==s.zoomDelta&&(i.zoom=o),void 0!==s.panDelta&&(i.drag=o),void 0!==s.pitchDelta&&(i.pitch=o),void 0!==s.bearingDelta&&(i.rotate=o)}_applyChanges(){const e={},i={},s={};for(const[n,r,o]of this._changes)n.panDelta&&(e.panDelta=(e.panDelta||new t.P(0,0))._add(n.panDelta)),n.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+n.pitchDelta),void 0!==n.around&&(e.around=n.around),void 0!==n.pinchAround&&(e.pinchAround=n.pinchAround),n.noInertia&&(e.noInertia=n.noInertia),t.e(i,r),t.e(s,o);this._updateMapTransform(e,i,s),this._changes=[]}_updateMapTransform(t,e,i){const s=this._map,n=s._getTransformForUpdate(),r=s.terrain;if(!(nn(t)||r&&this._terrainMovement))return this._fireEvents(e,i,!0);let{panDelta:o,zoomDelta:a,bearingDelta:l,pitchDelta:c,around:g,pinchAround:h}=t;void 0!==h&&(g=h),s._stop(!0),g=g||s.transform.centerPoint;const u=n.pointLocation(o?g.sub(o):g);l&&(n.bearing+=l),c&&(n.pitch+=c),a&&(n.zoom+=a),r?this._terrainMovement||!e.drag&&!e.zoom?e.drag&&this._terrainMovement?n.center=n.pointLocation(n.centerPoint.sub(o)):n.setLocationAtPoint(u,g):(this._terrainMovement=!0,this._map._elevationFreeze=!0,n.setLocationAtPoint(u,g),this._map.once("moveend",(()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,n.recalculateZoom(s.terrain)}))):n.setLocationAtPoint(u,g),s._applyUpdatedTransform(n),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,i,!0)}_fireEvents(e,i,s){const n=en(this._eventsInProgress),r=en(e),o={};for(const t in e){const{originalEvent:i}=e[t];this._eventsInProgress[t]||(o[`${t}start`]=i),this._eventsInProgress[t]=e[t]}!n&&r&&this._fireEvent("movestart",r.originalEvent);for(const t in o)this._fireEvent(t,o[t]);r&&this._fireEvent("move",r.originalEvent);for(const t in e){const{originalEvent:i}=e[t];this._fireEvent(t,i)}const a={};let l;for(const t in this._eventsInProgress){const{handlerName:e,originalEvent:s}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],l=i[e]||s,a[`${t}end`]=l)}for(const t in a)this._fireEvent(t,a[t]);const c=en(this._eventsInProgress);if(s&&(n||r)&&!c){this._updatingCamera=!0;const e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=t=>0!==t&&-this._bearingSnap{delete this._frameId,this.handleEvent(new sn("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class on extends t.E{constructor(e,i){super(),this._renderFrameCallback=()=>{const e=Math.min((t.h.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=i.bearingSnap,this.on("moveend",(()=>{delete this._requestedCameraState}))}getCenter(){return new t.L(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}panBy(e,i,s){return e=t.P.convert(e).mult(-1),this.panTo(this.transform.center,t.e({offset:e},i),s)}panTo(e,i,s){return this.easeTo(t.e({center:e},i),s)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(e,i,s){return this.easeTo(t.e({zoom:e},i),s)}zoomIn(t,e){return this.zoomTo(this.getZoom()+1,t,e),this}zoomOut(t,e){return this.zoomTo(this.getZoom()-1,t,e),this}getBearing(){return this.transform.bearing}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(e,i,s){return this.easeTo(t.e({bearing:e},i),s)}resetNorth(e,i){return this.rotateTo(0,t.e({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(t.e({bearing:0,pitch:0,duration:1e3},e),i),this}snapToNorth(t,e){return Math.abs(this.getBearing()){if(this._zooming&&(s.zoom=t.B.number(n,l,p)),this._rotating&&(s.bearing=t.B.number(r,c,p)),this._pitching&&(s.pitch=t.B.number(o,g,p)),this._padding&&(s.interpolatePadding(a,h,p),d=s.centerPoint.add(u)),this.terrain&&!e.freezeElevation&&this._updateElevation(p),A)s.setLocationAtPoint(A,y);else{const t=s.zoomScale(s.zoom-n),e=l>n?Math.min(2,f):Math.max(.5,f),i=Math.pow(e,1-p),r=s.unproject(I.add(C.mult(p*i)).mult(t));s.setLocationAtPoint(s.renderWorldCopies?r.wrap():r,d)}this._applyUpdatedTransform(s),this._fireMoveEvents(i)}),(t=>{this.terrain&&this._finalizeElevation(),this._afterEase(i,t)}),e),this}_prepareEase(e,i,s={}){this._moving=!0,i||s.moving||this.fire(new t.k("movestart",e)),this._zooming&&!s.zooming&&this.fire(new t.k("zoomstart",e)),this._rotating&&!s.rotating&&this.fire(new t.k("rotatestart",e)),this._pitching&&!s.pitching&&this.fire(new t.k("pitchstart",e))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&i!==this._elevationTarget){const t=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(t-(i-(t*e+this._elevationStart))/(1-e)),this._elevationTarget=i}this.transform.elevation=t.B.number(this._elevationStart,this._elevationTarget,e)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(t){if(!this.transformCameraUpdate)return;const e=t.clone(),{center:i,zoom:s,pitch:n,bearing:r,elevation:o}=this.transformCameraUpdate(e);i&&(e.center=i),void 0!==s&&(e.zoom=s),void 0!==n&&(e.pitch=n),void 0!==r&&(e.bearing=r),void 0!==o&&(e.elevation=o),this.transform.apply(e)}_fireMoveEvents(e){this.fire(new t.k("move",e)),this._zooming&&this.fire(new t.k("zoom",e)),this._rotating&&this.fire(new t.k("rotate",e)),this._pitching&&this.fire(new t.k("pitch",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const s=this._zooming,n=this._rotating,r=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,s&&this.fire(new t.k("zoomend",e)),n&&this.fire(new t.k("rotateend",e)),r&&this.fire(new t.k("pitchend",e)),this.fire(new t.k("moveend",e))}flyTo(e,i){if(!e.essential&&t.h.prefersReducedMotion){const s=t.F(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(s,i)}this.stop(),e=t.e({offset:[0,0],speed:1.2,curve:1.42,easing:t.bb},e);const s=this._getTransformForUpdate(),n=this.getZoom(),r=this.getBearing(),o=this.getPitch(),a=this.getPadding(),l="zoom"in e?t.ad(+e.zoom,s.minZoom,s.maxZoom):n,c="bearing"in e?this._normalizeBearing(e.bearing,r):r,g="pitch"in e?+e.pitch:o,h="padding"in e?e.padding:s.padding,u=s.zoomScale(l-n),d=t.P.convert(e.offset);let p=s.centerPoint.add(d);const m=s.pointLocation(p),I=t.L.convert(e.center||m);this._normalizeCenter(I);const C=s.project(m),f=s.project(I).sub(C);let A=e.curve;const y=Math.max(s.width,s.height),b=y/u,_=f.mag();if("minZoom"in e){const i=t.ad(Math.min(e.minZoom,n,l),s.minZoom,s.maxZoom),r=y/s.zoomScale(i-n);A=Math.sqrt(r/_*2)}const v=A*A;function x(t){const e=(b*b-y*y+(t?-1:1)*v*v*_*_)/(2*(t?b:y)*v*_);return Math.log(Math.sqrt(e*e+1)-e)}function w(t){return(Math.exp(t)-Math.exp(-t))/2}function S(t){return(Math.exp(t)+Math.exp(-t))/2}const k=x(!1);let B=function(t){return S(k)/S(k+A*t)},Z=function(t){return y*((S(k)*(w(e=k+A*t)/S(e))-w(k))/v)/_;var e},G=(x(!0)-k)/A;if(Math.abs(_)<1e-6||!isFinite(G)){if(Math.abs(y-b)<1e-6)return this.easeTo(e,i);const t=be.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=r!==c,this._pitching=g!==o,this._padding=!s.isPaddingEqual(h),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(I),this._ease((u=>{const m=u*G,A=1/B(m);s.zoom=1===u?l:n+s.scaleZoom(A),this._rotating&&(s.bearing=t.B.number(r,c,u)),this._pitching&&(s.pitch=t.B.number(o,g,u)),this._padding&&(s.interpolatePadding(a,h,u),p=s.centerPoint.add(d)),this.terrain&&!e.freezeElevation&&this._updateElevation(u);const y=1===u?I:s.unproject(C.add(f.mult(Z(m))).mult(A));s.setLocationAtPoint(s.renderWorldCopies?y.wrap():y,p),this._applyUpdatedTransform(s),this._fireMoveEvents(i)}),(()=>{this.terrain&&this._finalizeElevation(),this._afterEase(i)}),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,e)}if(!t){const t=this.handlers;t&&t.stop(!1)}return this}_ease(e,i,s){!1===s.animate||0===s.duration?(e(1),i()):(this._easeStart=t.h.now(),this._easeOptions=s,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=t.b5(e,-180,180);const s=Math.abs(e-i);return Math.abs(e-360-i)180?-360:i<-180?360:0}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(t.L.convert(e),this.transform.tileZoom)-this.transform.elevation:null}}class an{constructor(t={}){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=t=>{!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType&&"terrain"!==t.type||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=i.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=i.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=i.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){i.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,e){const i=this._map._getUIString(`AttributionControl.${e}`);t.title=i,t.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((t=>"string"!=typeof t?"":t))):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}const e=this._map.style.sourceCaches;for(const i in e){const s=e[i];if(s.used||s.usedForTerrain){const e=s.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution)}}t=t.filter((t=>String(t).trim())),t.sort(((t,e)=>t.length-e.length)),t=t.filter(((e,i)=>{for(let s=i+1;s=0)return!1;return!0}));const i=t.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,t.length?(this._innerContainer.innerHTML=i,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class ln{constructor(t={}){this._updateCompact=()=>{const t=this._container.children;if(t.length){const e=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&e.classList.add("maplibregl-compact"):e.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=i.create("div","maplibregl-ctrl");const e=i.create("a","maplibregl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){i.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class cn{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){const e=this._currentlyRunning,i=e?this._queue.concat(e):this._queue;for(const e of i)if(e.id===t)return void(e.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const e=this._currentlyRunning=this._queue;this._queue=[];for(const i of e)if(!i.cancelled&&(i.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const gn={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};var hn=t.Q([{name:"a_pos3d",type:"Int16",components:3}]);class un extends t.E{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,i){this.sourceCache.update(e,i),this._renderableTilesKeys=[];const s={};for(const n of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i}))s[n.key]=!0,this._renderableTilesKeys.push(n.key),this._tiles[n.key]||(n.posMatrix=new Float64Array(16),t.aS(n.posMatrix,0,t.N,0,t.N,0,1),this._tiles[n.key]=new N(n,this.tileSize));for(const t in this._tiles)s[t]||delete this._tiles[t]}freeRtt(t){for(const e in this._tiles){const i=this._tiles[e];(!t||i.tileID.equals(t)||i.tileID.isChildOf(t)||t.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(e){const i={};for(const s of this._renderableTilesKeys){const n=this._tiles[s].tileID;if(n.canonical.equals(e.canonical)){const n=e.clone();n.posMatrix=new Float64Array(16),t.aS(n.posMatrix,0,t.N,0,t.N,0,1),i[s]=n}else if(n.canonical.isChildOf(e.canonical)){const r=e.clone();r.posMatrix=new Float64Array(16);const o=n.canonical.z-e.canonical.z,a=n.canonical.x-(n.canonical.x>>o<>o<>o;t.aS(r.posMatrix,0,c,0,c,0,1),t.$(r.posMatrix,r.posMatrix,[-a*c,-l*c,0]),i[s]=r}else if(e.canonical.isChildOf(n.canonical)){const r=e.clone();r.posMatrix=new Float64Array(16);const o=e.canonical.z-n.canonical.z,a=e.canonical.x-(e.canonical.x>>o<>o<>o;t.aS(r.posMatrix,0,t.N,0,t.N,0,1),t.$(r.posMatrix,r.posMatrix,[a*c,l*c,0]),t.a0(r.posMatrix,r.posMatrix,[1/2**o,1/2**o,0]),i[s]=r}}return i}getSourceTile(t,e){const i=this.sourceCache._source;let s=t.overscaledZ-this.deltaZoom;if(s>i.maxzoom&&(s=i.maxzoom),s=i.minzoom&&(!n||!n.dem);)n=this.sourceCache.getTileByID(t.scaledTo(s--).key);return n}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter((e=>e.timeAdded>=t))}}class dn{constructor(t,e,i){this.painter=t,this.sourceCache=new un(e),this.options=i,this.exaggeration="number"==typeof i.exaggeration?i.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,i,s,n=t.N){var r;if(!(i>=0&&i=0&&se.canonical.z&&(e.canonical.z>=s?n=e.canonical.z-s:t.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const r=e.canonical.x-(e.canonical.x>>n<>n<>8<<4|t>>8,i[e+3]=0;const s=new t.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),n=new A(e,s,e.gl.RGBA,{premultiply:!1});return n.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=n,n}pointCoordinate(e){const i=new Uint8Array(4),s=this.painter.context,n=s.gl;s.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),n.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,n.RGBA,n.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null);const r=i[0]+(i[2]>>4<<8),o=i[1]+((15&i[2])<<8),a=this.coordsIndex[255-i[3]],l=a&&this.sourceCache.getTileByID(a);if(!l)return null;const c=this._coordsTextureSize,g=(1<0&&Math.sign(r)<0||!s&&Math.sign(n)<0&&Math.sign(r)>0?(n=360*Math.sign(r)+n,t.G(n)):i}}class pn{constructor(t,e,i){this._context=t,this._size=e,this._tileSize=i,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const e=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),i=new A(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return i.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),e.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),e.colorAttachment.set(i.texture),{id:t,fbo:e,texture:i,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((e=>t.id!==e)),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length!t.inUse))}}const mn={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class In{constructor(t,e){this.painter=t,this.terrain=e,this.pool=new pn(t.context,30,e.sourceCache.tileSize*e.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,e){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter((i=>!t._layers[i].isHidden(e))),this._coordsDescendingInv={};for(const e in t.sourceCaches){this._coordsDescendingInv[e]={};const i=t.sourceCaches[e].getVisibleCoordinates();for(const t of i){const i=this.terrain.sourceCache.getTerrainCoords(t);for(const t in i)this._coordsDescendingInv[e][t]||(this._coordsDescendingInv[e][t]=[]),this._coordsDescendingInv[e][t].push(i[t])}}this._coordsDescendingInvStr={};for(const e of t._order){const i=t._layers[e],s=i.source;if(mn[i.type]&&!this._coordsDescendingInvStr[s]){this._coordsDescendingInvStr[s]={};for(const t in this._coordsDescendingInv[s])this._coordsDescendingInvStr[s][t]=this._coordsDescendingInv[s][t].map((t=>t.key)).sort().join()}}for(const t of this._renderableTiles)for(const e in this._coordsDescendingInvStr){const i=this._coordsDescendingInvStr[e][t.tileID.key];i&&i!==t.rttCoords[e]&&(t.rtt=[])}}renderLayer(e){if(e.isHidden(this.painter.transform.zoom))return!1;const i=e.type,s=this.painter,n=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(mn[i]&&(this._prevType&&mn[this._prevType]||this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(e.id),!n))return!0;if(mn[this._prevType]||mn[i]&&n){this._prevType=i;const e=this._stacks.length-1,n=this._stacks[e]||[];for(const i of this._renderableTiles){if(this.pool.isFull()&&(es(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(i),i.rtt[e]){const t=this.pool.getObjectForId(i.rtt[e].id);if(t.stamp===i.rtt[e].stamp){this.pool.useObject(t);continue}}const r=this.pool.getOrCreateFreeObject();this.pool.useObject(r),this.pool.stampObject(r),i.rtt[e]={id:r.id,stamp:r.stamp},s.context.bindFramebuffer.set(r.fbo.framebuffer),s.context.clear({color:t.aT.transparent,stencil:0}),s.currentStencilSource=void 0;for(let t=0;t{t.touchstart=t.dragStart,t.touchmoveWindow=t.dragMove,t.touchend=t.dragEnd},yn={showCompass:!0,showZoom:!0,visualizePitch:!1};class bn{constructor(e,s,n=!1){this.mousedown=e=>{this.startMouse(t.e({},e,{ctrlKey:!0,preventDefault:()=>e.preventDefault()}),i.mousePos(this.element,e)),i.addEventListener(window,"mousemove",this.mousemove),i.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=t=>{this.moveMouse(t,i.mousePos(this.element,t))},this.mouseup=t=>{this.mouseRotate.dragEnd(t),this.mousePitch&&this.mousePitch.dragEnd(t),this.offTemp()},this.touchstart=t=>{1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=i.touchPos(this.element,t.targetTouches)[0],this.startTouch(t,this._startPos),i.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),i.addEventListener(window,"touchend",this.touchend))},this.touchmove=t=>{1!==t.targetTouches.length?this.reset():(this._lastPos=i.touchPos(this.element,t.targetTouches)[0],this.moveTouch(t,this._lastPos))},this.touchend=t=>{0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const r=e.dragRotate._mouseRotate.getClickTolerance(),o=e.dragRotate._mousePitch.getClickTolerance();this.element=s,this.mouseRotate=Vs({clickTolerance:r,enable:!0}),this.touchRotate=(({enable:t,clickTolerance:e,bearingDegreesPerPixelMoved:i=.8})=>{const s=new Rs;return new Bs({clickTolerance:e,move:(t,e)=>({bearingDelta:(e.x-t.x)*i}),moveStateManager:s,enable:t,assignEvents:An})})({clickTolerance:r,enable:!0}),this.map=e,n&&(this.mousePitch=Ws({clickTolerance:o,enable:!0}),this.touchPitch=(({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:i=-.5})=>{const s=new Rs;return new Bs({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*i}),moveStateManager:s,enable:t,assignEvents:An})})({clickTolerance:o,enable:!0})),i.addEventListener(s,"mousedown",this.mousedown),i.addEventListener(s,"touchstart",this.touchstart,{passive:!1}),i.addEventListener(s,"touchcancel",this.reset)}startMouse(t,e){this.mouseRotate.dragStart(t,e),this.mousePitch&&this.mousePitch.dragStart(t,e),i.disableDrag()}startTouch(t,e){this.touchRotate.dragStart(t,e),this.touchPitch&&this.touchPitch.dragStart(t,e),i.disableDrag()}moveMouse(t,e){const i=this.map,{bearingDelta:s}=this.mouseRotate.dragMove(t,e)||{};if(s&&i.setBearing(i.getBearing()+s),this.mousePitch){const{pitchDelta:s}=this.mousePitch.dragMove(t,e)||{};s&&i.setPitch(i.getPitch()+s)}}moveTouch(t,e){const i=this.map,{bearingDelta:s}=this.touchRotate.dragMove(t,e)||{};if(s&&i.setBearing(i.getBearing()+s),this.touchPitch){const{pitchDelta:s}=this.touchPitch.dragMove(t,e)||{};s&&i.setPitch(i.getPitch()+s)}}off(){const t=this.element;i.removeEventListener(t,"mousedown",this.mousedown),i.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),i.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),i.removeEventListener(window,"touchend",this.touchend),i.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){i.enableDrag(),i.removeEventListener(window,"mousemove",this.mousemove),i.removeEventListener(window,"mouseup",this.mouseup),i.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),i.removeEventListener(window,"touchend",this.touchend)}}let _n;function vn(e,i,s){if(e=new t.L(e.lng,e.lat),i){const n=new t.L(e.lng-360,e.lat),r=new t.L(e.lng+360,e.lat),o=s.locationPoint(e).distSqr(i);s.locationPoint(n).distSqr(i)180;){const t=s.locationPoint(e);if(t.x>=0&&t.y>=0&&t.x<=s.width&&t.y<=s.height)break;e.lng>s.center.lng?e.lng-=360:e.lng+=360}return e}const xn={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function wn(t,e,i){const s=t.classList;for(const t in xn)s.remove(`maplibregl-${i}-anchor-${t}`);s.add(`maplibregl-${i}-anchor-${e}`)}class Sn extends t.E{constructor(e){if(super(),this._onKeyPress=t=>{const e=t.code,i=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==i&&13!==i||this.togglePopup()},this._onMapClick=t=>{const e=t.originalEvent.target,i=this._element;this._popup&&(e===i||i.contains(e))&&this.togglePopup()},this._update=t=>{if(!this._map)return;const e=this._map.loaded()&&!this._map.isMoving();("terrain"===(null==t?void 0:t.type)||"render"===(null==t?void 0:t.type)&&!e)&&this._map.once("render",this._update),this._map.transform.renderWorldCopies&&(this._lngLat=vn(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let s="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?s=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(s=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let n="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?n="rotateX(0deg)":"map"===this._pitchAlignment&&(n=`rotateX(${this._map.getPitch()}deg)`),t&&"moveend"!==t.type||(this._pos=this._pos.round()),i.setTransform(this._element,`${xn[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${n} ${s}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout((()=>{const t=this._map.unproject(this._pos),e=40075016.686*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=t.distanceTo(this._lngLat)>20*e?"0.2":"1.0",this._opacityTimeout=null}),100))},this._onMove=e=>{if(!this._isDragging){const t=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new t.k("dragstart"))),this.fire(new t.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new t.k("dragend")),this._state="inactive"},this._addDragHandler=t=>{this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,e&&e.element)this._element=e.element,this._offset=t.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=i.create("div"),this._element.setAttribute("aria-label","Map marker");const s=i.createNS("http://www.w3.org/2000/svg","svg"),n=41,r=27;s.setAttributeNS(null,"display","block"),s.setAttributeNS(null,"height",`${n}px`),s.setAttributeNS(null,"width",`${r}px`),s.setAttributeNS(null,"viewBox",`0 0 ${r} ${n}`);const o=i.createNS("http://www.w3.org/2000/svg","g");o.setAttributeNS(null,"stroke","none"),o.setAttributeNS(null,"stroke-width","1"),o.setAttributeNS(null,"fill","none"),o.setAttributeNS(null,"fill-rule","evenodd");const a=i.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"fill-rule","nonzero");const l=i.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");const c=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const t of c){const e=i.createNS("http://www.w3.org/2000/svg","ellipse");e.setAttributeNS(null,"opacity","0.04"),e.setAttributeNS(null,"cx","10.5"),e.setAttributeNS(null,"cy","5.80029008"),e.setAttributeNS(null,"rx",t.rx),e.setAttributeNS(null,"ry",t.ry),l.appendChild(e)}const g=i.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"fill",this._color);const h=i.createNS("http://www.w3.org/2000/svg","path");h.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),g.appendChild(h);const u=i.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"opacity","0.25"),u.setAttributeNS(null,"fill","#000000");const d=i.createNS("http://www.w3.org/2000/svg","path");d.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),u.appendChild(d);const p=i.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"transform","translate(6.0, 7.0)"),p.setAttributeNS(null,"fill","#FFFFFF");const m=i.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(8.0, 8.0)");const I=i.createNS("http://www.w3.org/2000/svg","circle");I.setAttributeNS(null,"fill","#000000"),I.setAttributeNS(null,"opacity","0.25"),I.setAttributeNS(null,"cx","5.5"),I.setAttributeNS(null,"cy","5.5"),I.setAttributeNS(null,"r","5.4999962");const C=i.createNS("http://www.w3.org/2000/svg","circle");C.setAttributeNS(null,"fill","#FFFFFF"),C.setAttributeNS(null,"cx","5.5"),C.setAttributeNS(null,"cy","5.5"),C.setAttributeNS(null,"r","5.4999962"),m.appendChild(I),m.appendChild(C),a.appendChild(l),a.appendChild(g),a.appendChild(u),a.appendChild(p),a.appendChild(m),s.appendChild(a),s.setAttributeNS(null,"height",n*this._scale+"px"),s.setAttributeNS(null,"width",r*this._scale+"px"),this._element.appendChild(s),this._offset=t.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(t=>{t.preventDefault()})),this._element.addEventListener("mousedown",(t=>{t.preventDefault()})),wn(this._element,this._anchor,"marker"),e&&e.className)for(const t of e.className.split(" "))this._element.classList.add(t);this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),i.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.L.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const e=38.1,i=13.5,s=Math.abs(i)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-e],"bottom-left":[s,-1*(e-i+s)],"bottom-right":[-s,-1*(e-i+s)],left:[i,-1*(e-i)],right:[-i,-1*(e-i)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}getOffset(){return this._offset}setOffset(e){return this._offset=t.P.convert(e),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const kn={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Bn=0,Zn=!1;const Gn={maxWidth:100,unit:"metric"};function Rn(t,e,i){const s=i&&i.maxWidth||100,n=t._container.clientHeight/2,r=t.unproject([0,n]),o=t.unproject([s,n]),a=r.distanceTo(o);if(i&&"imperial"===i.unit){const i=3.2808*a;i>5280?Tn(e,s,i/5280,t._getUIString("ScaleControl.Miles")):Tn(e,s,i,t._getUIString("ScaleControl.Feet"))}else i&&"nautical"===i.unit?Tn(e,s,a/1852,t._getUIString("ScaleControl.NauticalMiles")):a>=1e3?Tn(e,s,a/1e3,t._getUIString("ScaleControl.Kilometers")):Tn(e,s,a,t._getUIString("ScaleControl.Meters"))}function Tn(t,e,i,s){const n=function(t){const e=Math.pow(10,`${Math.floor(t)}`.length-1);let i=t/e;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(t){const e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(i),e*i}(i);t.style.width=e*(n/i)+"px",t.innerHTML=`${n} ${s}`}const Vn={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Wn=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function zn(e){if(e){if("number"==typeof e){const i=Math.round(Math.abs(e)/Math.SQRT2);return{center:new t.P(0,0),top:new t.P(0,e),"top-left":new t.P(i,i),"top-right":new t.P(-i,i),bottom:new t.P(0,-e),"bottom-left":new t.P(i,-i),"bottom-right":new t.P(-i,-i),left:new t.P(e,0),right:new t.P(-e,0)}}if(e instanceof t.P||Array.isArray(e)){const i=t.P.convert(e);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:t.P.convert(e.center||[0,0]),top:t.P.convert(e.top||[0,0]),"top-left":t.P.convert(e["top-left"]||[0,0]),"top-right":t.P.convert(e["top-right"]||[0,0]),bottom:t.P.convert(e.bottom||[0,0]),"bottom-left":t.P.convert(e["bottom-left"]||[0,0]),"bottom-right":t.P.convert(e["bottom-right"]||[0,0]),left:t.P.convert(e.left||[0,0]),right:t.P.convert(e.right||[0,0])}}return zn(new t.P(0,0))}const Jn={extend:(e,...i)=>t.e(e,...i),run(t){t()},logToElement(t,e=!1,i="log"){const s=window.document.getElementById(i);s&&(e&&(s.innerHTML=""),s.innerHTML+=`
${t}`)}},Mn=e;class Fn{static get version(){return Mn}static get workerCount(){return tt.workerCount}static set workerCount(t){tt.workerCount=t}static get maxParallelImageRequests(){return t.c.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(e){t.c.MAX_PARALLEL_IMAGE_REQUESTS=e}static get workerUrl(){return t.c.WORKER_URL}static set workerUrl(e){t.c.WORKER_URL=e}static addProtocol(e,i){t.c.REGISTERED_PROTOCOLS[e]=i}static removeProtocol(e){delete t.c.REGISTERED_PROTOCOLS[e]}}return Fn.Map=class extends on{constructor(e){if(t.bg.mark(t.bh.create),null!=(e=t.e({},fn,e)).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new os(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),{bearingSnap:e.bearingSnap}),this._cooperativeGesturesOnWheel=t=>{this._onCooperativeGesture(t,t[this._metaKey],1)},this._contextLost=e=>{e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new t.k("webglcontextlost",{originalEvent:e}))},this._contextRestored=e=>{this._setupPainter(),this.resize(),this._update(),this.fire(new t.k("webglcontextrestored",{originalEvent:e}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=e.interactive,this._cooperativeGestures=e.cooperativeGestures,this._metaKey=0===navigator.platform.indexOf("Mac")?"metaKey":"ctrlKey",this._maxTileCacheSize=e.maxTileCacheSize,this._maxTileCacheZoomLevels=e.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new cn,this._controls=[],this._mapId=t.a2(),this._locale=t.e({},gn,e.locale),this._clickTolerance=e.clickTolerance,this._overridePixelRatio=e.pixelRatio,this._maxCanvasSize=e.maxCanvasSize,this.transformCameraUpdate=e.transformCameraUpdate,this._imageQueueHandle=c.addThrottleControl((()=>this.isMoving())),this._requestManager=new h(e.transformRequest),"string"==typeof e.container){if(this._container=document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else{if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this.on("terrain",(()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)})),this.once("idle",(()=>{this._idleTriggered=!0})),"undefined"!=typeof window){addEventListener("online",this._onWindowOnline,!1);let t=!1;const e=as((t=>{this._trackResize&&!this._removed&&this.resize(t)._update()}),50);this._resizeObserver=new ResizeObserver((i=>{t?e(i):t=!0})),this._resizeObserver.observe(this._container)}this.handlers=new rn(this,e),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=e.hash&&new ls("string"==typeof e.hash&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.e({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,this._validateStyle=e.validateStyle,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new an({customAttribution:e.customAttribution})),e.maplibreLogo&&this.addControl(new ln,e.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)})),this.on("data",(e=>{this._update("style"===e.dataType),this.fire(new t.k(`${e.dataType}data`,e))})),this.on("dataloading",(e=>{this.fire(new t.k(`${e.dataType}dataloading`,e))})),this.on("dataabort",(e=>{this.fire(new t.k("sourcedataabort",e))}))}_getMapId(){return this._mapId}addControl(e,i){if(void 0===i&&(i=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new t.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const s=e.onAdd(this);this._controls.push(e);const n=this._controlPositions[i];return-1!==i.indexOf("bottom")?n.insertBefore(s,n.firstChild):n.appendChild(s),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new t.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(e);return i>-1&&this._controls.splice(i,1),e.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}calculateCameraOptionsFromTo(t,e,i,s){return null==s&&this.terrain&&(s=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(t,e,i,s)}resize(e){var i;const s=this._containerDimensions(),n=s[0],r=s[1],o=this._getClampedPixelRatio(n,r);if(this._resizeCanvas(n,r,o),this.painter.resize(n,r,o),this.painter.overLimit()){const t=this.painter.context.gl;this._maxCanvasSize=[t.drawingBufferWidth,t.drawingBufferHeight];const e=this._getClampedPixelRatio(n,r);this._resizeCanvas(n,r,e),this.painter.resize(n,r,e)}this.transform.resize(n,r),null===(i=this._requestedCameraState)||void 0===i||i.resize(n,r);const a=!this._moving;return a&&(this.stop(),this.fire(new t.k("movestart",e)).fire(new t.k("move",e))),this.fire(new t.k("resize",e)),a&&this.fire(new t.k("moveend",e)),this}_getClampedPixelRatio(t,e){const{0:i,1:s}=this._maxCanvasSize,n=this.getPixelRatio(),r=t*n,o=e*n;return Math.min(r>i?i/r:1,o>s?s/o:1)*n}getPixelRatio(){var t;return null!==(t=this._overridePixelRatio)&&void 0!==t?t:devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds(T.convert(t)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.renderWorldCopies=t,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(t){return this._cooperativeGestures=t,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(e){return this.transform.locationPoint(t.L.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.pointLocation(t.P.convert(e),this.terrain)}isMoving(){var t;return this._moving||(null===(t=this.handlers)||void 0===t?void 0:t.isMoving())}isZooming(){var t;return this._zooming||(null===(t=this.handlers)||void 0===t?void 0:t.isZooming())}isRotating(){var t;return this._rotating||(null===(t=this.handlers)||void 0===t?void 0:t.isRotating())}_createDelegatedListener(t,e,i){if("mouseenter"===t||"mouseover"===t){let s=!1;const n=n=>{const r=this.getLayer(e)?this.queryRenderedFeatures(n.point,{layers:[e]}):[];r.length?s||(s=!0,i.call(this,new Cs(t,this,n.originalEvent,{features:r}))):s=!1};return{layer:e,listener:i,delegates:{mousemove:n,mouseout:()=>{s=!1}}}}if("mouseleave"===t||"mouseout"===t){let s=!1;const n=n=>{(this.getLayer(e)?this.queryRenderedFeatures(n.point,{layers:[e]}):[]).length?s=!0:s&&(s=!1,i.call(this,new Cs(t,this,n.originalEvent)))},r=e=>{s&&(s=!1,i.call(this,new Cs(t,this,e.originalEvent)))};return{layer:e,listener:i,delegates:{mousemove:n,mouseout:r}}}{const s=t=>{const s=this.getLayer(e)?this.queryRenderedFeatures(t.point,{layers:[e]}):[];s.length&&(t.features=s,i.call(this,t),delete t.features)};return{layer:e,listener:i,delegates:{[t]:s}}}}on(t,e,i){if(void 0===i)return super.on(t,e);const s=this._createDelegatedListener(t,e,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(s);for(const t in s.delegates)this.on(t,s.delegates[t]);return this}once(t,e,i){if(void 0===i)return super.once(t,e);const s=this._createDelegatedListener(t,e,i);for(const t in s.delegates)this.once(t,s.delegates[t]);return this}off(t,e,i){return void 0===i?super.off(t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&(s=>{const n=this._delegatedListeners[t];for(let t=0;tthis._updateStyle(t,e)));const i=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t?(this.style=new se(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t,e,i):this.style.loadJSON(t,e,i),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new se(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,i){if("string"==typeof e){const s=this._requestManager.transformRequest(e,g.Style);t.f(s,((e,s)=>{e?this.fire(new t.j(e)):s&&this._updateDiff(s,i)}))}else"object"==typeof e&&this._updateDiff(e,i)}_updateDiff(e,i){try{this.style.setState(e,i)&&this._update(!0)}catch(s){t.w(`Unable to perform style diff: ${s.message||s.error||s}. Rebuilding the style from scratch.`),this._updateStyle(e,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():t.w("There is no style added to the map.")}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(e){const i=this.style&&this.style.sourceCaches[e];if(void 0!==i)return i.loaded();this.fire(new t.j(new Error(`There is no source with ID '${e}'`)))}setTerrain(e){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),e){const i=this.style.sourceCaches[e.source];if(!i)throw new Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);for(const i in this.style._layers){const s=this.style._layers[i];"hillshade"===s.type&&s.source===e.source&&t.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new dn(this.painter,i,e),this.painter.renderToTexture=new In(this.painter,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=t=>{"style"===t.dataType?this.terrain.sourceCache.freeRtt():"source"===t.dataType&&t.tile&&(t.sourceId!==e.source||this._elevationFreeze||(this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(t.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0;return this.fire(new t.k("terrain",{terrain:e})),this}getTerrain(){var t,e;return null!==(e=null===(t=this.terrain)||void 0===t?void 0:t.options)&&void 0!==e?e:null}areTilesLoaded(){const t=this.style&&this.style.sourceCaches;for(const e in t){const i=t[e]._tiles;for(const t in i){const e=i[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}}return!0}addSourceType(t,e,i){return this._lazyInitEmptyStyle(),this.style.addSourceType(t,e,i)}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}addImage(e,i,s={}){const{pixelRatio:n=1,sdf:r=!1,stretchX:o,stretchY:a,content:l}=s;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||t.a(i))){if(void 0===i.width||void 0===i.height)return this.fire(new t.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:s,height:c,data:g}=i,h=i;return this.style.addImage(e,{data:new t.R({width:s,height:c},new Uint8Array(g)),pixelRatio:n,stretchX:o,stretchY:a,content:l,sdf:r,version:0,userImage:h}),h.onAdd&&h.onAdd(this,e),this}}{const{width:s,height:c,data:g}=t.h.getImageData(i);this.style.addImage(e,{data:new t.R({width:s,height:c},g),pixelRatio:n,stretchX:o,stretchY:a,content:l,sdf:r,version:0})}}updateImage(e,i){const s=this.style.getImage(e);if(!s)return this.fire(new t.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const n=i instanceof HTMLImageElement||t.a(i)?t.h.getImageData(i):i,{width:r,height:o,data:a}=n;if(void 0===r||void 0===o)return this.fire(new t.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(r!==s.data.width||o!==s.data.height)return this.fire(new t.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const l=!(i instanceof HTMLImageElement||t.a(i));return s.data.replace(a,l),this.style.updateImage(e,s),this}getImage(t){return this.style.getImage(t)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new t.j(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(t,e){c.getImage(this._requestManager.transformRequest(t,g.Image),e)}listImages(){return this.style.listImages()}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(t,e,i){return this.style.setLayerZoomRange(t,e,i),this._update(!0)}setFilter(t,e,i={}){return this.style.setFilter(t,e,i),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,i,s={}){return this.style.setPaintProperty(t,e,i,s),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,i,s={}){return this.style.setLayoutProperty(t,e,i,s),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setGlyphs(t,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,e,i,(t=>{t||this._update(!0)})),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,e,(t=>{t||this._update(!0)})),this}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]}_setupContainer(){const t=this._container;t.classList.add("maplibregl-map");const e=this._canvasContainer=i.create("div","maplibregl-canvas-container",t);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=i.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const s=this._containerDimensions(),n=this._getClampedPixelRatio(s[0],s[1]);this._resizeCanvas(s[0],s[1],n);const r=this._controlContainer=i.create("div","maplibregl-control-container",t),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((t=>{o[t]=i.create("div",`maplibregl-ctrl-${t} `,r)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=i.create("div","maplibregl-cooperative-gesture-screen",this._container);let t="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";0===navigator.platform.indexOf("Mac")&&(t="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=`\n
${t}
\n
${"boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}
\n `,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){i.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(t,e,i){this._canvas.width=Math.floor(i*t),this._canvas.height=Math.floor(i*e),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const t={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let e=null;this._canvas.addEventListener("webglcontextcreationerror",(i=>{e={requestedAttributes:t},i&&(e.statusMessage=i.statusMessage,e.type=i.type)}),{once:!0});const i=this._canvas.getContext("webgl2",t)||this._canvas.getContext("webgl",t);if(!i){const t="Failed to initialize WebGL";throw e?(e.message=t,new Error(JSON.stringify(e))):new Error(t)}this.painter=new is(i,this.transform),s.testSupport(i)}_onCooperativeGesture(t,e,i){return!e&&i<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout((()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")}),100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(e){const i=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let s=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const e=this.transform.zoom,n=t.h.now();this.style.zoomHistory.update(e,n);const r=new t.a8(e,{now:n,fadeDuration:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),o=r.crossFadingFactor();1===o&&o===this._crossFadingFactor||(s=!0,this._crossFadingFactor=o),this.style.update(r)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,i,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:i,showPadding:this.showPadding}),this.fire(new t.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,t.bg.mark(t.bh.load),this.fire(new t.k("load"))),this.style&&(this.style.hasTransitions()||s)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const n=this._sourcesDirty||this._styleDirty||this._placementDirty;return n||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.k("idle")),!this._loaded||this._fullyLoaded||n||(this._fullyLoaded=!0,t.bg.mark(t.bh.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var e;this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"undefined"!=typeof window&&removeEventListener("online",this._onWindowOnline,!1),c.removeThrottleControl(this._imageQueueHandle),null===(e=this._resizeObserver)||void 0===e||e.disconnect();const s=this.painter.context.gl.getExtension("WEBGL_lose_context");s&&s.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),i.remove(this._canvasContainer),i.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),t.bg.clearMetrics(),this._removed=!0,this.fire(new t.k("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=t.h.frame((e=>{t.bg.frame(e),this._frame=null,this._render(e)})))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return Cn}getCameraTargetElevation(){return this.transform.elevation}},Fn.NavigationControl=class{constructor(e){this._updateZoomButtons=()=>{const t=this._map.getZoom(),e=t===this._map.getMaxZoom(),i=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())},this._rotateCompassArrow=()=>{const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t},this._setButtonTitle=(t,e)=>{const i=this._map._getUIString(`NavigationControl.${e}`);t.title=i,t.setAttribute("aria-label",i)},this.options=t.e({},yn,e),this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),i.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(t=>this._map.zoomOut({},{originalEvent:t}))),i.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})),this._compassIcon=i.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new bn(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){i.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(t,e){const s=i.create("button",t,this._container);return s.type="button",s.addEventListener("click",e),s}},Fn.GeolocateControl=class extends t.E{constructor(e){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.k("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new t.k("geolocate",e)),this._finish()}},this._updateCamera=e=>{const i=new t.L(e.coords.longitude,e.coords.latitude),s=e.coords.accuracy,n=this._map.getBearing(),r=t.e({bearing:n},this.options.fitBoundsOptions),o=T.fromLngLat(i,s);this._map.fitBounds(o,r,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new t.L(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&Zn)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new t.k("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=e=>{if(this._map){if(this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this._geolocateButton=i.create("button","maplibregl-ctrl-geolocate",this._container),i.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===e){t.w("Geolocation support is not available so the GeolocateControl will be disabled.");const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=i.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Sn({element:this._dotElement}),this._circleElement=i.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Sn({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(e=>{e.geolocateSource||"ACTIVE_LOCK"!==this._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new t.k("trackuserlocationend")))}))}},this.options=t.e({},kn,e)}onAdd(t){return this._map=t,this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(t,e=!1){void 0===_n||e?void 0!==window.navigator.permissions?window.navigator.permissions.query({name:"geolocation"}).then((e=>{_n="denied"!==e.state,t(_n)})).catch((()=>{_n=!!window.navigator.geolocation,t(_n)})):(_n=!!window.navigator.geolocation,t(_n)):t(_n)}(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),i.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Bn=0,Zn=!1}_isOutOfMapMaxBounds(t){const e=this._map.getMaxBounds(),i=t.coords;return e&&(i.longitudee.getEast()||i.latitudee.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const t=this._map.getBounds(),e=t.getSouthEast(),i=t.getNorthEast(),s=e.distanceTo(i),n=Math.ceil(this._accuracy/(s/this._map._container.clientHeight)*2);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}px`}trigger(){if(!this._setup)return t.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Bn--,Zn=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new t.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.k("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let t;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Bn++,Bn>1?(t={maximumAge:6e5,timeout:0},Zn=!0):(t=this.options.positionOptions,Zn=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},Fn.AttributionControl=an,Fn.LogoControl=ln,Fn.ScaleControl=class{constructor(e){this._onMove=()=>{Rn(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,Rn(this._map,this._container,this.options)},this.options=t.e({},Gn,e)}getDefaultPosition(){return"bottom-left"}onAdd(t){return this._map=t,this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){i.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},Fn.FullscreenControl=class extends t.E{constructor(e={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,e&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:t.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=i.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){i.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const t=this._fullscreenButton=i.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);i.create("span","maplibregl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new t.k("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new t.k("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},Fn.TerrainControl=class{constructor(t){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},this.options=t}onAdd(t){return this._map=t,this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=i.create("button","maplibregl-ctrl-terrain",this._container),i.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){i.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},Fn.Popup=class extends t.E{constructor(e){super(),this.remove=()=>(this._content&&i.remove(this._content),this._container&&(i.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new t.k("close")),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=i.create("div","maplibregl-popup",this._map.getContainer()),this._tip=i.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const t of this.options.className.split(" "))this._container.classList.add(t);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=vn(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!t)return;const e=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);let s=this.options.anchor;const n=zn(this.options.offset);if(!s){const t=this._container.offsetWidth,i=this._container.offsetHeight;let r;r=e.y+n.bottom.ythis._map.transform.height-i?["bottom"]:[],e.xthis._map.transform.width-t/2&&r.push("right"),s=0===r.length?"bottom":r.join("-")}const r=e.add(n[s]).round();i.setTransform(this._container,`${xn[s]} translate(${r.x}px,${r.y}px)`),wn(this._container,s,"popup")},this._onClose=()=>{this.remove()},this.options=t.e(Object.create(Vn),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new t.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.L.convert(e),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){const e=document.createDocumentFragment(),i=document.createElement("body");let s;for(i.innerHTML=t;s=i.firstChild,s;)e.appendChild(s);return this.setDOMContent(e)}getMaxWidth(){var t;return null===(t=this._container)||void 0===t?void 0:t.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=i.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){this._container&&this._container.classList.add(t)}removeClassName(t){this._container&&this._container.classList.remove(t)}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}_createCloseButton(){this.options.closeButton&&(this._closeButton=i.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const t=this._container.querySelector(Wn);t&&t.focus()}},Fn.Marker=Sn,Fn.Style=se,Fn.LngLat=t.L,Fn.LngLatBounds=T,Fn.Point=t.P,Fn.MercatorCoordinate=t.U,Fn.Evented=t.E,Fn.AJAXError=t.bi,Fn.config=t.c,Fn.CanvasSource=P,Fn.GeoJSONSource=M,Fn.ImageSource=K,Fn.RasterDEMTileSource=J,Fn.RasterTileSource=z,Fn.VectorTileSource=W,Fn.VideoSource=L,Fn.setRTLTextPlugin=t.bj,Fn.getRTLTextPluginStatus=t.bk,Fn.prewarm=function(){st().acquire($)},Fn.clearPrewarmedResources=function(){const t=it;t&&(t.isPreloaded()&&1===t.numActive()?(t.release($),it=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},Jn.extend(Fn,{isSafari:t.ac,getPerformanceMetrics:t.bg.getPerformanceMetrics}),Fn}));var n=i;return n}();var n=s.exports,r=i(n);class o{layer;buttonControl;buttonElement;nav;constructor(t,e){const i=t.id;this.layer=t,this.buttonControl=e,t.depth=t.depth??0,this.buttonControl.buttons[i]=this,this.buttonElement=document.createElement("button"),this.nav=document.createElement("nav"),this.nav.appendChild(this.buttonElement),this.buttonElement.setAttribute("id",i),this.buttonElement.setAttribute("class","maplibregl-ctrl maplibregl-ctrl-group");const s=void 0!==t.name?t.name:i.replace("-"," ");this.buttonElement.appendChild(document.createTextNode(s)),this.buttonElement.onclick=t=>this.toggle()}toggle(){this.buttonElement.classList.contains("active")?this.deselect():this.select()}select(){this.deselectDirectory(),this.buttonControl.deselectGroup(this.layer.group),this.buttonElement.classList.add("active")}deselect(){this.buttonElement.classList.remove("active"),this.deselectDirectory()}deselectDirectory(){this.buttonControl.deselectDirectories()}}class a extends o{directoryNav;constructor(t,e){super(t,e);const i="buttonHolder"+(t.depth%2==0?"Even":"Odd");this.directoryNav=document.createElement("nav"),this.directoryNav.classList.add(i),this.nav.classList.add(i),this.nav.appendChild(this.directoryNav),(void 0===t.active||t.active)&&(this.directoryNav.style.display="none");t.source.forEach((e=>e.depth=t.depth+1)),this.buttonControl.addLayerButtons(t.source,this.directoryNav)}select(){super.select(),this.directoryNav.style.display="inherit"}deselect(){super.deselect(),this.directoryNav.style.display="none"}deselectDirectory(){this.buttonControl.deselectDirectories(this.layer.depth)}}class l extends o{constructor(t,e){super(t,e)}select(){super.select();const t=this.layer.id;if(null!=this.layer.beforeId&&null==this.buttonControl.map.getLayer(this.layer.beforeId)&&(this.layer.beforeId=void 0),null==this.buttonControl.map.getSource(t)&&this.buttonControl.map.addSource(t,this.layer.source),this.buttonControl.map.addLayer({id:t,type:this.layer.type,source:t,layout:this.layer.layout??{},paint:this.layer.paint??{},...this.getOptions(this.layer.type)},this.layer.beforeId),"symbol"===this.layer.type){const e=this.buttonControl.map;this.buttonControl.map.on("click",t,(t=>{const i=t.features;if(null==i||null==i[0]?.properties?.description)return;const s=i[0].geometry,r=i[0].properties.description;"Point"==s.type&&new n.Popup({maxWidth:"none"}).setLngLat(s.coordinates).setHTML(r).addTo(e)}))}}deselect(){super.deselect();const t=this.layer.id;null!=this.buttonControl.map.getLayer(t)&&this.buttonControl.map.removeLayer(t)}getOptions(t){return"symbol"==t?{layout:{"icon-image":["coalesce",["get","icon-image"],"marker_11"],"icon-size":["coalesce",["get","icon-size"],1],"text-field":"{title}","icon-allow-overlap":!0,"text-allow-overlap":!0,"text-anchor":"top","text-font":["Open Sans Regular"],"text-max-width":9,"icon-offset":[0,-3],"text-offset":[0,.75],"text-padding":2,"text-size":12},paint:{"text-color":"#666","text-halo-blur":.5,"text-halo-color":"white","text-halo-width":2}}:"line"==t?{layout:{"line-join":"round"},paint:{"line-color":"#00d","line-width":{base:1.2,stops:[[6,2],[20,20]]},"line-opacity":.4}}:"heatmap"==t?{maxzoom:16,minzoom:9,paint:{"heatmap-weight":["*",["coalesce",["get","count"],1],1e-5],"heatmap-intensity":{stops:[[9,.1],[16,3e3]]},"heatmap-radius":{type:"exponential",stops:[[9,1],[16,20]]},"heatmap-color":["interpolate",["linear"],["heatmap-density"],0,"rgba(0,0,0,0)",.1,"#103",.3,"#926",.4,"#f71",.5,"#ffa"],"heatmap-opacity":.8}}:void("raster"!=t&&console.error("unknown type: ",t))}}class c extends l{constructor(t,e){super(t,e)}select(){super.select(),document.getElementById("rainLegend").style.display="inline-block"}deselect(){document.getElementById("rainLegend").style.display="none",super.deselect()}}class g extends o{constructor(t,e){super(t,e)}select(){super.select(),super.deselect(),this.buttonControl.deselectAll()}}class h extends o{constructor(t,e){super(t,e)}select(){super.select(),super.deselect(),document.getElementById("about").style.display="inherit"}deselect(){super.deselect(),document.getElementById("about").style.display="none"}}class u extends o{originalProperties={};constructor(t,e){super(t,e);const i=this.buttonControl.map;Object.entries(this.layer.layerIds).forEach((([t,e])=>{const s=i.getLayer(t);void 0!==s?(this.originalProperties[t]=[],e.forEach((e=>{const n=e.propertyType,r=e.property;if(e.value,"layout"===n)this.originalProperties[t].push({propertyType:n,property:r,value:i.getLayoutProperty(t,r)});else if("paint"===n)this.originalProperties[t].push({propertyType:n,property:r,value:i.getPaintProperty(t,r)});else if("zoom"===n){const e=s.minzoom,i=s.maxzoom;this.originalProperties[t].push({propertyType:n,property:r,value:{minzoom:e,maxzoom:i}})}}))):console.error(`layer ${t} is not found in the map`)}))}select(){super.select(),this.apply(this.layer.layerIds)}deselect(){this.apply(this.originalProperties),super.deselect()}apply(t){const e=this.buttonControl.map;Object.entries(t).forEach((([t,i])=>{i.forEach((i=>{const s=i.propertyType,n=i.property,r=i.value;"layout"===s?e.setLayoutProperty(t,n,r):"paint"===s?e.setPaintProperty(t,n,r):"zoom"===s&&e.setLayerZoomRange(t,r.minzoom,r.maxzoom)}))}))}}class d extends o{constructor(t,e){super(t,e)}select(){super.select(),super.deselect();let t=this.layer.url;void 0!==t?window.open(d.formatUrl(this.buttonControl.map,t)):console.error("url not defined")}static formatUrl(t,e){return e.replace("{z1}",(t.getZoom()+1).toFixed(0)).replace("{z}",t.getZoom().toFixed(0)).replace("{latitude}",t.getCenter().lat.toFixed(5)).replace("{longitude}",t.getCenter().lng.toFixed(5))}}class p{mainControl;map;container;buttons={};savePointUrl;constructor(t){this.mainControl=t}onAdd(t){return this.map=t,this.map.on("click",(t=>this.deselectDirectories())),this.container=document.createElement("div"),this.container.className="maplibregl-ctrl",this.checkAddButtons(),this.setupButtons(),this.container}onRemove(t){this.container.parentNode.removeChild(this.container),this.map=void 0}checkAddGeoJsonLayer(){const t=this.mainControl.query.get("geo"),e=this.mainControl.query.get("type")??"line";null!==t&&this.addLayerHelper("geoJsonData",e,t)}checkAddButtons(){const t=this.mainControl.getButtonsQuery();null!==t&&e(t,(t=>{this.savePointUrl=t.savePointUrl,this.map.on("style.load",(e=>{this.addLayerButtons(t.buttons)})),this.map.on("load",(e=>{this.addLayerButtons(t.buttons),this.setupIcons(),this.checkAddGeoJsonLayer()}))}))}setupButtons(){document.getElementsByClassName("maplibregl-ctrl-top-left")[0].append(document.getElementById("buttonHolder"))}addLayerButtons(t,e=null){for(const i of t)this.addLayerButton(i,e)}removeLayerButtons(t){for(const e of t)e.id in this.buttons&&this.removeLayerButton(this.buttons[e.id])}addLayerHelper(t,e,i){this.addLayerButton({id:t,type:e,class:"layer",source:{type:"geojson",data:i},active:!0})}generatorMap={directory:t=>new a(t,this),rain:t=>new c(t,this),layer:t=>new l(t,this),reset:t=>new g(t,this),about:t=>new h(t,this),layerIds:t=>new u(t,this),externalLink:t=>new d(t,this)};generateButton(t){return void 0===t.class&&(t.class="externalLink"),t.class in this.generatorMap||console.error(`could not find class ${t.class} in generator map`),this.generatorMap[t.class](t)}addLayerButton(t,e=null){if(null!=document.getElementById(t.id))return;const i=this.generateButton(t);(null!=e?e:document.getElementById("buttonHolder")).appendChild(i.nav),t.active&&i.select()}removeLayerButton(t){t.deselect();const e=t.layer.id;null!=this.map.getSource(e)&&this.map.removeSource(e),t.buttonElement.remove()}removeLayerButtonById(t){const e=this.buttons[t];void 0!==e&&this.removeLayerButton(e)}removeLayerById(t){const e=this.buttons[t];void 0!==e&&e.deselect()}deselectAll(){Object.values(this.buttons).filter((t=>t.buttonElement.classList.contains("active"))).forEach((t=>t.deselect()))}deselectGroup(t){void 0!==t&&Object.values(this.buttons).filter((e=>e.layer.group===t&&e.buttonElement.classList.contains("active"))).forEach((t=>t.deselect()))}deselectDirectories(t=void 0){Object.values(this.buttons).filter((e=>e instanceof a&&(void 0===t||e.layer.depth===t)&&!e.layer.active&&e.buttonElement.classList.contains("active"))).forEach((t=>t.deselect()))}setupIcons(){this.map.loadImage("sprite/2197.png",((t,e)=>{if(t)throw t;null!=e?this.map.addImage("upright",e):console.error("trouble loading image")})),this.map.loadImage("sprite/2198.png",((t,e)=>{if(t)throw t;null!=e?this.map.addImage("downright",e):console.error("trouble loading image")})),this.map.loadImage("sprite/27a1.png",((t,e)=>{if(t)throw t;null!=e?this.map.addImage("right",e):console.error("trouble loading image")}))}}class m{buttonControl;map;dummyContainer;constructor(t){this.buttonControl=t}onAdd(t){return this.map=t,this.dummyContainer=document.createElement("div"),this.addSavePointListener(),this.dummyContainer}onRemove(t){this.dummyContainer.parentNode.removeChild(this.dummyContainer),this.map=void 0}addSavePointListener(){this.map.on("click",(t=>{(t.originalEvent.ctrlKey||t.originalEvent.metaKey)&&this.fireSavePoint(t)}))}fireSavePoint(i){if(void 0===this.buttonControl.savePointUrl)return;let s=prompt("please enter a category","edited");if(null==s)return;let n=prompt("please enter a title","");if(null==n)return;let r=new URLSearchParams;r.set("point",t(i.lngLat,4)),r.set("category",s),r.set("title",n),e(`${this.buttonControl.savePointUrl}?${r}`,(t=>{alert(t?.msg??"failure")}))}}var I=Object.defineProperty,C=(t,e,i)=>(((t,e,i)=>{e in t?I(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i})(t,"symbol"!=typeof e?e+"":e,i),i);class f{constructor(t){C(this,"map"),C(this,"listeners",{}),C(this,"oneTimeListeners",{}),this.map=t}fire(t){var e,i;t.target=this.map;const s=t.type;null==(e=this.listeners[s])||e.forEach((e=>e(t))),null==(i=this.oneTimeListeners[s])||i.forEach((e=>{var i,n;e(t);const r=null==(i=this.oneTimeListeners[s])?void 0:i.indexOf(e);void 0!==r&&~r&&(null==(n=this.oneTimeListeners[s])||n.splice(r,1))}))}on(t,e){this.listeners[t]=this.listeners[t]??[],this.listeners[t].push(e)}off(t,e){var i,s;const n=null==(i=this.listeners[t])?void 0:i.indexOf(e);void 0!==n&&~n&&(null==(s=this.listeners[t])||s.splice(n,1))}once(t,e){this.oneTimeListeners[t]=this.oneTimeListeners[t]??[],this.oneTimeListeners[t].push(e)}}class A{constructor(t,e,i){C(this,"type"),C(this,"target"),C(this,"originalEvent"),C(this,"data"),this.type=t,this.originalEvent=e,this.data=i}}class y{constructor(t,e,i){C(this,"type"),C(this,"target"),C(this,"originalEvent"),C(this,"data"),this.type=t,this.originalEvent=e,this.data=i}}const b={api:"https://router.project-osrm.org/route/v1",profile:"driving",requestOptions:{},requestTimeout:null,makePostRequest:!1,sourceName:"maplibre-gl-directions",pointsScalingFactor:1,linesScalingFactor:1,sensitiveWaypointLayers:["maplibre-gl-directions-waypoint","maplibre-gl-directions-waypoint-casing"],sensitiveSnappointLayers:["maplibre-gl-directions-snappoint","maplibre-gl-directions-snappoint-casing"],sensitiveRoutelineLayers:["maplibre-gl-directions-routeline","maplibre-gl-directions-routeline-casing"],sensitiveAltRoutelineLayers:["maplibre-gl-directions-alt-routeline","maplibre-gl-directions-alt-routeline-casing"],dragThreshold:10,refreshOnMove:!1,bearings:!1},_={snapline:"#34343f",altRouteline:"#9e91be",routelineFoot:"#3665ff",routelineBike:"#63c4ff",routeline:"#7b51f8",congestionLow:"#42c74c",congestionHigh:"#d72359",hoverpoint:"#30a856",snappoint:"#cb3373",snappointHighlight:"#e50d3f",waypointFoot:"#3665ff",waypointFootHighlight:"#0942ff",waypointBike:"#63c4ff",waypointBikeHighlight:"#0bb8ff",waypoint:"#7b51f8",waypointHighlight:"#6d26d7"},v=["case",["==",["get","profile",["get","arriveSnappointProperties"]],"foot"],_.routelineFoot,["==",["get","profile",["get","arriveSnappointProperties"]],"bike"],_.routelineBike,["interpolate-hcl",["linear"],["get","congestion"],0,_.routeline,1,_.congestionLow,100,_.congestionHigh]],x=["case",["==",["get","profile"],"foot"],["case",["boolean",["get","highlight"],!1],_.waypointFootHighlight,_.waypointFoot],["==",["get","profile"],"bike"],["case",["boolean",["get","highlight"],!1],_.waypointBikeHighlight,_.waypointBike],["case",["boolean",["get","highlight"],!1],_.waypointHighlight,_.waypoint]],w=["case",["boolean",["get","highlight"],!1],_.snappointHighlight,_.snappoint];let S=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce(((t,e)=>t+=(e&=63)<36?e.toString(36):e<62?(e-26).toString(36).toUpperCase():e>62?"-":"_"),"");function k(t){return 1&t?~(t>>1):t>>1}function B(t,e=5){const i=Math.pow(10,e);let s=0,n=0,r=0;const o=[];let a,l,c=0,g=0,h=null;for(;s=32);a=k(g),c=g=0;do{h=t.charCodeAt(s++)-63,g|=(31&h)<=32);l=k(g),n+=a,r+=l,o.push([r/i,n/i])}return o}function Z(t){return t.map((t=>[t.geometry.coordinates[0],t.geometry.coordinates[1]]))}function G(t){return t.map((t=>{var e,i,s;return Array.isArray(null==(e=t.properties)?void 0:e.bearing)?[null==(i=t.properties)?void 0:i.bearing[0],null==(s=t.properties)?void 0:s.bearing[1]]:void 0}))}function R(t){const e=function(t=1,e=1,i="maplibre-gl-directions"){const s=["interpolate",["exponential",1.5],["zoom"],0,["case",["boolean",["get","highlight"],["==",["get","type"],"HOVERPOINT"]],14*t,12*t],5,["case",["boolean",["get","highlight"],["==",["get","type"],"HOVERPOINT"]],14*t,12*t],18,["case",["boolean",["get","highlight"],["==",["get","type"],"HOVERPOINT"]],33*t,28*t]],n=["interpolate",["exponential",1.5],["zoom"],0,["case",["boolean",["get","highlight"],["==",["get","type"],"HOVERPOINT"]],9*t,7*t],5,["case",["boolean",["get","highlight"],["==",["get","type"],"HOVERPOINT"]],9*t,7*t],18,["case",["boolean",["get","highlight"],["==",["get","type"],"HOVERPOINT"]],21*t,16*t]],r=["interpolate",["exponential",1.5],["zoom"],0,3*e,5,3*e,18,10*e],o=["interpolate",["exponential",1.5],["zoom"],0,["case",["boolean",["get","highlight"],!1],10*e,7*e],5,["case",["boolean",["get","highlight"],!1],10*e,7*e],18,["case",["boolean",["get","highlight"],!1],32*e,23*e]];return[{id:`${i}-snapline`,type:"line",source:i,layout:{"line-cap":"round","line-join":"round"},paint:{"line-dasharray":[3,3],"line-color":_.snapline,"line-opacity":.65,"line-width":3},filter:["==",["get","type"],"SNAPLINE"]},{id:`${i}-alt-routeline-casing`,type:"line",source:i,layout:{"line-cap":"butt","line-join":"round"},paint:{"line-color":_.altRouteline,"line-opacity":.55,"line-width":o},filter:["==",["get","route"],"ALT"]},{id:`${i}-alt-routeline`,type:"line",source:i,layout:{"line-cap":"butt","line-join":"round"},paint:{"line-color":_.altRouteline,"line-opacity":.85,"line-width":r},filter:["==",["get","route"],"ALT"]},{id:`${i}-routeline-casing`,type:"line",source:i,layout:{"line-cap":"butt","line-join":"round"},paint:{"line-color":v,"line-opacity":.55,"line-width":o},filter:["==",["get","route"],"SELECTED"]},{id:`${i}-routeline`,type:"line",source:i,layout:{"line-cap":"butt","line-join":"round"},paint:{"line-color":v,"line-opacity":.85,"line-width":r},filter:["==",["get","route"],"SELECTED"]},{id:`${i}-hoverpoint-casing`,type:"circle",source:i,paint:{"circle-radius":s,"circle-color":_.hoverpoint,"circle-opacity":.65},filter:["==",["get","type"],"HOVERPOINT"]},{id:`${i}-hoverpoint`,type:"circle",source:i,paint:{"circle-radius":n,"circle-color":_.hoverpoint},filter:["==",["get","type"],"HOVERPOINT"]},{id:`${i}-snappoint-casing`,type:"circle",source:i,paint:{"circle-radius":s,"circle-color":w,"circle-opacity":.65},filter:["==",["get","type"],"SNAPPOINT"]},{id:`${i}-snappoint`,type:"circle",source:i,paint:{"circle-radius":n,"circle-color":w},filter:["==",["get","type"],"SNAPPOINT"]},{id:`${i}-waypoint-casing`,type:"circle",source:i,paint:{"circle-radius":s,"circle-color":x,"circle-opacity":.65},filter:["==",["get","type"],"WAYPOINT"]},{id:`${i}-waypoint`,type:"circle",source:i,paint:{"circle-radius":n,"circle-color":x},filter:["==",["get","type"],"WAYPOINT"]}]}(null==t?void 0:t.pointsScalingFactor,null==t?void 0:t.linesScalingFactor,null==t?void 0:t.sourceName);return Object.assign({},b,{layers:e},t)}function T(t,e,i){const s=t.makePostRequest?"post":"get";let n,r;if("get"===s)n=`${t.api}/${t.profile}/${e.join(";")}`,r=new URLSearchParams(t.requestOptions);else{n=`${t.api}/${t.profile}${t.requestOptions.access_token?`?access_token=${t.requestOptions.access_token}`:""}`;const i=new FormData;Object.entries(t.requestOptions).forEach((([t,e])=>{"access_token"!==t&&i.set(t,e)})),i.set("coordinates",e.join(";")),r=new URLSearchParams(i)}return t.bearings&&i&&r.set("bearings",i.map((t=>t?`${t[0]},${t[1]}`:"")).join(";")),{method:s,url:n,payload:r}}function V(t,e,i){return{type:"Feature",geometry:{type:"Point",coordinates:t},properties:{type:e,id:S(),...i??{}}}}function W(t,e,i,s,n=!1){if(t.length!==e.length)return[];const r=t.map(((t,i)=>({type:"Feature",geometry:{type:"LineString",coordinates:[[t[0],t[1]],[e[i][0],e[i][1]]]},properties:{type:"SNAPLINE"}})));return~s&&void 0!==i&&n&&(r.push({type:"Feature",geometry:{type:"LineString",coordinates:[[i[0],i[1]],[e[s][0],e[s][1]]]},properties:{type:"SNAPLINE"}}),r.push({type:"Feature",geometry:{type:"LineString",coordinates:[[i[0],i[1]],[e[s+1][0],e[s+1][1]]]},properties:{type:"SNAPLINE"}})),r}function z(t,e,i,s){return e.map(((e,n)=>{const r=function(t,e){return"geojson"===t.geometries?e.coordinates:"polyline6"===t.geometries?B(e,6):B(e,5)}(t,e.geometry),o=s.map((t=>t.geometry.coordinates));let a=0;const l=o.map(((e,i)=>{const s=r.slice(a).findIndex((i=>function(t,e,i){return t.geometries&&"polyline"!==t.geometries?e[0]===i[0]&&e[1]===i[1]:Math.abs(e[0]-i[0])<=1e-5&&Math.abs(e[1]-i[1])<=1e-5}(t,i,e))),n=i===o.length-1;if(-1!==s)a+=s;else if(n)return r.length-1;return a})).slice(1);let c=0;const g=l.map((t=>r.slice(c,c=t+1))),h=[];return g.forEach(((r,o)=>{const a=S();r.forEach(((r,l)=>{var c,g,u;const d=h[h.length-1],p=function(t,e,i){var s,n,r,o;if(null!=(s=t.annotations)&&s.includes("congestion_numeric"))return(null==(n=null==e?void 0:e.congestion_numeric)?void 0:n[i])??0;if(null==(r=t.annotations)||!r.includes("congestion"))return 0;switch((null==(o=null==e?void 0:e.congestion)?void 0:o[i])??""){case"unknown":default:return 0;case"low":return 1;case"moderate":return 34;case"heavy":return 77;case"severe":return 100}}(t,null==(c=e.legs[o])?void 0:c.annotation,l);if(o===(null==(g=null==d?void 0:d.properties)?void 0:g.legIndex)&&(null==(u=d.properties)?void 0:u.congestion)===p)d.geometry.coordinates.push(r);else{const t=s[o].properties??{},e=s[o+1].properties??{},l={type:"Feature",geometry:{type:"LineString",coordinates:[]},properties:{id:a,routeIndex:n,route:n===i?"SELECTED":"ALT",legIndex:o,congestion:p,departSnappointProperties:t,arriveSnappointProperties:e}};d&&l.geometry.coordinates.push(d.geometry.coordinates[d.geometry.coordinates.length-1]),l.geometry.coordinates.push(r),h.push(l)}}))})),h}))}class J extends f{constructor(t,e){super(t),C(this,"configuration"),C(this,"_interactive",!1),C(this,"_hoverable",!1),C(this,"buildRequest",T),C(this,"buildPoint",V),C(this,"buildSnaplines",W),C(this,"buildRoutelines",z),C(this,"onMoveHandler"),C(this,"onDragDownHandler"),C(this,"onDragMoveHandler"),C(this,"onDragUpHandler"),C(this,"onClickHandler"),C(this,"liveRefreshHandler"),C(this,"profiles",[]),C(this,"_waypoints",[]),C(this,"snappoints",[]),C(this,"routelines",[]),C(this,"selectedRouteIndex",0),C(this,"hoverpoint"),C(this,"highlightedWaypoints",[]),C(this,"highlightedSnappoints",[]),C(this,"dragDownPosition",{x:0,y:0}),C(this,"waypointBeingDragged"),C(this,"waypointBeingDraggedInitialCoordinates"),C(this,"departSnappointIndex",-1),C(this,"currentMousePosition",{x:0,y:0}),C(this,"refreshOnMoveIsRefreshing",!1),C(this,"noMouseMovementTimer"),C(this,"lastRequestMousePosition",{x:0,y:0}),C(this,"allowRouteSwitch",!1),C(this,"abortController"),this.map=t,this.configuration=R(e),this.onMoveHandler=this.onMove.bind(this),this.onDragDownHandler=this.onDragDown.bind(this),this.onDragMoveHandler=this.onDragMove.bind(this),this.onDragUpHandler=this.onDragUp.bind(this),this.onClickHandler=this.onClick.bind(this),this.liveRefreshHandler=this.liveRefresh.bind(this),this.init()}get waypointsCoordinates(){return Z(this._waypoints)}get snappointsCoordinates(){return this.snappoints.map((t=>[t.geometry.coordinates[0],t.geometry.coordinates[1]]))}get snaplines(){var t,e,i;return this.buildSnaplines(this.waypointsCoordinates,this.snappointsCoordinates,null==(t=this.hoverpoint)?void 0:t.geometry.coordinates,this.departSnappointIndex,null==(i=null==(e=this.hoverpoint)?void 0:e.properties)?void 0:i.showSnaplines)}init(){this.map.addSource(this.configuration.sourceName,{type:"geojson",data:{type:"FeatureCollection",features:[]}}),this.configuration.layers.forEach((t=>{this.map.addLayer(t)}))}async fetch({method:t,url:e,payload:i}){var s,n;const r=await("get"===t?await fetch(`${e}?${i}`,{signal:null==(s=this.abortController)?void 0:s.signal}):await fetch(`${e}`,{signal:null==(n=this.abortController)?void 0:n.signal,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:i})).json();if("Ok"!==r.code)throw new Error(r.message??"An unexpected error occurred.");return r}async fetchDirections(t){var e,i;null==(e=this.abortController)||e.abort();const s=this.interactive;if(this._waypoints.length>=2){this.fire(new y("fetchroutesstart",t)),this.abortController=new AbortController;let e;this.abortController.signal.onabort=()=>{this.interactive=s},this.interactive=!1,null!==this.configuration.requestTimeout&&(e=setTimeout((()=>{var t;return null==(t=this.abortController)?void 0:t.abort()}),this.configuration.requestTimeout)),this.profiles.length||(this.profiles=[this.configuration.profile]);const n=[],r=[];this.profiles.reduce(((t,e,i)=>{const s=i===this.profiles.length-1,o=e===(i>0?this.profiles[i-1]:void 0),a=s?this._waypoints.length:o?t+1:t+2;return o?r[r.length-1].push(...this._waypoints.slice(t,a)):(r.push(this._waypoints.slice(t,a)),n.push(e)),a}),0);const o=n.map(((t,e)=>this.buildRequest({...this.configuration,profile:t},Z(r[e]),this.configuration.bearings?G(r[e]):void 0)));let a;try{a=await Promise.all(o.map((async e=>{let i;try{i=await this.fetch(e)}finally{this.fire(new y("fetchroutesend",t,i))}return i})))}finally{"DESTROY"!==(null==(i=this.abortController)?void 0:i.signal.reason)&&(this.interactive=s),this.abortController=void 0,clearTimeout(e)}const l=a.flatMap(((t,e)=>{const i=n[e],s=t.waypoints.map(((t,s)=>this.buildPoint(t.location,"SNAPPOINT",{profile:i,waypointProperties:r[e][s].properties??{}})));return{snappoints:s,routelines:this.buildRoutelines(this.configuration.requestOptions,t.routes,this.selectedRouteIndex,s)}})),c=a.flatMap((t=>t.routes));this.snappoints=l.flatMap((t=>t.snappoints)),this.routelines=l.flatMap((t=>t.routelines)),c.length<=this.selectedRouteIndex&&(this.selectedRouteIndex=0)}else this.snappoints=[],this.routelines=[];this.draw(!1)}draw(t=!0){const e=[...this._waypoints,...this.snappoints,...this.snaplines,...this.routelines.reduce(((e,i)=>t?e.concat(...i):e.concat(...i.map((t=>(t.properties&&(t.properties.route=t.properties.routeIndex===this.selectedRouteIndex?"SELECTED":"ALT"),t))))),[])];this.hoverpoint&&e.push(this.hoverpoint);const i={type:"FeatureCollection",features:e};this.map.getSource(this.configuration.sourceName)&&this.map.getSource(this.configuration.sourceName).setData(i)}deHighlight(){this.highlightedWaypoints.forEach((t=>{null!=t&&t.properties&&(t.properties.highlight=!1)})),this.highlightedSnappoints.forEach((t=>{null!=t&&t.properties&&(t.properties.highlight=!1)})),this.routelines.forEach((t=>{t.forEach((t=>{t.properties&&(t.properties.highlight=!1)}))}))}onMove(t){var e,i,s,n;const r=this.map.queryRenderedFeatures(t.point,{layers:[...this.configuration.sensitiveWaypointLayers,...this.configuration.sensitiveSnappointLayers,...this.configuration.sensitiveRoutelineLayers,...this.configuration.sensitiveAltRoutelineLayers]})[0];if(this.deHighlight(),this.configuration.sensitiveWaypointLayers.includes((null==r?void 0:r.layer.id)??"")){this.map.getCanvas().style.cursor="pointer",this.interactive&&this.map.dragPan.disable();const t=this._waypoints.find((t=>{var e,i;return(null==(e=t.properties)?void 0:e.id)===(null==(i=null==r?void 0:r.properties)?void 0:i.id)})),s=t&&this.snappoints.find((e=>{var i,s,n;return(null==(s=null==(i=e.properties)?void 0:i.waypointProperties)?void 0:s.id)===(null==(n=t.properties)?void 0:n.id)}));t&&(this.highlightedWaypoints=[t]),s&&(this.highlightedSnappoints=[s]),null!=(e=this.highlightedWaypoints[0])&&e.properties&&(this.highlightedWaypoints[0].properties.highlight=!0),null!=(i=this.highlightedSnappoints[0])&&i.properties&&(this.highlightedSnappoints[0].properties.highlight=!0),this.hoverpoint&&(this.hoverpoint=void 0)}else if(this.configuration.sensitiveSnappointLayers.includes((null==r?void 0:r.layer.id)??"")){this.map.getCanvas().style.cursor="pointer";const t=this.snappoints.findIndex((t=>{var e,i;return(null==(e=t.properties)?void 0:e.id)===(null==(i=null==r?void 0:r.properties)?void 0:i.id)}));this.highlightedSnappoints=[this.snappoints[t]],this.highlightedWaypoints=[this._waypoints[t]],this.highlightedSnappoints[0].properties&&(this.highlightedSnappoints[0].properties.highlight=!0),this.highlightedWaypoints[0].properties&&(this.highlightedWaypoints[0].properties.highlight=!0),this.hoverpoint&&(this.hoverpoint=void 0)}else this.configuration.sensitiveRoutelineLayers.includes((null==r?void 0:r.layer.id)??"")?(this.map.getCanvas().style.cursor="pointer",this.interactive&&(this.map.dragPan.disable(),this.hoverpoint?this.hoverpoint.geometry.coordinates=[t.lngLat.lng,t.lngLat.lat]:this.hoverpoint=this.buildPoint([t.lngLat.lng,t.lngLat.lat],"HOVERPOINT",{departSnappointProperties:{...JSON.parse((null==(s=null==r?void 0:r.properties)?void 0:s.departSnappointProperties)??"{}")},arriveSnappointProperties:{...JSON.parse((null==(n=null==r?void 0:r.properties)?void 0:n.arriveSnappointProperties)??"{}")}})),this.routelines.forEach((t=>{t.forEach((t=>{var e,i;t.properties&&(null==(e=t.properties)?void 0:e.id)===(null==(i=null==r?void 0:r.properties)?void 0:i.id)&&(t.properties.highlight=!0)}))}))):this.configuration.sensitiveAltRoutelineLayers.includes((null==r?void 0:r.layer.id)??"")?(this.map.getCanvas().style.cursor="pointer",this.routelines.forEach((t=>{t.forEach((t=>{var e,i;t.properties&&(null==(e=t.properties)?void 0:e.id)===(null==(i=null==r?void 0:r.properties)?void 0:i.id)&&(t.properties.highlight=!0)}))})),this.hoverpoint&&(this.hoverpoint=void 0)):(this.map.dragPan.enable(),this.map.getCanvas().style.cursor="",this.hoverpoint=void 0);this.draw()}onDragDown(t){var e,i,s,n,r,o;if("touchstart"===t.type&&1!==t.originalEvent.touches.length||"mousedown"===t.type&&1!==t.originalEvent.which)return;const a=this.map.queryRenderedFeatures(t.point);if(a.length&&a[0].source===this.configuration.sourceName){const l=a.filter((t=>this.configuration.sensitiveWaypointLayers.includes((null==t?void 0:t.layer.id)??"")||this.configuration.sensitiveSnappointLayers.includes((null==t?void 0:t.layer.id)??"")||this.configuration.sensitiveRoutelineLayers.includes((null==t?void 0:t.layer.id)??"")))[0];if(this.dragDownPosition=t.point,this.currentMousePosition=t.point,this.configuration.sensitiveWaypointLayers.includes((null==l?void 0:l.layer.id)??""))this.waypointBeingDragged=this._waypoints.find((t=>{var e,i;return(null==(e=t.properties)?void 0:e.id)===(null==(i=null==l?void 0:l.properties)?void 0:i.id)})),this.waypointBeingDraggedInitialCoordinates=null==(e=this.waypointBeingDragged)?void 0:e.geometry.coordinates;else if(this.configuration.sensitiveRoutelineLayers.includes((null==l?void 0:l.layer.id)??"")){if(this.departSnappointIndex=JSON.parse(null==(i=null==l?void 0:l.properties)?void 0:i.legIndex),this.hoverpoint)if(this.configuration.refreshOnMove){const e=void 0!==this.departSnappointIndex?this.departSnappointIndex+1:void 0;this._addWaypoint([t.lngLat.lng,t.lngLat.lat],e,t),this.waypointBeingDragged=e?this._waypoints[e]:void 0,this.hoverpoint=void 0}else this.hoverpoint.geometry.coordinates=[t.lngLat.lng,t.lngLat.lat];else this.hoverpoint=this.buildPoint([t.lngLat.lng,t.lngLat.lat],"HOVERPOINT",{departSnappointProperties:{...JSON.parse((null==(s=null==l?void 0:l.properties)?void 0:s.departSnappointProperties)??"{}")},arriveSnappointProperties:{...JSON.parse((null==(n=null==l?void 0:l.properties)?void 0:n.arriveSnappointProperties)??"{}")}});null!=(r=this.hoverpoint)&&r.properties&&(this.hoverpoint.properties.showSnaplines=!0),~this.departSnappointIndex&&null!=(o=this.snappoints[this.departSnappointIndex])&&o.properties&&(this.snappoints[this.departSnappointIndex].properties.highlight=!0,this.highlightedSnappoints.push(this.snappoints[this.departSnappointIndex]),this.snappoints[this.departSnappointIndex+1].properties.highlight=!0,this.highlightedSnappoints.push(this.snappoints[this.departSnappointIndex+1]))}this.map.off("touchstart",this.onMoveHandler),this.map.off("mousemove",this.onMoveHandler),"touchstart"===t.type?(this.map.on("touchmove",this.onDragMoveHandler),this.map.on("touchend",this.onDragUpHandler)):"mousedown"===t.type&&(this.map.on("mousemove",this.onDragMoveHandler),this.map.on("mouseup",this.onDragUpHandler)),this.draw()}}onDragMove(t){if(this.configuration.refreshOnMove&&(clearTimeout(this.noMouseMovementTimer),this.noMouseMovementTimer=setTimeout(this.liveRefreshHandler,300,t)),"touchmove"===t.type&&1!==t.originalEvent.touches.length)return t.originalEvent.preventDefault();"mousemove"===t.type&&1!==t.originalEvent.which||(this.waypointBeingDragged?this.waypointBeingDragged.geometry.coordinates=[t.lngLat.lng,t.lngLat.lat]:this.hoverpoint&&(this.hoverpoint.geometry.coordinates=[t.lngLat.lng,t.lngLat.lat]),this.currentMousePosition=t.point,this.draw(),this.configuration.refreshOnMove&&!this.refreshOnMoveIsRefreshing&&this.liveRefreshHandler(t))}async onDragUp(t){var e,i,s;if(this.configuration.refreshOnMove&&clearTimeout(this.noMouseMovementTimer),"mouseup"!==t.type||1===t.originalEvent.which){if(null!=(e=this.hoverpoint)&&e.properties&&(this.hoverpoint.properties.showSnaplines=!1),Math.abs(t.point.x-(null==(i=this.dragDownPosition)?void 0:i.x))>(this.configuration.dragThreshold>=0?this.configuration.dragThreshold:0)||Math.abs(t.point.y-(null==(s=this.dragDownPosition)?void 0:s.y))>(this.configuration.dragThreshold>=0?this.configuration.dragThreshold:0))if(this.waypointBeingDragged){this.waypointBeingDragged.geometry.coordinates=[t.lngLat.lng,t.lngLat.lat];const e=new A("movewaypoint",t,{index:this._waypoints.indexOf(this.waypointBeingDragged),initialCoordinates:this.waypointBeingDraggedInitialCoordinates});this.fire(e);try{await this.fetchDirections(e)}catch(t){t instanceof DOMException&&"AbortError"==t.name||this.waypointBeingDraggedInitialCoordinates&&(this.waypointBeingDragged.geometry.coordinates=this.waypointBeingDraggedInitialCoordinates)}this.waypointBeingDragged=void 0,this.waypointBeingDraggedInitialCoordinates=void 0}else this.hoverpoint&&(this._addWaypoint([t.lngLat.lng,t.lngLat.lat],void 0!==this.departSnappointIndex?this.departSnappointIndex+1:void 0,t),this.hoverpoint=void 0);else this.waypointBeingDragged&&this.waypointBeingDraggedInitialCoordinates?(this.waypointBeingDragged.geometry.coordinates=this.waypointBeingDraggedInitialCoordinates,this.waypointBeingDragged=void 0,this.waypointBeingDraggedInitialCoordinates=void 0):this.hoverpoint&&(this.hoverpoint=void 0);this.deHighlight(),"touchend"===t.type?(this.map.off("touchmove",this.onDragMoveHandler),this.map.off("touchend",this.onDragUpHandler)):"mouseup"===t.type&&(this.map.off("mousemove",this.onDragMoveHandler),this.map.off("mouseup",this.onDragUpHandler)),this.map.on("touchstart",this.onMoveHandler),this.map.on("mousemove",this.onMoveHandler),this.map.dragPan.enable(),this.draw()}}async liveRefresh(t){var e,i,s,n;if(Math.abs((null==(e=this.lastRequestMousePosition)?void 0:e.x)-(null==(i=this.currentMousePosition)?void 0:i.x))>(this.configuration.dragThreshold>=0?this.configuration.dragThreshold:0)||Math.abs((null==(s=this.lastRequestMousePosition)?void 0:s.y)-(null==(n=this.currentMousePosition)?void 0:n.y))>(this.configuration.dragThreshold>=0?this.configuration.dragThreshold:0)){if(this.refreshOnMoveIsRefreshing=!0,this.lastRequestMousePosition=this.currentMousePosition,this.waypointBeingDragged){const e=new A("movewaypoint",t,{index:this._waypoints.indexOf(this.waypointBeingDragged),initialCoordinates:this.waypointBeingDraggedInitialCoordinates});this.fire(e);try{await this.fetchDirections(e)}catch{}}this.refreshOnMoveIsRefreshing=!1}}onClick(t){const e=this.map.queryRenderedFeatures(t.point,{layers:[...this.configuration.sensitiveWaypointLayers,...this.configuration.sensitiveSnappointLayers,...this.configuration.sensitiveAltRoutelineLayers,...this.configuration.sensitiveRoutelineLayers]})[0];if(this._interactive&&this.configuration.sensitiveWaypointLayers.includes((null==e?void 0:e.layer.id)??"")){const i=this._waypoints.findIndex((t=>{var i,s;return(null==(i=t.properties)?void 0:i.id)===(null==(s=null==e?void 0:e.properties)?void 0:s.id)}));~i&&this._removeWaypoint(i,t)}else if(this._interactive&&this.configuration.sensitiveSnappointLayers.includes((null==e?void 0:e.layer.id)??"")){const i=this.snappoints.findIndex((t=>{var i,s;return(null==(i=t.properties)?void 0:i.id)===(null==(s=null==e?void 0:e.properties)?void 0:s.id)}));~i&&this._removeWaypoint(i,t)}else(this.interactive||this.allowRouteSwitch)&&this.configuration.sensitiveAltRoutelineLayers.includes((null==e?void 0:e.layer.id)??"")?this.selectedRouteIndex=this.routelines.findIndex((t=>!!t.find((t=>{var i,s;return(null==(i=t.properties)?void 0:i.id)===(null==(s=null==e?void 0:e.properties)?void 0:s.id)})))):this._interactive&&!this.configuration.sensitiveRoutelineLayers.includes((null==e?void 0:e.layer.id)??"")&&this._addWaypoint([t.lngLat.lng,t.lngLat.lat],void 0,t);this.draw(!1)}assignWaypointsCategories(){this._waypoints.forEach(((t,e)=>{const i=0===e?"ORIGIN":e===this._waypoints.length-1?"DESTINATION":void 0;t.properties&&(t.properties.index=e,t.properties.category=i)}))}async _addWaypoint(t,e,i){var s;null==(s=this.abortController)||s.abort(),e=e??this._waypoints.length,this._waypoints.splice(e,0,this.buildPoint(t,"WAYPOINT",this.configuration.bearings?{bearing:void 0}:void 0)),this.assignWaypointsCategories();const n=new A("addwaypoint",i,{index:e});this.fire(n),this.draw();try{await this.fetchDirections(n)}catch{}}async _removeWaypoint(t,e){var i;null==(i=this.abortController)||i.abort(),this._waypoints.splice(t,1),this.snappoints.splice(t,1),this.assignWaypointsCategories();const s=new A("removewaypoint",e,{index:t});this.fire(s),this.draw();try{await this.fetchDirections(s)}catch{}}get interactive(){return this._interactive}set interactive(t){this._interactive=t,t?(this.map.on("touchstart",this.onMoveHandler),this.map.on("touchstart",this.onDragDownHandler),this.map.on("mousedown",this.onDragDownHandler),this.map.on("click",this.onClickHandler),this.hoverable||(this.map.on("mousemove",this.onMoveHandler),this.map.on("click",this.onClickHandler))):(this.map.off("touchstart",this.onMoveHandler),this.map.off("touchstart",this.onDragDownHandler),this.map.off("mousedown",this.onDragDownHandler),this.hoverable||(this.map.off("mousemove",this.onMoveHandler),this.map.off("click",this.onClickHandler)))}get hoverable(){return this._hoverable}set hoverable(t){this._hoverable=t,t&&!this.interactive?(this.map.on("mousemove",this.onMoveHandler),this.map.on("click",this.onClickHandler)):this.interactive||(this.map.off("mousemove",this.onMoveHandler),this.map.off("click",this.onClickHandler))}get waypoints(){return this.waypointsCoordinates}set waypoints(t){this.setWaypoints(t)}get waypointsBearings(){return this.configuration.bearings?G(this._waypoints):(console.warn("The `waypointsBearings` getter was referred to, but the `bearings` configuration option is not enabled!"),[])}set waypointsBearings(t){if(!this.configuration.bearings)return void console.warn("The `waypointsBearings` setter was referred to, but the `bearings` configuration option is not enabled!");this._waypoints.forEach(((e,i)=>{(e.properties||(e.properties={})).bearing=t[i]}));const e=new A("rotatewaypoints",void 0);this.fire(e),this.draw();try{this.fetchDirections(e)}catch{}}async setWaypoints(t,e=[]){var i;null==(i=this.abortController)||i.abort(),this.profiles=e.slice(0,t.length-1),0===this.profiles.length&&this.profiles.push(this.configuration.profile),this._waypoints=this.profiles.flatMap(((e,i)=>{const s=i===this.profiles.length-1,n=i>0?this.profiles[i-1]:void 0,r=e===n?i+1:i,o=s?t.length:i+2;return t.slice(r,o).map(((t,i)=>this.buildPoint(t,"WAYPOINT",{profile:e,...this.configuration.bearings?{bearing:this.waypointsBearings[i]}:void 0})))})),this.assignWaypointsCategories();const s=new A("setwaypoints",void 0);this.fire(s),this.draw();try{await this.fetchDirections(s)}catch{}}async addWaypoint(t,e){await this._addWaypoint(t,e)}async removeWaypoint(t){await this._removeWaypoint(t)}clear(){this.setWaypoints([]),this.routelines=[]}destroy(){var t;null==(t=this.abortController)||t.abort("DESTROY"),this.clear(),this.hoverable=!1,this.interactive=!1,this.configuration.layers.forEach((t=>{this.map.removeLayer(t.id)})),this.map.removeSource(this.configuration.sourceName)}}typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");class M{map;directions;buttonControl;dummyContainer;constructor(t){this.buttonControl=t}onAdd(t){return this.map=t,this.dummyContainer=document.createElement("div"),t.on("load",(()=>{this.directions=new J(t,{api:"https://api.mapbox.com/directions/v5/mapbox",profile:"cycling",requestOptions:{access_token:"pk.eyJ1IjoiY3ljbGVtYXB1cyIsImEiOiJjanNhbHRlaGMwMGp2NDNqeG80Mzk2cmExIn0.0OBPtvf3KANeaA6QOCk1yw"}}),this.directions.on("fetchroutesend",(t=>{const e=t.data?.routes[0],i=(e?.duration/3600*.7).toFixed(1),s=(e?.distance/1e3).toFixed(0);console.info(`${i}h ${s}km`)})),this.directions.interactive=!0})),this.dummyContainer}onRemove(t){this.dummyContainer.parentNode.removeChild(this.dummyContainer),this.map=void 0,this.directions.destroy(),this.directions=void 0}} +var t=Object.defineProperty,e=(e,i,n)=>(((e,i,n)=>{i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n})(e,"symbol"!=typeof i?i+"":i,n),n);class i{constructor(t){e(this,"map"),e(this,"listeners",{}),e(this,"oneTimeListeners",{}),this.map=t}fire(t){var e,i;t.target=this.map;const n=t.type;null==(e=this.listeners[n])||e.forEach((e=>e(t))),null==(i=this.oneTimeListeners[n])||i.forEach((e=>{var i,s;e(t);const r=null==(i=this.oneTimeListeners[n])?void 0:i.indexOf(e);void 0!==r&&~r&&(null==(s=this.oneTimeListeners[n])||s.splice(r,1))}))}on(t,e){this.listeners[t]=this.listeners[t]??[],this.listeners[t].push(e)}off(t,e){var i,n;const s=null==(i=this.listeners[t])?void 0:i.indexOf(e);void 0!==s&&~s&&(null==(n=this.listeners[t])||n.splice(s,1))}once(t,e){this.oneTimeListeners[t]=this.oneTimeListeners[t]??[],this.oneTimeListeners[t].push(e)}}class n{constructor(t,i,n){e(this,"type"),e(this,"target"),e(this,"originalEvent"),e(this,"data"),this.type=t,this.originalEvent=i,this.data=n}}class s{constructor(t,i,n){e(this,"type"),e(this,"target"),e(this,"originalEvent"),e(this,"data"),this.type=t,this.originalEvent=i,this.data=n}}const r={api:"https://router.project-osrm.org/route/v1",profile:"driving",requestOptions:{},requestTimeout:null,makePostRequest:!1,sourceName:"maplibre-gl-directions",pointsScalingFactor:1,linesScalingFactor:1,sensitiveWaypointLayers:["maplibre-gl-directions-waypoint","maplibre-gl-directions-waypoint-casing"],sensitiveSnappointLayers:["maplibre-gl-directions-snappoint","maplibre-gl-directions-snappoint-casing"],sensitiveRoutelineLayers:["maplibre-gl-directions-routeline","maplibre-gl-directions-routeline-casing"],sensitiveAltRoutelineLayers:["maplibre-gl-directions-alt-routeline","maplibre-gl-directions-alt-routeline-casing"],dragThreshold:10,refreshOnMove:!1,bearings:!1},o={snapline:"#34343f",altRouteline:"#9e91be",routelineFoot:"#3665ff",routelineBike:"#63c4ff",routeline:"#7b51f8",congestionLow:"#42c74c",congestionHigh:"#d72359",hoverpoint:"#30a856",snappoint:"#cb3373",snappointHighlight:"#e50d3f",waypointFoot:"#3665ff",waypointFootHighlight:"#0942ff",waypointBike:"#63c4ff",waypointBikeHighlight:"#0bb8ff",waypoint:"#7b51f8",waypointHighlight:"#6d26d7"},a=["case",["==",["get","profile",["get","arriveSnappointProperties"]],"foot"],o.routelineFoot,["==",["get","profile",["get","arriveSnappointProperties"]],"bike"],o.routelineBike,["interpolate-hcl",["linear"],["get","congestion"],0,o.routeline,1,o.congestionLow,100,o.congestionHigh]],l=["case",["==",["get","profile"],"foot"],["case",["boolean",["get","highlight"],!1],o.waypointFootHighlight,o.waypointFoot],["==",["get","profile"],"bike"],["case",["boolean",["get","highlight"],!1],o.waypointBikeHighlight,o.waypointBike],["case",["boolean",["get","highlight"],!1],o.waypointHighlight,o.waypoint]],c=["case",["boolean",["get","highlight"],!1],o.snappointHighlight,o.snappoint];let g=(t=21)=>{let e="",i=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&i[t]];return e};function h(t){return 1&t?~(t>>1):t>>1}function u(t,e=5){const i=Math.pow(10,e);let n=0,s=0,r=0;const o=[];let a,l,c=0,g=0,u=null;for(;n=32);a=h(g),c=g=0;do{u=t.charCodeAt(n++)-63,g|=(31&u)<=32);l=h(g),s+=a,r+=l,o.push([r/i,s/i])}return o}function d(t){return t.map((t=>[t.geometry.coordinates[0],t.geometry.coordinates[1]]))}function p(t){return t.map((t=>{var e,i,n;return Array.isArray(null==(e=t.properties)?void 0:e.bearing)?[null==(i=t.properties)?void 0:i.bearing[0],null==(n=t.properties)?void 0:n.bearing[1]]:void 0}))}function m(t){const e=function(t=1,e=1,i="maplibre-gl-directions"){const n=["interpolate",["exponential",1.5],["zoom"],0,["case",["boolean",["get","highlight"],["==",["get","type"],"HOVERPOINT"]],14*t,12*t],5,["case",["boolean",["get","highlight"],["==",["get","type"],"HOVERPOINT"]],14*t,12*t],18,["case",["boolean",["get","highlight"],["==",["get","type"],"HOVERPOINT"]],33*t,28*t]],s=["interpolate",["exponential",1.5],["zoom"],0,["case",["boolean",["get","highlight"],["==",["get","type"],"HOVERPOINT"]],9*t,7*t],5,["case",["boolean",["get","highlight"],["==",["get","type"],"HOVERPOINT"]],9*t,7*t],18,["case",["boolean",["get","highlight"],["==",["get","type"],"HOVERPOINT"]],21*t,16*t]],r=["interpolate",["exponential",1.5],["zoom"],0,3*e,5,3*e,18,10*e],g=["interpolate",["exponential",1.5],["zoom"],0,["case",["boolean",["get","highlight"],!1],10*e,7*e],5,["case",["boolean",["get","highlight"],!1],10*e,7*e],18,["case",["boolean",["get","highlight"],!1],32*e,23*e]];return[{id:`${i}-snapline`,type:"line",source:i,layout:{"line-cap":"round","line-join":"round"},paint:{"line-dasharray":[3,3],"line-color":o.snapline,"line-opacity":.65,"line-width":3},filter:["==",["get","type"],"SNAPLINE"]},{id:`${i}-alt-routeline-casing`,type:"line",source:i,layout:{"line-cap":"butt","line-join":"round"},paint:{"line-color":o.altRouteline,"line-opacity":.55,"line-width":g},filter:["==",["get","route"],"ALT"]},{id:`${i}-alt-routeline`,type:"line",source:i,layout:{"line-cap":"butt","line-join":"round"},paint:{"line-color":o.altRouteline,"line-opacity":.85,"line-width":r},filter:["==",["get","route"],"ALT"]},{id:`${i}-routeline-casing`,type:"line",source:i,layout:{"line-cap":"butt","line-join":"round"},paint:{"line-color":a,"line-opacity":.55,"line-width":g},filter:["==",["get","route"],"SELECTED"]},{id:`${i}-routeline`,type:"line",source:i,layout:{"line-cap":"butt","line-join":"round"},paint:{"line-color":a,"line-opacity":.85,"line-width":r},filter:["==",["get","route"],"SELECTED"]},{id:`${i}-hoverpoint-casing`,type:"circle",source:i,paint:{"circle-radius":n,"circle-color":o.hoverpoint,"circle-opacity":.65},filter:["==",["get","type"],"HOVERPOINT"]},{id:`${i}-hoverpoint`,type:"circle",source:i,paint:{"circle-radius":s,"circle-color":o.hoverpoint},filter:["==",["get","type"],"HOVERPOINT"]},{id:`${i}-snappoint-casing`,type:"circle",source:i,paint:{"circle-radius":n,"circle-color":c,"circle-opacity":.65},filter:["==",["get","type"],"SNAPPOINT"]},{id:`${i}-snappoint`,type:"circle",source:i,paint:{"circle-radius":s,"circle-color":c},filter:["==",["get","type"],"SNAPPOINT"]},{id:`${i}-waypoint-casing`,type:"circle",source:i,paint:{"circle-radius":n,"circle-color":l,"circle-opacity":.65},filter:["==",["get","type"],"WAYPOINT"]},{id:`${i}-waypoint`,type:"circle",source:i,paint:{"circle-radius":s,"circle-color":l},filter:["==",["get","type"],"WAYPOINT"]}]}(null==t?void 0:t.pointsScalingFactor,null==t?void 0:t.linesScalingFactor,null==t?void 0:t.sourceName);return Object.assign({},r,{layers:e},t)}function I(t,e,i){const n=t.makePostRequest?"post":"get";let s,r;if("get"===n)s=`${t.api}/${t.profile}/${e.join(";")}`,r=new URLSearchParams(t.requestOptions);else{s=`${t.api}/${t.profile}${t.requestOptions.access_token?`?access_token=${t.requestOptions.access_token}`:""}`;const i=new FormData;Object.entries(t.requestOptions).forEach((([t,e])=>{"access_token"!==t&&i.set(t,e)})),i.set("coordinates",e.join(";")),r=new URLSearchParams(i)}return t.bearings&&i&&r.set("bearings",i.map((t=>t?`${t[0]},${t[1]}`:"")).join(";")),{method:n,url:s,payload:r}}function C(t,e,i){return{type:"Feature",geometry:{type:"Point",coordinates:t},properties:{type:e,id:g(),...i??{}}}}function f(t,e,i,n,s=!1){if(t.length!==e.length)return[];const r=t.map(((t,i)=>({type:"Feature",geometry:{type:"LineString",coordinates:[[t[0],t[1]],[e[i][0],e[i][1]]]},properties:{type:"SNAPLINE"}})));return~n&&void 0!==i&&s&&(r.push({type:"Feature",geometry:{type:"LineString",coordinates:[[i[0],i[1]],[e[n][0],e[n][1]]]},properties:{type:"SNAPLINE"}}),r.push({type:"Feature",geometry:{type:"LineString",coordinates:[[i[0],i[1]],[e[n+1][0],e[n+1][1]]]},properties:{type:"SNAPLINE"}})),r}function A(t,e,i,n){return e.map(((e,s)=>{const r=function(t,e){return"geojson"===t.geometries?e.coordinates:"polyline6"===t.geometries?u(e,6):u(e,5)}(t,e.geometry),o=n.map((t=>t.geometry.coordinates));let a=0;const l=o.map(((e,i)=>{const n=r.slice(a).findIndex((i=>function(t,e,i){return t.geometries&&"polyline"!==t.geometries?e[0]===i[0]&&e[1]===i[1]:Math.abs(e[0]-i[0])<=1e-5&&Math.abs(e[1]-i[1])<=1e-5}(t,i,e))),s=i===o.length-1;if(-1!==n)a+=n;else if(s)return r.length-1;return a})).slice(1);let c=0;const h=l.map((t=>r.slice(c,c=t+1))),d=[];return h.forEach(((r,o)=>{const a=g();r.forEach(((r,l)=>{var c,g,h;const u=d[d.length-1],p=function(t,e,i){var n,s,r,o;if(null!=(n=t.annotations)&&n.includes("congestion_numeric"))return(null==(s=null==e?void 0:e.congestion_numeric)?void 0:s[i])??0;if(null==(r=t.annotations)||!r.includes("congestion"))return 0;switch((null==(o=null==e?void 0:e.congestion)?void 0:o[i])??""){case"unknown":default:return 0;case"low":return 1;case"moderate":return 34;case"heavy":return 77;case"severe":return 100}}(t,null==(c=e.legs[o])?void 0:c.annotation,l);if(o===(null==(g=null==u?void 0:u.properties)?void 0:g.legIndex)&&(null==(h=u.properties)?void 0:h.congestion)===p)u.geometry.coordinates.push(r);else{const t=n[o].properties??{},e=n[o+1].properties??{},l={type:"Feature",geometry:{type:"LineString",coordinates:[]},properties:{id:a,routeIndex:s,route:s===i?"SELECTED":"ALT",legIndex:o,congestion:p,departSnappointProperties:t,arriveSnappointProperties:e}};u&&l.geometry.coordinates.push(u.geometry.coordinates[u.geometry.coordinates.length-1]),l.geometry.coordinates.push(r),d.push(l)}}))})),d}))}class y extends i{constructor(t,i){super(t),e(this,"configuration"),e(this,"_interactive",!1),e(this,"_hoverable",!1),e(this,"buildRequest",I),e(this,"buildPoint",C),e(this,"buildSnaplines",f),e(this,"buildRoutelines",A),e(this,"onMoveHandler"),e(this,"onDragDownHandler"),e(this,"onDragMoveHandler"),e(this,"onDragUpHandler"),e(this,"onClickHandler"),e(this,"liveRefreshHandler"),e(this,"profiles",[]),e(this,"_waypoints",[]),e(this,"snappoints",[]),e(this,"routelines",[]),e(this,"selectedRouteIndex",0),e(this,"hoverpoint"),e(this,"highlightedWaypoints",[]),e(this,"highlightedSnappoints",[]),e(this,"dragDownPosition",{x:0,y:0}),e(this,"waypointBeingDragged"),e(this,"waypointBeingDraggedInitialCoordinates"),e(this,"departSnappointIndex",-1),e(this,"currentMousePosition",{x:0,y:0}),e(this,"refreshOnMoveIsRefreshing",!1),e(this,"noMouseMovementTimer"),e(this,"lastRequestMousePosition",{x:0,y:0}),e(this,"allowRouteSwitch",!1),e(this,"abortController"),this.map=t,this.configuration=m(i),this.onMoveHandler=this.onMove.bind(this),this.onDragDownHandler=this.onDragDown.bind(this),this.onDragMoveHandler=this.onDragMove.bind(this),this.onDragUpHandler=this.onDragUp.bind(this),this.onClickHandler=this.onClick.bind(this),this.liveRefreshHandler=this.liveRefresh.bind(this),this.init()}get waypointsCoordinates(){return d(this._waypoints)}get snappointsCoordinates(){return this.snappoints.map((t=>[t.geometry.coordinates[0],t.geometry.coordinates[1]]))}get snaplines(){var t,e,i;return this.buildSnaplines(this.waypointsCoordinates,this.snappointsCoordinates,null==(t=this.hoverpoint)?void 0:t.geometry.coordinates,this.departSnappointIndex,null==(i=null==(e=this.hoverpoint)?void 0:e.properties)?void 0:i.showSnaplines)}init(){this.map.addSource(this.configuration.sourceName,{type:"geojson",data:{type:"FeatureCollection",features:[]}}),this.configuration.layers.forEach((t=>{this.map.addLayer(t)}))}async fetch({method:t,url:e,payload:i}){var n,s;const r=await("get"===t?await fetch(`${e}?${i}`,{signal:null==(n=this.abortController)?void 0:n.signal}):await fetch(`${e}`,{signal:null==(s=this.abortController)?void 0:s.signal,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:i})).json();if("Ok"!==r.code)throw new Error(r.message??"An unexpected error occurred.");return r}async fetchDirections(t){var e,i;null==(e=this.abortController)||e.abort();const n=this.interactive;if(this._waypoints.length>=2){this.fire(new s("fetchroutesstart",t)),this.abortController=new AbortController;let e;this.abortController.signal.onabort=()=>{this.interactive=n},this.interactive=!1,null!==this.configuration.requestTimeout&&(e=setTimeout((()=>{var t;return null==(t=this.abortController)?void 0:t.abort()}),this.configuration.requestTimeout)),this.profiles.length||(this.profiles=[this.configuration.profile]);const r=[],o=[];this.profiles.reduce(((t,e,i)=>{const n=i===this.profiles.length-1,s=e===(i>0?this.profiles[i-1]:void 0),a=n?this._waypoints.length:s?t+1:t+2;return s?o[o.length-1].push(...this._waypoints.slice(t,a)):(o.push(this._waypoints.slice(t,a)),r.push(e)),a}),0);const a=r.map(((t,e)=>this.buildRequest({...this.configuration,profile:t},d(o[e]),this.configuration.bearings?p(o[e]):void 0)));let l;try{l=await Promise.all(a.map((async e=>{let i;try{i=await this.fetch(e)}finally{this.fire(new s("fetchroutesend",t,i))}return i})))}finally{"DESTROY"!==(null==(i=this.abortController)?void 0:i.signal.reason)&&(this.interactive=n),this.abortController=void 0,clearTimeout(e)}const c=l.flatMap(((t,e)=>{const i=r[e],n=t.waypoints.map(((t,n)=>this.buildPoint(t.location,"SNAPPOINT",{profile:i,waypointProperties:o[e][n].properties??{}})));return{snappoints:n,routelines:this.buildRoutelines(this.configuration.requestOptions,t.routes,this.selectedRouteIndex,n)}})),g=l.flatMap((t=>t.routes));this.snappoints=c.flatMap((t=>t.snappoints)),this.routelines=c.flatMap((t=>t.routelines)),g.length<=this.selectedRouteIndex&&(this.selectedRouteIndex=0)}else this.snappoints=[],this.routelines=[];this.draw(!1)}draw(t=!0){const e=[...this._waypoints,...this.snappoints,...this.snaplines,...this.routelines.reduce(((e,i)=>t?e.concat(...i):e.concat(...i.map((t=>(t.properties&&(t.properties.route=t.properties.routeIndex===this.selectedRouteIndex?"SELECTED":"ALT"),t))))),[])];this.hoverpoint&&e.push(this.hoverpoint);const i={type:"FeatureCollection",features:e};this.map.getSource(this.configuration.sourceName)&&this.map.getSource(this.configuration.sourceName).setData(i)}deHighlight(){this.highlightedWaypoints.forEach((t=>{null!=t&&t.properties&&(t.properties.highlight=!1)})),this.highlightedSnappoints.forEach((t=>{null!=t&&t.properties&&(t.properties.highlight=!1)})),this.routelines.forEach((t=>{t.forEach((t=>{t.properties&&(t.properties.highlight=!1)}))}))}onMove(t){var e,i,n,s;const r=this.map.queryRenderedFeatures(t.point,{layers:[...this.configuration.sensitiveWaypointLayers,...this.configuration.sensitiveSnappointLayers,...this.configuration.sensitiveRoutelineLayers,...this.configuration.sensitiveAltRoutelineLayers]})[0];if(this.deHighlight(),this.configuration.sensitiveWaypointLayers.includes((null==r?void 0:r.layer.id)??"")){this.map.getCanvas().style.cursor="pointer",this.interactive&&this.map.dragPan.disable();const t=this._waypoints.find((t=>{var e,i;return(null==(e=t.properties)?void 0:e.id)===(null==(i=null==r?void 0:r.properties)?void 0:i.id)})),n=t&&this.snappoints.find((e=>{var i,n,s;return(null==(n=null==(i=e.properties)?void 0:i.waypointProperties)?void 0:n.id)===(null==(s=t.properties)?void 0:s.id)}));t&&(this.highlightedWaypoints=[t]),n&&(this.highlightedSnappoints=[n]),null!=(e=this.highlightedWaypoints[0])&&e.properties&&(this.highlightedWaypoints[0].properties.highlight=!0),null!=(i=this.highlightedSnappoints[0])&&i.properties&&(this.highlightedSnappoints[0].properties.highlight=!0),this.hoverpoint&&(this.hoverpoint=void 0)}else if(this.configuration.sensitiveSnappointLayers.includes((null==r?void 0:r.layer.id)??"")){this.map.getCanvas().style.cursor="pointer";const t=this.snappoints.findIndex((t=>{var e,i;return(null==(e=t.properties)?void 0:e.id)===(null==(i=null==r?void 0:r.properties)?void 0:i.id)}));this.highlightedSnappoints=[this.snappoints[t]],this.highlightedWaypoints=[this._waypoints[t]],this.highlightedSnappoints[0].properties&&(this.highlightedSnappoints[0].properties.highlight=!0),this.highlightedWaypoints[0].properties&&(this.highlightedWaypoints[0].properties.highlight=!0),this.hoverpoint&&(this.hoverpoint=void 0)}else this.configuration.sensitiveRoutelineLayers.includes((null==r?void 0:r.layer.id)??"")?(this.map.getCanvas().style.cursor="pointer",this.interactive&&(this.map.dragPan.disable(),this.hoverpoint?this.hoverpoint.geometry.coordinates=[t.lngLat.lng,t.lngLat.lat]:this.hoverpoint=this.buildPoint([t.lngLat.lng,t.lngLat.lat],"HOVERPOINT",{departSnappointProperties:{...JSON.parse((null==(n=null==r?void 0:r.properties)?void 0:n.departSnappointProperties)??"{}")},arriveSnappointProperties:{...JSON.parse((null==(s=null==r?void 0:r.properties)?void 0:s.arriveSnappointProperties)??"{}")}})),this.routelines.forEach((t=>{t.forEach((t=>{var e,i;t.properties&&(null==(e=t.properties)?void 0:e.id)===(null==(i=null==r?void 0:r.properties)?void 0:i.id)&&(t.properties.highlight=!0)}))}))):this.configuration.sensitiveAltRoutelineLayers.includes((null==r?void 0:r.layer.id)??"")?(this.map.getCanvas().style.cursor="pointer",this.routelines.forEach((t=>{t.forEach((t=>{var e,i;t.properties&&(null==(e=t.properties)?void 0:e.id)===(null==(i=null==r?void 0:r.properties)?void 0:i.id)&&(t.properties.highlight=!0)}))})),this.hoverpoint&&(this.hoverpoint=void 0)):(this.map.dragPan.enable(),this.map.getCanvas().style.cursor="",this.hoverpoint=void 0);this.draw()}onDragDown(t){var e,i,n,s,r,o;if("touchstart"===t.type&&1!==t.originalEvent.touches.length||"mousedown"===t.type&&1!==t.originalEvent.which)return;const a=this.map.queryRenderedFeatures(t.point);if(a.length&&a[0].source===this.configuration.sourceName){const l=a.filter((t=>this.configuration.sensitiveWaypointLayers.includes((null==t?void 0:t.layer.id)??"")||this.configuration.sensitiveSnappointLayers.includes((null==t?void 0:t.layer.id)??"")||this.configuration.sensitiveRoutelineLayers.includes((null==t?void 0:t.layer.id)??"")))[0];if(this.dragDownPosition=t.point,this.currentMousePosition=t.point,this.configuration.sensitiveWaypointLayers.includes((null==l?void 0:l.layer.id)??""))this.waypointBeingDragged=this._waypoints.find((t=>{var e,i;return(null==(e=t.properties)?void 0:e.id)===(null==(i=null==l?void 0:l.properties)?void 0:i.id)})),this.waypointBeingDraggedInitialCoordinates=null==(e=this.waypointBeingDragged)?void 0:e.geometry.coordinates;else if(this.configuration.sensitiveRoutelineLayers.includes((null==l?void 0:l.layer.id)??"")){if(this.departSnappointIndex=JSON.parse(null==(i=null==l?void 0:l.properties)?void 0:i.legIndex),this.hoverpoint)if(this.configuration.refreshOnMove){const e=void 0!==this.departSnappointIndex?this.departSnappointIndex+1:void 0;this._addWaypoint([t.lngLat.lng,t.lngLat.lat],e,t),this.waypointBeingDragged=e?this._waypoints[e]:void 0,this.hoverpoint=void 0}else this.hoverpoint.geometry.coordinates=[t.lngLat.lng,t.lngLat.lat];else this.hoverpoint=this.buildPoint([t.lngLat.lng,t.lngLat.lat],"HOVERPOINT",{departSnappointProperties:{...JSON.parse((null==(n=null==l?void 0:l.properties)?void 0:n.departSnappointProperties)??"{}")},arriveSnappointProperties:{...JSON.parse((null==(s=null==l?void 0:l.properties)?void 0:s.arriveSnappointProperties)??"{}")}});null!=(r=this.hoverpoint)&&r.properties&&(this.hoverpoint.properties.showSnaplines=!0),~this.departSnappointIndex&&null!=(o=this.snappoints[this.departSnappointIndex])&&o.properties&&(this.snappoints[this.departSnappointIndex].properties.highlight=!0,this.highlightedSnappoints.push(this.snappoints[this.departSnappointIndex]),this.snappoints[this.departSnappointIndex+1].properties.highlight=!0,this.highlightedSnappoints.push(this.snappoints[this.departSnappointIndex+1]))}this.map.off("touchstart",this.onMoveHandler),this.map.off("mousemove",this.onMoveHandler),"touchstart"===t.type?(this.map.on("touchmove",this.onDragMoveHandler),this.map.on("touchend",this.onDragUpHandler)):"mousedown"===t.type&&(this.map.on("mousemove",this.onDragMoveHandler),this.map.on("mouseup",this.onDragUpHandler)),this.draw()}}onDragMove(t){if(this.configuration.refreshOnMove&&(clearTimeout(this.noMouseMovementTimer),this.noMouseMovementTimer=setTimeout(this.liveRefreshHandler,300,t)),"touchmove"===t.type&&1!==t.originalEvent.touches.length)return t.originalEvent.preventDefault();"mousemove"===t.type&&1!==t.originalEvent.which||(this.waypointBeingDragged?this.waypointBeingDragged.geometry.coordinates=[t.lngLat.lng,t.lngLat.lat]:this.hoverpoint&&(this.hoverpoint.geometry.coordinates=[t.lngLat.lng,t.lngLat.lat]),this.currentMousePosition=t.point,this.draw(),this.configuration.refreshOnMove&&!this.refreshOnMoveIsRefreshing&&this.liveRefreshHandler(t))}async onDragUp(t){var e,i,s;if(this.configuration.refreshOnMove&&clearTimeout(this.noMouseMovementTimer),"mouseup"!==t.type||1===t.originalEvent.which){if(null!=(e=this.hoverpoint)&&e.properties&&(this.hoverpoint.properties.showSnaplines=!1),Math.abs(t.point.x-(null==(i=this.dragDownPosition)?void 0:i.x))>(this.configuration.dragThreshold>=0?this.configuration.dragThreshold:0)||Math.abs(t.point.y-(null==(s=this.dragDownPosition)?void 0:s.y))>(this.configuration.dragThreshold>=0?this.configuration.dragThreshold:0))if(this.waypointBeingDragged){this.waypointBeingDragged.geometry.coordinates=[t.lngLat.lng,t.lngLat.lat];const e=new n("movewaypoint",t,{index:this._waypoints.indexOf(this.waypointBeingDragged),initialCoordinates:this.waypointBeingDraggedInitialCoordinates});this.fire(e);try{await this.fetchDirections(e)}catch(t){t instanceof DOMException&&"AbortError"==t.name||this.waypointBeingDraggedInitialCoordinates&&(this.waypointBeingDragged.geometry.coordinates=this.waypointBeingDraggedInitialCoordinates)}this.waypointBeingDragged=void 0,this.waypointBeingDraggedInitialCoordinates=void 0}else this.hoverpoint&&(this._addWaypoint([t.lngLat.lng,t.lngLat.lat],void 0!==this.departSnappointIndex?this.departSnappointIndex+1:void 0,t),this.hoverpoint=void 0);else this.waypointBeingDragged&&this.waypointBeingDraggedInitialCoordinates?(this.waypointBeingDragged.geometry.coordinates=this.waypointBeingDraggedInitialCoordinates,this.waypointBeingDragged=void 0,this.waypointBeingDraggedInitialCoordinates=void 0):this.hoverpoint&&(this.hoverpoint=void 0);this.deHighlight(),"touchend"===t.type?(this.map.off("touchmove",this.onDragMoveHandler),this.map.off("touchend",this.onDragUpHandler)):"mouseup"===t.type&&(this.map.off("mousemove",this.onDragMoveHandler),this.map.off("mouseup",this.onDragUpHandler)),this.map.on("touchstart",this.onMoveHandler),this.map.on("mousemove",this.onMoveHandler),this.map.dragPan.enable(),this.draw()}}async liveRefresh(t){var e,i,s,r;if(Math.abs((null==(e=this.lastRequestMousePosition)?void 0:e.x)-(null==(i=this.currentMousePosition)?void 0:i.x))>(this.configuration.dragThreshold>=0?this.configuration.dragThreshold:0)||Math.abs((null==(s=this.lastRequestMousePosition)?void 0:s.y)-(null==(r=this.currentMousePosition)?void 0:r.y))>(this.configuration.dragThreshold>=0?this.configuration.dragThreshold:0)){if(this.refreshOnMoveIsRefreshing=!0,this.lastRequestMousePosition=this.currentMousePosition,this.waypointBeingDragged){const e=new n("movewaypoint",t,{index:this._waypoints.indexOf(this.waypointBeingDragged),initialCoordinates:this.waypointBeingDraggedInitialCoordinates});this.fire(e);try{await this.fetchDirections(e)}catch{}}this.refreshOnMoveIsRefreshing=!1}}onClick(t){const e=this.map.queryRenderedFeatures(t.point,{layers:[...this.configuration.sensitiveWaypointLayers,...this.configuration.sensitiveSnappointLayers,...this.configuration.sensitiveAltRoutelineLayers,...this.configuration.sensitiveRoutelineLayers]})[0];if(this._interactive&&this.configuration.sensitiveWaypointLayers.includes((null==e?void 0:e.layer.id)??"")){const i=this._waypoints.findIndex((t=>{var i,n;return(null==(i=t.properties)?void 0:i.id)===(null==(n=null==e?void 0:e.properties)?void 0:n.id)}));~i&&this._removeWaypoint(i,t)}else if(this._interactive&&this.configuration.sensitiveSnappointLayers.includes((null==e?void 0:e.layer.id)??"")){const i=this.snappoints.findIndex((t=>{var i,n;return(null==(i=t.properties)?void 0:i.id)===(null==(n=null==e?void 0:e.properties)?void 0:n.id)}));~i&&this._removeWaypoint(i,t)}else(this.interactive||this.allowRouteSwitch)&&this.configuration.sensitiveAltRoutelineLayers.includes((null==e?void 0:e.layer.id)??"")?this.selectedRouteIndex=this.routelines.findIndex((t=>!!t.find((t=>{var i,n;return(null==(i=t.properties)?void 0:i.id)===(null==(n=null==e?void 0:e.properties)?void 0:n.id)})))):this._interactive&&!this.configuration.sensitiveRoutelineLayers.includes((null==e?void 0:e.layer.id)??"")&&this._addWaypoint([t.lngLat.lng,t.lngLat.lat],void 0,t);this.draw(!1)}assignWaypointsCategories(){this._waypoints.forEach(((t,e)=>{const i=0===e?"ORIGIN":e===this._waypoints.length-1?"DESTINATION":void 0;t.properties&&(t.properties.index=e,t.properties.category=i)}))}async _addWaypoint(t,e,i){var s;null==(s=this.abortController)||s.abort(),e=e??this._waypoints.length,this._waypoints.splice(e,0,this.buildPoint(t,"WAYPOINT",this.configuration.bearings?{bearing:void 0}:void 0)),this.assignWaypointsCategories();const r=new n("addwaypoint",i,{index:e});this.fire(r),this.draw();try{await this.fetchDirections(r)}catch{}}async _removeWaypoint(t,e){var i;null==(i=this.abortController)||i.abort(),this._waypoints.splice(t,1),this.snappoints.splice(t,1),this.assignWaypointsCategories();const s=new n("removewaypoint",e,{index:t});this.fire(s),this.draw();try{await this.fetchDirections(s)}catch{}}get interactive(){return this._interactive}set interactive(t){this._interactive=t,t?(this.map.on("touchstart",this.onMoveHandler),this.map.on("touchstart",this.onDragDownHandler),this.map.on("mousedown",this.onDragDownHandler),this.map.on("click",this.onClickHandler),this.hoverable||(this.map.on("mousemove",this.onMoveHandler),this.map.on("click",this.onClickHandler))):(this.map.off("touchstart",this.onMoveHandler),this.map.off("touchstart",this.onDragDownHandler),this.map.off("mousedown",this.onDragDownHandler),this.hoverable||(this.map.off("mousemove",this.onMoveHandler),this.map.off("click",this.onClickHandler)))}get hoverable(){return this._hoverable}set hoverable(t){this._hoverable=t,t&&!this.interactive?(this.map.on("mousemove",this.onMoveHandler),this.map.on("click",this.onClickHandler)):this.interactive||(this.map.off("mousemove",this.onMoveHandler),this.map.off("click",this.onClickHandler))}get waypoints(){return this.waypointsCoordinates}set waypoints(t){this.setWaypoints(t)}get waypointsBearings(){return this.configuration.bearings?p(this._waypoints):(console.warn("The `waypointsBearings` getter was referred to, but the `bearings` configuration option is not enabled!"),[])}set waypointsBearings(t){if(!this.configuration.bearings)return void console.warn("The `waypointsBearings` setter was referred to, but the `bearings` configuration option is not enabled!");this._waypoints.forEach(((e,i)=>{(e.properties||(e.properties={})).bearing=t[i]}));const e=new n("rotatewaypoints",void 0);this.fire(e),this.draw();try{this.fetchDirections(e)}catch{}}async setWaypoints(t,e=[]){var i;null==(i=this.abortController)||i.abort(),this.profiles=e.slice(0,t.length-1),0===this.profiles.length&&this.profiles.push(this.configuration.profile),this._waypoints=this.profiles.flatMap(((e,i)=>{const n=i===this.profiles.length-1,s=i>0?this.profiles[i-1]:void 0,r=e===s?i+1:i,o=n?t.length:i+2;return t.slice(r,o).map(((t,i)=>this.buildPoint(t,"WAYPOINT",{profile:e,...this.configuration.bearings?{bearing:this.waypointsBearings[i]}:void 0})))})),this.assignWaypointsCategories();const s=new n("setwaypoints",void 0);this.fire(s),this.draw();try{await this.fetchDirections(s)}catch{}}async addWaypoint(t,e){await this._addWaypoint(t,e)}async removeWaypoint(t){await this._removeWaypoint(t)}clear(){this.setWaypoints([]),this.routelines=[]}destroy(){var t;null==(t=this.abortController)||t.abort("DESTROY"),this.clear(),this.hoverable=!1,this.interactive=!1,this.configuration.layers.forEach((t=>{this.map.removeLayer(t.id)})),this.map.removeSource(this.configuration.sourceName)}}typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");class b{map;directions;dummyContainer;constructor(){}onAdd(t){this.map=t,this.dummyContainer=document.createElement("div");const e=new y(this.map,{api:"https://api.mapbox.com/directions/v5",makePostRequest:!0,profile:"mapbox/cycling",requestOptions:{access_token:"pk.eyJ1IjoiY3ljbGVtYXB1cyIsImEiOiJjanNhbHRlaGMwMGp2NDNqeG80Mzk2cmExIn0.0OBPtvf3KANeaA6QOCk1yw",geometries:"polyline6"}});return this.directions=e,e.on("addwaypoint",(t=>{console.info("### on addwaypoint")})),e.on("fetchroutesend",(t=>{const e=t.data?.routes[0],i=(e?.duration/3600*.7).toFixed(1),n=(e?.distance/1e3).toFixed(0);console.info(`${i}h ${n}km`)})),e.interactive=!0,this.dummyContainer}onRemove(t){this.dummyContainer.parentNode.removeChild(this.dummyContainer),this.map=void 0,this.directions.destroy(),this.directions=void 0}}function _(t,e=5){return`${t.lat.toFixed(e)},${t.lng.toFixed(e)}`}function v(t,e){fetch(t).then((t=>{if(!t.ok)throw new Error(`http error. status: ${t.status}`);return t.text()})).then((t=>(t=t.replaceAll("{CYCLEMAPS_MAPBOX_PUBLIC_ACCESS_TOKEN}","pk.eyJ1IjoiY3ljbGVtYXB1cyIsImEiOiJjanNhbHRlaGMwMGp2NDNqeG80Mzk2cmExIn0.0OBPtvf3KANeaA6QOCk1yw"),JSON.parse(t)))).then(e)}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function x(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var w={exports:{}}; +/** + * MapLibre GL JS + * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.5.0/LICENSE.txt + */w.exports=function(){var t={},e={};function i(i,n,s){if(e[i]=s,"index"===i){var r="var sharedModule = {}; ("+e.shared+")(sharedModule); ("+e.worker+")(sharedModule);",o={};return e.shared(o),e.index(t,o),"undefined"!=typeof window&&t.setWorkerUrl(window.URL.createObjectURL(new Blob([r],{type:"text/javascript"}))),t}}i("shared",["exports"],(function(t){function e(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{l(n.next(t))}catch(t){r(t)}}function a(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))}function i(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}"function"==typeof SuppressedError&&SuppressedError;var n=s;function s(t,e){this.x=t,this.y=e}s.prototype={clone:function(){return new s(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),i=Math.sin(t),n=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=n,this},_rotateAround:function(t,e){var i=Math.cos(t),n=Math.sin(t),s=e.y+n*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-n*(this.y-e.y),this.y=s,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},s.convert=function(t){return t instanceof s?t:Array.isArray(t)?new s(t[0],t[1]):t};var r=i(n),o=a;function a(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}a.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 s=this.sampleCurveX(i)-t;if(Math.abs(s)s?o=i:a=i,i=.5*(a-o)+o;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var l=i(o);let c,g;function h(){return null==c&&(c="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),c}function u(){if(null==g&&(g=!1,h())){const t=5,e=new OffscreenCanvas(t,t).getContext("2d",{willReadFrequently:!0});if(e){for(let i=0;is.solve(t)}const p=d(.25,.1,.25,1);function m(t,e,i){return Math.min(i,Math.max(e,t))}function I(t,e,i){const n=i-e,s=((t-e)%n+n)%n+e;return s===e?i:s}function C(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}let f=1;function A(t,e,i){const n={};for(const i in t)n[i]=e.call(this,t[i],i,t);return n}function y(t,e,i){const n={};for(const i in t)e.call(this,t[i],i,t)&&(n[i]=t[i]);return n}function b(t){return Array.isArray(t)?t.map(b):"object"==typeof t&&t?A(t,b):t}const _={};function v(t){_[t]||("undefined"!=typeof console&&console.warn(t),_[t]=!0)}function x(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}function w(t){return"undefined"!=typeof WorkerGlobalScope&&void 0!==t&&t instanceof WorkerGlobalScope}let S=null;function k(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}const Z="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function B(t,i,n,s,r){return e(this,void 0,void 0,(function*(){if("undefined"==typeof VideoFrame)throw new Error("VideoFrame not supported");const e=new VideoFrame(t,{timestamp:0});try{const o=null==e?void 0:e.format;if(!o||!o.startsWith("BGR")&&!o.startsWith("RGB"))throw new Error(`Unrecognized format ${o}`);const a=o.startsWith("BGR"),l=new Uint8ClampedArray(s*r*4);if(yield e.copyTo(l,function(t,e,i,n,s){const r=4*Math.max(-e,0),o=(Math.max(0,i)-i)*n*4+r,a=4*n,l=Math.max(0,e),c=Math.max(0,i);return{rect:{x:l,y:c,width:Math.min(t.width,e+n)-l,height:Math.min(t.height,i+s)-c},layout:[{offset:o,stride:a}]}}(t,i,n,s,r)),a)for(let t=0;tw(self)?self.worker&&self.worker.referrer:("blob:"===window.location.protocol?window.parent:window).location.href,X=function(t,i){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){const e=J(t.url);if(e)return e(t,i);if(w(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:z},i)}if(!(/^file:/.test(n=t.url)||/^file:/.test(M())&&!/^\w+:/.test(n))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(t,i){return e(this,void 0,void 0,(function*(){const e=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:M(),signal:i.signal});"json"!==t.type||e.headers.has("Accept")||e.headers.set("Accept","application/json");const n=yield fetch(e);if(!n.ok){const e=yield n.blob();throw new P(n.status,n.statusText,t.url,e)}let s;s="arrayBuffer"===t.type||"image"===t.type?n.arrayBuffer():"json"===t.type?n.json():n.text();const r=yield s;if(i.signal.aborted)throw T();return{data:r,cacheControl:n.headers.get("Cache-Control"),expires:n.headers.get("Expires")}}))}(t,i);if(w(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:z},i)}var n;return function(t,e){return new Promise(((i,n)=>{var s;const r=new XMLHttpRequest;r.open(t.method||"GET",t.url,!0),"arrayBuffer"!==t.type&&"image"!==t.type||(r.responseType="arraybuffer");for(const e in t.headers)r.setRequestHeader(e,t.headers[e]);"json"===t.type&&(r.responseType="text",(null===(s=t.headers)||void 0===s?void 0:s.Accept)||r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===t.credentials,r.onerror=()=>{n(new Error(r.statusText))},r.onload=()=>{if(!e.signal.aborted)if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){let e=r.response;if("json"===t.type)try{e=JSON.parse(r.response)}catch(t){return void n(t)}i({data:e,cacheControl:r.getResponseHeader("Cache-Control"),expires:r.getResponseHeader("Expires")})}else{const e=new Blob([r.response],{type:r.getResponseHeader("Content-Type")});n(new P(r.status,r.statusText,t.url,e))}},e.signal.addEventListener("abort",(()=>{r.abort(),n(T())})),r.send(t.body)}))}(t,i)};function F(t){if(!t||t.indexOf("://")<=0||0===t.indexOf("data:image/")||0===t.indexOf("blob:"))return!0;const e=new URL(t),i=window.location;return e.protocol===i.protocol&&e.host===i.host}function K(t,e,i){i[t]&&-1!==i[t].indexOf(e)||(i[t]=i[t]||[],i[t].push(e))}function H(t,e,i){if(i&&i[t]){const n=i[t].indexOf(e);-1!==n&&i[t].splice(n,1)}}class L{constructor(t,e={}){C(this,e),this.type=t}}class E extends L{constructor(t,e={}){super("error",C({error:t},e))}}class D{on(t,e){return this._listeners=this._listeners||{},K(t,e,this._listeners),this}off(t,e){return H(t,e,this._listeners),H(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},K(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){"string"==typeof t&&(t=new L(t,e||{}));const i=t.type;if(this.listens(i)){t.target=this;const e=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(const i of e)i.call(this,t);const n=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(const e of n)H(i,e,this._oneTimeListeners),e.call(this,t);const s=this._eventedParent;s&&(C(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),s.fire(t))}else t instanceof E&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}var Y={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},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},"*":{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:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"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","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_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:"*",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:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","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"]},"property-type":"cross-faded"},"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"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},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"}}};const N=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function O(t,e){const i={};for(const e in t)"ref"!==e&&(i[e]=t[e]);return N.forEach((t=>{t in e&&(i[t]=e[t])})),i}function U(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const _t=[lt,ct,gt,ht,ut,It,dt,yt(pt),Ct,ft,At];function vt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!vt(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 _t)if(!vt(t,e))return null}return`Expected ${bt(t)} but found ${bt(e)} instead.`}function xt(t,e){return e.some((e=>e.kind===t.kind))}function wt(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 St(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const kt=.96422,Zt=.82521,Bt=4/29,Gt=6/29,Rt=3*Gt*Gt,Vt=Gt*Gt*Gt,Tt=Math.PI/180,Wt=180/Math.PI;function Jt(t){return(t%=360)<0&&(t+=360),t}function zt([t,e,i,n]){let s,r;const o=Mt((.2225045*(t=Pt(t))+.7168786*(e=Pt(e))+.0606169*(i=Pt(i)))/1);t===e&&e===i?s=r=o:(s=Mt((.4360747*t+.3850649*e+.1430804*i)/kt),r=Mt((.0139322*t+.0971045*e+.7141733*i)/Zt));const a=116*o-16;return[a<0?0:a,500*(s-o),200*(o-r),n]}function Pt(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Mt(t){return t>Vt?Math.pow(t,1/3):t/Rt+Bt}function Xt([t,e,i,n]){let s=(t+16)/116,r=isNaN(e)?s:s+e/500,o=isNaN(i)?s:s-i/200;return s=1*Kt(s),r=kt*Kt(r),o=Zt*Kt(o),[Ft(3.1338561*r-1.6168667*s-.4906146*o),Ft(-.9787684*r+1.9161415*s+.033454*o),Ft(.0719453*r-.2289914*s+1.4052427*o),n]}function Ft(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function Kt(t){return t>Gt?t*t*t:Rt*(t-Bt)}function Ht(t){return parseInt(t.padEnd(2,t),16)/255}function Lt(t,e){return Et(e?t/100:t,0,1)}function Et(t,e,i){return Math.min(Math.max(e,t),i)}function Dt(t){return!t.some(Number.isNaN)}const Yt={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]};class Nt{constructor(t,e,i,n=1,s=!0){this.r=t,this.g=e,this.b=i,this.a=n,s||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[t,e,i,n]))}static parse(t){if(t instanceof Nt)return t;if("string"!=typeof t)return;const e=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];const e=Yt[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[Ht(t.slice(i,i+=e)),Ht(t.slice(i,i+=e)),Ht(t.slice(i,i+=e)),Ht(t.slice(i,i+e)||"ff")]}if(t.startsWith("rgb")){const e=t.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(e){const[t,i,n,s,r,o,a,l,c,g,h,u]=e,d=[s||" ",a||" ",g].join("");if(" "===d||" /"===d||",,"===d||",,,"===d){const t=[n,o,c].join(""),e="%%%"===t?100:""===t?255:0;if(e){const t=[Et(+i/e,0,1),Et(+r/e,0,1),Et(+l/e,0,1),h?Lt(+h,u):1];if(Dt(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,s,r,o,a,l,c]=i,g=[n||" ",r||" ",a].join("");if(" "===g||" /"===g||",,"===g||",,,"===g){const t=[+e,Et(+s,0,100),Et(+o,0,100),l?Lt(+l,c):1];if(Dt(t))return function([t,e,i,n]){function s(n){const s=(n+t/30)%12,r=e*Math.min(i,1-i);return i-r*Math.max(-1,Math.min(s-3,9-s,1))}return t=Jt(t),e/=100,i/=100,[s(0),s(8),s(4),n]}(t)}}}(t);return e?new Nt(...e,!1):void 0}get rgb(){const{r:t,g:e,b:i,a:n}=this,s=n||1/0;return this.overwriteGetter("rgb",[t/s,e/s,i/s,n])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,i,n,s]=zt(t),r=Math.sqrt(i*i+n*n);return[Math.round(1e4*r)?Jt(Math.atan2(n,i)*Wt):NaN,r,e,s]}(this.rgb))}get lab(){return this.overwriteGetter("lab",zt(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})`}}Nt.black=new Nt(0,0,0,1),Nt.white=new Nt(1,1,1,1),Nt.transparent=new Nt(0,0,0,0),Nt.red=new Nt(1,0,0,1);class Ot{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}}class Ut{constructor(t,e,i,n,s){this.text=t,this.image=e,this.scale=i,this.fontStack=n,this.textColor=s}}class jt{constructor(t){this.sections=t}static fromString(t){return new jt([new Ut(t,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 jt?t:jt.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}}class Qt{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Qt)return t;if("number"==typeof t)return new Qt([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 Qt(t)}}toString(){return JSON.stringify(this.values)}}const qt=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class $t{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof $t)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e=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 ie(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof Nt||t instanceof Ot||t instanceof jt||t instanceof Qt||t instanceof $t||t instanceof te)return!0;if(Array.isArray(t)){for(const e of t)if(!ie(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!ie(t[e]))return!1;return!0}return!1}function ne(t){if(null===t)return lt;if("string"==typeof t)return gt;if("boolean"==typeof t)return ht;if("number"==typeof t)return ct;if(t instanceof Nt)return ut;if(t instanceof Ot)return mt;if(t instanceof jt)return It;if(t instanceof Qt)return Ct;if(t instanceof $t)return At;if(t instanceof te)return ft;if(Array.isArray(t)){const e=t.length;let i;for(const e of t){const t=ne(e);if(i){if(i===t)continue;i=pt;break}i=t}return yt(i||pt,e)}return dt}function se(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof Nt||t instanceof jt||t instanceof Qt||t instanceof $t||t instanceof te?t.toString():JSON.stringify(t)}class re{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(!ie(t[1]))return e.error("invalid value");const i=t[1];let n=ne(i);const s=e.expectedType;return"array"!==n.kind||0!==n.N||!s||"array"!==s.kind||"number"==typeof s.N&&0!==s.N||(n=s),new re(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class oe{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const ae={string:gt,number:ct,boolean:ht,object:dt};class le{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 s=t[0];if("array"===s){let s,r;if(t.length>2){const i=t[1];if("string"!=typeof i||!(i in ae)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);s=ae[i],n++}else s=pt;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);r=t[2],n++}i=yt(s,r)}else{if(!ae[s])throw new Error(`Types doesn't contain name = ${s}`);i=ae[s]}const r=[];for(;nt.outputDefined()))}}const ce={"to-boolean":ht,"to-color":ut,"to-number":ct,"to-string":gt};class ge{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(!ce[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=ce[i],s=[];for(let i=1;i4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:ee(e[0],e[1],e[2],e[3]),!i))return new Nt(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new oe(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=Qt.parse(e);if(n)return n}throw new oe(`Could not parse padding 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=$t.parse(e);if(n)return n}throw new oe(`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 oe(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return jt.fromString(se(this.args[0].evaluate(t)));case"resolvedImage":return te.fromString(se(this.args[0].evaluate(t)));default:return se(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const he=["Unknown","Point","LineString","Polygon"];class ue{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},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?he[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[t];return e||(e=this._parseColorCache[t]=Nt.parse(t)),e}}class de{constructor(t,e,i=[],n,s=new at,r=[]){this.registry=t,this.path=i,this.key=i.map((t=>`[${t}]`)).join(""),this.scope=s,this.errors=r,this.expectedType=n,this._isConstant=e}parse(t,e,i,n,s={}){return e?this.concat(e,i,n)._parse(t,s):this._parse(t,s)}_parse(t,e){function i(t,e,i){return"assert"===i?new le(e,[t]):"coerce"===i?new ge(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 s=this.registry[n];if(s){let n=s.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,s=n.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==s.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==s.kind&&"string"!==s.kind)if("padding"!==t.kind||"value"!==s.kind&&"number"!==s.kind&&"array"!==s.kind)if("variableAnchorOffsetCollection"!==t.kind||"value"!==s.kind&&"array"!==s.kind){if(this.checkSubtype(t,s))return null}else n=i(n,t,e.typeAnnotation||"coerce");else n=i(n,t,e.typeAnnotation||"coerce");else n=i(n,t,e.typeAnnotation||"coerce");else n=i(n,t,e.typeAnnotation||"assert")}if(!(n instanceof re)&&"resolvedImage"!==n.type.kind&&this._isConstant(n)){const e=new ue;try{n=new re(n.type,n.evaluate(e))}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 this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,i){const n="number"==typeof t?this.path.concat(t):this.path,s=i?this.scope.concat(i):this.scope;return new de(this.registry,this._isConstant,n,e||null,s,this.errors)}error(t,...e){const i=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new ot(i,t))}checkSubtype(t,e){const i=vt(t,e);return i&&this.error(i),i}}class pe{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=i.length)throw new oe(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new oe(`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 Ce{constructor(t,e){this.type=ht,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,pt),n=e.parse(t[2],2,pt);return i&&n?xt(i.type,[ht,gt,ct,lt,pt])?new Ce(i,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${bt(i.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!wt(e,["boolean","string","number","null"]))throw new oe(`Expected first argument to be of type boolean, string, number or null, but found ${bt(ne(e))} instead.`);if(!wt(i,["string","array"]))throw new oe(`Expected second argument to be of type array or string, but found ${bt(ne(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class fe{constructor(t,e,i){this.type=ct,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,pt),n=e.parse(t[2],2,pt);if(!i||!n)return null;if(!xt(i.type,[ht,gt,ct,lt,pt]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${bt(i.type)} instead`);if(4===t.length){const s=e.parse(t[3],3,ct);return s?new fe(i,n,s):null}return new fe(i,n)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!wt(e,["boolean","string","number","null"]))throw new oe(`Expected first argument to be of type boolean, string, number or null, but found ${bt(ne(e))} instead.`);if(!wt(i,["string","array"]))throw new oe(`Expected second argument to be of type array or string, but found ${bt(ne(i))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(t);return i.indexOf(e,n)}return i.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Ae{constructor(t,e,i,n,s,r){this.inputType=t,this.type=e,this.input=i,this.cases=n,this.outputs=s,this.otherwise=r}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 s={},r=[];for(let o=2;oNumber.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return c.error("Numeric branch labels must be integer values.");if(i){if(c.checkSubtype(i,ne(t)))return null}else i=ne(t);if(void 0!==s[String(t)])return c.error("Branch labels must be unique.");s[String(t)]=r.length}const g=e.parse(l,o,n);if(!g)return null;n=n||g.type,r.push(g)}const o=e.parse(t[1],1,pt);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 Ae(i,n,o,s,r,a):null}evaluate(t){const e=this.input.evaluate(t);return(ne(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 ye{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 s=1;se.outputDefined()))&&this.otherwise.outputDefined()}}class be{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 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,pt),n=e.parse(t[2],2,ct);if(!i||!n)return null;if(!xt(i.type,[yt(pt),gt,pt]))return e.error(`Expected first argument to be of type array or string, but found ${bt(i.type)} instead`);if(4===t.length){const s=e.parse(t[3],3,ct);return s?new be(i.type,i,n,s):null}return new be(i.type,i,n)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);if(!wt(e,["string","array"]))throw new oe(`Expected first argument to be of type array or string, but found ${bt(ne(e))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(t);return e.slice(i,n)}return e.slice(i)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function _e(t,e){const i=t.length-1;let n,s,r=0,o=i,a=0;for(;r<=o;)if(a=Math.floor((r+o)/2),n=t[a],s=t[a+1],n<=e){if(a===i||ee))throw new oe("Input is not a number.");o=a-1}return 0}class ve{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,ct);if(!i)return null;const n=[];let s=null;e.expectedType&&"value"!==e.expectedType.kind&&(s=e.expectedType);for(let i=1;i=r)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const c=e.parse(o,l,s);if(!c)return null;s=s||c.type,n.push([r,c])}return new ve(s,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 s=e.length;return n>=e[s-1]?i[s-1].evaluate(t):i[_e(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 xe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var we=Se;function Se(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}Se.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 s=this.sampleCurveX(i)-t;if(Math.abs(s)s?o=i:a=i,i=.5*(a-o)+o;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var ke=xe(we);function Ze(t,e,i){return t+i*(e-t)}function Be(t,e,i){return t.map(((t,n)=>Ze(t,e[n],i)))}const Ge={number:Ze,color:function(t,e,i,n="rgb"){switch(n){case"rgb":{const[n,s,r,o]=Be(t.rgb,e.rgb,i);return new Nt(n,s,r,o,!1)}case"hcl":{const[n,s,r,o]=t.hcl,[a,l,c,g]=e.hcl;let h,u;if(isNaN(n)||isNaN(a))isNaN(n)?isNaN(a)?h=NaN:(h=a,1!==r&&0!==r||(u=l)):(h=n,1!==c&&0!==c||(u=s));else{let t=a-n;a>n&&t>180?t-=360:a180&&(t+=360),h=n+i*t}const[d,p,m,I]=function([t,e,i,n]){return t=isNaN(t)?0:t*Tt,Xt([i,Math.cos(t)*e,Math.sin(t)*e,n])}([h,null!=u?u:Ze(s,l,i),Ze(r,c,i),Ze(o,g,i)]);return new Nt(d,p,m,I,!1)}case"lab":{const[n,s,r,o]=Xt(Be(t.lab,e.lab,i));return new Nt(n,s,r,o,!1)}}},array:Be,padding:function(t,e,i){return new Qt(Be(t.values,e.values,i))},variableAnchorOffsetCollection:function(t,e,i){const n=t.values,s=e.values;if(n.length!==s.length)throw new oe(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);const r=[];for(let t=0;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(s=e.parse(s,2,ct),!s)return null;const o=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=ut:e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType);for(let t=0;t=i)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',s);const c=e.parse(n,l,a);if(!c)return null;a=a||c.type,o.push([i,c])}return St(a,ct)||St(a,ut)||St(a,Ct)||St(a,At)||St(a,yt(ct))?new Re(a,i,n,s,o):e.error(`Type ${bt(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 s=e.length;if(n>=e[s-1])return i[s-1].evaluate(t);const r=_e(e,n),o=Re.interpolationFactor(this.interpolation,n,e[r],e[r+1]),a=i[r].evaluate(t),l=i[r+1].evaluate(t);switch(this.operator){case"interpolate":return Ge[this.type.kind](a,l,o);case"interpolate-hcl":return Ge.color(a,l,o,"hcl");case"interpolate-lab":return Ge.color(a,l,o,"lab")}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Ve(t,e,i,n){const s=n-i,r=t-i;return 0===s?0:1===e?r/s:(Math.pow(e,r)-1)/(Math.pow(e,s)-1)}class Te{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expectected at least one argument.");let i=null;const n=e.expectedType;n&&"value"!==n.kind&&(i=n);const s=[];for(const n of t.slice(1)){const t=e.parse(n,1+s.length,i,void 0,{typeAnnotation:"omit"});if(!t)return null;i=i||t.type,s.push(t)}if(!i)throw new Error("No output type");const r=n&&s.some((t=>vt(n,t.type)));return new Te(r?pt:i,s)}evaluate(t){let e,i=null,n=0;for(const s of this.args)if(n++,i=s.evaluate(t),i&&i instanceof te&&!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 We(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 Je(t,e,i,n){return 0===n.compare(e,i)}function ze(t,e,i){const n="=="!==t&&"!="!==t;return class s{constructor(t,e,i){this.type=ht,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 r=e.parse(t[1],1,pt);if(!r)return null;if(!We(i,r.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${bt(r.type)}'.`);let o=e.parse(t[2],2,pt);if(!o)return null;if(!We(i,o.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${bt(o.type)}'.`);if(r.type.kind!==o.type.kind&&"value"!==r.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${bt(r.type)}' and '${bt(o.type)}'.`);n&&("value"===r.type.kind&&"value"!==o.type.kind?r=new le(o.type,[r]):"value"!==r.type.kind&&"value"===o.type.kind&&(o=new le(r.type,[o])));let a=null;if(4===t.length){if("string"!==r.type.kind&&"string"!==o.type.kind&&"value"!==r.type.kind&&"value"!==o.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,mt),!a)return null}return new s(r,o,a)}evaluate(s){const r=this.lhs.evaluate(s),o=this.rhs.evaluate(s);if(n&&this.hasUntypedArgument){const e=ne(r),i=ne(o);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new oe(`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=ne(r),i=ne(o);if("string"!==t.kind||"string"!==i.kind)return e(s,r,o)}return this.collator?i(s,r,o,this.collator.evaluate(s)):e(s,r,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const Pe=ze("==",(function(t,e,i){return e===i}),Je),Me=ze("!=",(function(t,e,i){return e!==i}),(function(t,e,i,n){return!Je(0,e,i,n)})),Xe=ze("<",(function(t,e,i){return e",(function(t,e,i){return e>i}),(function(t,e,i,n){return n.compare(e,i)>0})),Ke=ze("<=",(function(t,e,i){return e<=i}),(function(t,e,i,n){return n.compare(e,i)<=0})),He=ze(">=",(function(t,e,i){return e>=i}),(function(t,e,i,n){return n.compare(e,i)>=0}));class Le{constructor(t,e,i){this.type=mt,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,ht);if(!n)return null;const s=e.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,ht);if(!s)return null;let r=null;return i.locale&&(r=e.parse(i.locale,1,gt),!r)?null:new Le(n,s,r)}evaluate(t){return new Ot(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 Ee{constructor(t,e,i,n,s){this.type=gt,this.number=t,this.locale=e,this.currency=i,this.minFractionDigits=n,this.maxFractionDigits=s}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,ct);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 s=null;if(n.locale&&(s=e.parse(n.locale,1,gt),!s))return null;let r=null;if(n.currency&&(r=e.parse(n.currency,1,gt),!r))return null;let o=null;if(n["min-fraction-digits"]&&(o=e.parse(n["min-fraction-digits"],1,ct),!o))return null;let a=null;return n["max-fraction-digits"]&&(a=e.parse(n["max-fraction-digits"],1,ct),!a)?null:new Ee(i,s,r,o,a)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.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.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class De{constructor(t){this.type=It,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 s=!1;for(let i=1;i<=t.length-1;++i){const r=t[i];if(s&&"object"==typeof r&&!Array.isArray(r)){s=!1;let t=null;if(r["font-scale"]&&(t=e.parse(r["font-scale"],1,ct),!t))return null;let i=null;if(r["text-font"]&&(i=e.parse(r["text-font"],1,yt(gt)),!i))return null;let o=null;if(r["text-color"]&&(o=e.parse(r["text-color"],1,ut),!o))return null;const a=n[n.length-1];a.scale=t,a.font=i,a.textColor=o}else{const r=e.parse(t[i],1,pt);if(!r)return null;const o=r.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");s=!0,n.push({content:r,scale:null,font:null,textColor:null})}}return new De(n)}evaluate(t){return new jt(this.sections.map((e=>{const i=e.content.evaluate(t);return ne(i)===ft?new Ut("",i,null,null,null):new Ut(se(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.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)}outputDefined(){return!1}}class Ye{constructor(t){this.type=ft,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,gt);return i?new Ye(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=te.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}}class Ne{constructor(t){this.type=ct,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 ${bt(i.type)} instead.`):new Ne(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 oe(`Expected value to be of type string or array, but found ${bt(ne(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const Oe=8192;function Ue(t,e){const i=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,s=Math.pow(2,e.z);return[Math.round(i*s*Oe),Math.round(n*s*Oe)]}function je(t,e){const i=Math.pow(2,e.z);return[(s=(t[0]/Oe+e.x)/i,360*s-180),(n=(t[1]/Oe+e.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180))-90)];var n,s}function Qe(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 qe(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function $e(t,e,i){const n=t[0]-e[0],s=t[1]-e[1],r=t[0]-i[0],o=t[1]-i[1];return n*o-r*s==0&&n*r<=0&&s*o<=0}function ti(t,e,i,n){return 0!=(s=[n[0]-i[0],n[1]-i[1]])[0]*(r=[e[0]-t[0],e[1]-t[1]])[1]-s[1]*r[0]&&!(!oi(t,e,i,n)||!oi(i,n,t,e));var s,r}function ei(t,e,i){for(const n of i)for(let i=0;i(s=t)[1]!=(o=a[e+1])[1]>s[1]&&s[0]<(o[0]-r[0])*(s[1]-r[1])/(o[1]-r[1])+r[0]&&(n=!n)}var s,r,o;return n}function ni(t,e){for(const i of e)if(ii(t,i))return!0;return!1}function si(t,e){for(const i of t)if(!ii(i,e))return!1;for(let i=0;i0&&a<0||o<0&&a>0}function ai(t,e,i){const n=[];for(let s=0;si[2]){const e=.5*n;let s=t[0]-i[0]>e?-n:i[0]-t[0]>e?n:0;0===s&&(s=t[0]-i[2]>e?-n:i[2]-t[0]>e?n:0),t[0]+=s}Qe(e,t)}function gi(t,e,i,n){const s=Math.pow(2,n.z)*Oe,r=[n.x*Oe,n.y*Oe],o=[];for(const n of t)for(const t of n){const n=[t.x+r[0],t.y+r[1]];ci(n,e,i,s),o.push(n)}return o}function hi(t,e,i,n){const s=Math.pow(2,n.z)*Oe,r=[n.x*Oe,n.y*Oe],o=[];for(const i of t){const t=[];for(const n of i){const i=[n.x+r[0],n.y+r[1]];Qe(e,i),t.push(i)}o.push(t)}if(e[2]-e[0]<=s/2){(a=e)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const t of o)for(const n of t)ci(n,e,i,s)}var a;return o}class ui{constructor(t,e){this.type=ht,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(ie(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 ui(e,{type:"MultiPolygon",coordinates:t})}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new ui(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new ui(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],s=t.canonicalID();if("Polygon"===e.type){const r=ai(e.coordinates,n,s),o=gi(t.geometry(),i,n,s);if(!qe(i,n))return!1;for(const t of o)if(!ii(t,r))return!1}if("MultiPolygon"===e.type){const r=li(e.coordinates,n,s),o=gi(t.geometry(),i,n,s);if(!qe(i,n))return!1;for(const t of o)if(!ni(t,r))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],s=t.canonicalID();if("Polygon"===e.type){const r=ai(e.coordinates,n,s),o=hi(t.geometry(),i,n,s);if(!qe(i,n))return!1;for(const t of o)if(!si(t,r))return!1}if("MultiPolygon"===e.type){const r=li(e.coordinates,n,s),o=hi(t.geometry(),i,n,s);if(!qe(i,n))return!1;for(const t of o)if(!ri(t,r))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let di=class{constructor(t=[],e=pi){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.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,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 s=t-1>>1,r=e[s];if(i(n,r)>=0)break;e[t]=r,t=s}e[t]=n}_down(t){const{data:e,compare:i}=this,n=this.length>>1,s=e[t];for(;t=0)break;e[t]=r,t=n}e[t]=s}};function pi(t,e){return te?1:0}function mi(t,e,i,n,s){Ii(t,e,i,n||t.length-1,s||fi)}function Ii(t,e,i,n,s){for(;n>i;){if(n-i>600){var r=n-i+1,o=e-i+1,a=Math.log(r),l=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*l*(r-l)/r)*(o-r/2<0?-1:1);Ii(t,e,Math.max(i,Math.floor(e-o*l/r+c)),Math.min(n,Math.floor(e+(r-o)*l/r+c)),s)}var g=t[e],h=i,u=n;for(Ci(t,i,e),s(t[n],g)>0&&Ci(t,i,n);h0;)u--}0===s(t[i],g)?Ci(t,i,u):Ci(t,++u,n),u<=e&&(i=u+1),e<=u&&(n=u-1)}}function Ci(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function fi(t,e){return te?1:0}function Ai(t,e){if(t.length<=1)return[t];const i=[];let n,s;for(const e of t){const t=bi(e);0!==t&&(e.area=Math.abs(t),void 0===s&&(s=t<0),s===t<0?(n&&i.push(n),n=[e]):n.push(e))}if(n&&i.push(n),e>1)for(let t=0;t1?(l=t[a+1][0],c=t[a+1][1]):u>0&&(l+=g/this.kx*u,c+=h/this.ky*u)),g=this.wrap(e[0]-l)*this.kx,h=(e[1]-c)*this.ky;const d=g*g+h*h;d180;)t-=360;return t}}function Si(t,e){return e[0]-t[0]}function ki(t){return t[1]-t[0]+1}function Zi(t,e){return t[1]>=t[0]&&t[1]t[1])return[null,null];const i=ki(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 Gi(t,e){if(!Zi(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)Qe(i,t[n]);return i}function Ri(t){const e=[1/0,1/0,-1/0,-1/0];for(const i of t)for(const t of i)Qe(e,t);return e}function Vi(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function Ti(t,e,i){if(!Vi(t)||!Vi(e))return NaN;let n=0,s=0;return t[2]e[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(s=t[1]-e[3]),t[3]=n)return n;if(qe(s,r)){if(Fi(t,e))return 0}else if(Fi(e,t))return 0;let o=1/0;for(const n of t)for(let t=0,s=n.length,r=s-1;t0;){const s=o.pop();if(s[0]>=r)continue;const l=s[1],c=e?50:100;if(ki(l)<=c){if(!Zi(l,t.length))return NaN;if(e){const e=Xi(t,l,i,n);if(isNaN(e)||0===e)return e;r=Math.min(r,e)}else for(let e=l[0];e<=l[1];++e){const s=Mi(t[e],i,n);if(r=Math.min(r,s),0===r)return 0}}else{const i=Bi(l,e);Hi(o,r,n,t,a,i[0]),Hi(o,r,n,t,a,i[1])}}return r}function Di(t,e,i,n,s,r=1/0){let o=Math.min(r,s.distance(t[0],i[0]));if(0===o)return o;const a=new di([[0,[0,t.length-1],[0,i.length-1]]],Si);for(;a.length>0;){const r=a.pop();if(r[0]>=o)continue;const l=r[1],c=r[2],g=e?50:100,h=n?50:100;if(ki(l)<=g&&ki(c)<=h){if(!Zi(l,t.length)&&Zi(c,i.length))return NaN;let r;if(e&&n)r=zi(t,l,i,c,s),o=Math.min(o,r);else if(e&&!n){const e=t.slice(l[0],l[1]+1);for(let t=c[0];t<=c[1];++t)if(r=Wi(i[t],e,s),o=Math.min(o,r),0===o)return o}else if(!e&&n){const e=i.slice(c[0],c[1]+1);for(let i=l[0];i<=l[1];++i)if(r=Wi(t[i],e,s),o=Math.min(o,r),0===o)return o}else r=Pi(t,l,i,c,s),o=Math.min(o,r)}else{const r=Bi(l,e),g=Bi(c,n);Li(a,o,s,t,i,r[0],g[0]),Li(a,o,s,t,i,r[0],g[1]),Li(a,o,s,t,i,r[1],g[0]),Li(a,o,s,t,i,r[1],g[1])}}return o}function Yi(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 Ni{constructor(t,e){this.type=ct,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(ie(t[1])){const e=t[1];if("FeatureCollection"===e.type)return new Ni(e,e.features.map((t=>Yi(t.geometry))).flat());if("Feature"===e.type)return new Ni(e,Yi(e.geometry));if("type"in e&&"coordinates"in e)return new Ni(e,Yi(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=>je([e.x,e.y],t.canonical)));if(0===i.length)return NaN;const s=new wi(n[0][1]);let r=1/0;for(const t of e){switch(t.type){case"Point":r=Math.min(r,Di(n,!1,[t.coordinates],!1,s,r));break;case"LineString":r=Math.min(r,Di(n,!1,t.coordinates,!0,s,r));break;case"Polygon":r=Math.min(r,Ei(n,!1,t.coordinates,s,r))}if(0===r)return r}return r}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=t.geometry(),n=i.flat().map((e=>je([e.x,e.y],t.canonical)));if(0===i.length)return NaN;const s=new wi(n[0][1]);let r=1/0;for(const t of e){switch(t.type){case"Point":r=Math.min(r,Di(n,!0,[t.coordinates],!1,s,r));break;case"LineString":r=Math.min(r,Di(n,!0,t.coordinates,!0,s,r));break;case"Polygon":r=Math.min(r,Ei(n,!0,t.coordinates,s,r))}if(0===r)return r}return r}(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=Ai(i,0).map((e=>e.map((e=>e.map((e=>je([e.x,e.y],t.canonical))))))),s=new wi(n[0][0][0][1]);let r=1/0;for(const t of e)for(const e of n){switch(t.type){case"Point":r=Math.min(r,Ei([t.coordinates],!1,e,s,r));break;case"LineString":r=Math.min(r,Ei(t.coordinates,!0,e,s,r));break;case"Polygon":r=Math.min(r,Ki(e,t.coordinates,s,r))}if(0===r)return r}return r}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const Oi={"==":Pe,"!=":Me,">":Fe,"<":Xe,">=":He,"<=":Ke,array:le,at:Ie,boolean:le,case:ye,coalesce:Te,collator:Le,format:De,image:Ye,in:Ce,"index-of":fe,interpolate:Re,"interpolate-hcl":Re,"interpolate-lab":Re,length:Ne,let:pe,literal:re,match:Ae,number:le,"number-format":Ee,object:le,slice:be,step:ve,string:le,"to-boolean":ge,"to-color":ge,"to-number":ge,"to-string":ge,var:me,within:ui,distance:Ni};class Ui{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=Ui.definitions[i];if(!n)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const s=Array.isArray(n)?n[0]:n.type,r=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,o=r.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let a=null;for(const[n,r]of o){a=new de(e.registry,tn,e.path,null,e.scope);const o=[];let l=!1;for(let e=1;e{return e=t,Array.isArray(e)?`(${e.map(bt).join(", ")})`:`(${bt(e.type)}...)`;var e})).join(" | "),n=[];for(let i=1;i{i=e?i&&tn(t):i&&t instanceof re})),!!i&&en(t)&&sn(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function en(t){if(t instanceof Ui){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 ui)return!1;if(t instanceof Ni)return!1;let e=!0;return t.eachChild((t=>{e&&!en(t)&&(e=!1)})),e}function nn(t){if(t instanceof Ui&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!nn(t)&&(e=!1)})),e}function sn(t,e){if(t instanceof Ui&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild((t=>{i&&!sn(t,e)&&(i=!1)})),i}function rn(t){return{result:"success",value:t}}function on(t){return{result:"error",value:t}}function an(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function ln(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function cn(t){return!!t.expression&&t.expression.interpolated}function gn(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function hn(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function un(t){return t}function dn(t,e){const i="color"===e.type,n=t.stops&&"object"==typeof t.stops[0][0],s=n||!(n||void 0!==t.property),r=t.type||(cn(e)?"exponential":"interval");if(i||"padding"===e.type){const n=i?Nt.parse:Qt.parse;(t=rt({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],n(t[1])]))),t.default=n(t.default?t.default:e.default)}if(t.colorSpace&&"rgb"!==(o=t.colorSpace)&&"hcl"!==o&&"lab"!==o)throw new Error(`Unknown color space: "${t.colorSpace}"`);var o;let a,l,c;if("exponential"===r)a=Cn;else if("interval"===r)a=In;else if("categorical"===r){a=mn,l=Object.create(null);for(const e of t.stops)l[e[0]]=e[1];c=typeof t.stops[0][0]}else{if("identity"!==r)throw new Error(`Unknown function type "${r}"`);a=fn}if(n){const i={},n=[];for(let e=0;et[0])),evaluate:({zoom:i},n)=>Cn({stops:s,base:t.base},e,i).evaluate(i,n)}}if(s){const i="exponential"===r?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:Re.interpolationFactor.bind(void 0,i),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:i})=>a(t,e,i,l,c)}}return{kind:"source",evaluate(i,n){const s=n&&n.properties?n.properties[t.property]:void 0;return void 0===s?pn(t.default,e.default):a(t,e,s,l,c)}}}function pn(t,e,i){return void 0!==t?t:void 0!==e?e:void 0!==i?i:void 0}function mn(t,e,i,n,s){return pn(typeof i===s?n[i]:void 0,t.default,e.default)}function In(t,e,i){if("number"!==gn(i))return pn(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[n-1][0])return t.stops[n-1][1];const s=_e(t.stops.map((t=>t[0])),i);return t.stops[s][1]}function Cn(t,e,i){const n=void 0!==t.base?t.base:1;if("number"!==gn(i))return pn(t.default,e.default);const s=t.stops.length;if(1===s)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[s-1][0])return t.stops[s-1][1];const r=_e(t.stops.map((t=>t[0])),i),o=function(t,e,i,n){const s=n-i,r=t-i;return 0===s?0:1===e?r/s:(Math.pow(e,r)-1)/(Math.pow(e,s)-1)}(i,n,t.stops[r][0],t.stops[r+1][0]),a=t.stops[r][1],l=t.stops[r+1][1],c=Ge[e.type]||un;return"function"==typeof a.evaluate?{evaluate(...e){const i=a.evaluate.apply(void 0,e),n=l.evaluate.apply(void 0,e);if(void 0!==i&&void 0!==n)return c(i,n,o,t.colorSpace)}}:c(a,l,o,t.colorSpace)}function fn(t,e,i){switch(e.type){case"color":i=Nt.parse(i);break;case"formatted":i=jt.fromString(i.toString());break;case"resolvedImage":i=te.fromString(i.toString());break;case"padding":i=Qt.parse(i);break;default:gn(i)===e.type||"enum"===e.type&&e.values[i]||(i=void 0)}return pn(i,t.default,e.default)}Ui.register(Oi,{error:[{kind:"error"},[gt],(t,[e])=>{throw new oe(e.evaluate(t))}],typeof:[gt,[pt],(t,[e])=>bt(ne(e.evaluate(t)))],"to-rgba":[yt(ct,4),[ut],(t,[e])=>{const[i,n,s,r]=e.evaluate(t).rgb;return[255*i,255*n,255*s,r]}],rgb:[ut,[ct,ct,ct],ji],rgba:[ut,[ct,ct,ct,ct],ji],has:{type:ht,overloads:[[[gt],(t,[e])=>Qi(e.evaluate(t),t.properties())],[[gt,dt],(t,[e,i])=>Qi(e.evaluate(t),i.evaluate(t))]]},get:{type:pt,overloads:[[[gt],(t,[e])=>qi(e.evaluate(t),t.properties())],[[gt,dt],(t,[e,i])=>qi(e.evaluate(t),i.evaluate(t))]]},"feature-state":[pt,[gt],(t,[e])=>qi(e.evaluate(t),t.featureState||{})],properties:[dt,[],t=>t.properties()],"geometry-type":[gt,[],t=>t.geometryType()],id:[pt,[],t=>t.id()],zoom:[ct,[],t=>t.globals.zoom],"heatmap-density":[ct,[],t=>t.globals.heatmapDensity||0],"line-progress":[ct,[],t=>t.globals.lineProgress||0],accumulated:[pt,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[ct,$i(ct),(t,e)=>{let i=0;for(const n of e)i+=n.evaluate(t);return i}],"*":[ct,$i(ct),(t,e)=>{let i=1;for(const n of e)i*=n.evaluate(t);return i}],"-":{type:ct,overloads:[[[ct,ct],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[ct],(t,[e])=>-e.evaluate(t)]]},"/":[ct,[ct,ct],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[ct,[ct,ct],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[ct,[],()=>Math.LN2],pi:[ct,[],()=>Math.PI],e:[ct,[],()=>Math.E],"^":[ct,[ct,ct],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[ct,[ct],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[ct,[ct],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[ct,[ct],(t,[e])=>Math.log(e.evaluate(t))],log2:[ct,[ct],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[ct,[ct],(t,[e])=>Math.sin(e.evaluate(t))],cos:[ct,[ct],(t,[e])=>Math.cos(e.evaluate(t))],tan:[ct,[ct],(t,[e])=>Math.tan(e.evaluate(t))],asin:[ct,[ct],(t,[e])=>Math.asin(e.evaluate(t))],acos:[ct,[ct],(t,[e])=>Math.acos(e.evaluate(t))],atan:[ct,[ct],(t,[e])=>Math.atan(e.evaluate(t))],min:[ct,$i(ct),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[ct,$i(ct),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[ct,[ct],(t,[e])=>Math.abs(e.evaluate(t))],round:[ct,[ct],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[ct,[ct],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[ct,[ct],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[ht,[gt,pt],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[ht,[pt],(t,[e])=>t.id()===e.value],"filter-type-==":[ht,[gt],(t,[e])=>t.geometryType()===e.value],"filter-<":[ht,[gt,pt],(t,[e,i])=>{const n=t.properties()[e.value],s=i.value;return typeof n==typeof s&&n{const i=t.id(),n=e.value;return typeof i==typeof n&&i":[ht,[gt,pt],(t,[e,i])=>{const n=t.properties()[e.value],s=i.value;return typeof n==typeof s&&n>s}],"filter-id->":[ht,[pt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[ht,[gt,pt],(t,[e,i])=>{const n=t.properties()[e.value],s=i.value;return typeof n==typeof s&&n<=s}],"filter-id-<=":[ht,[pt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[ht,[gt,pt],(t,[e,i])=>{const n=t.properties()[e.value],s=i.value;return typeof n==typeof s&&n>=s}],"filter-id->=":[ht,[pt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[ht,[pt],(t,[e])=>e.value in t.properties()],"filter-has-id":[ht,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[ht,[yt(gt)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[ht,[yt(pt)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[ht,[gt,yt(pt)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[ht,[gt,yt(pt)],(t,[e,i])=>function(t,e,i,n){for(;i<=n;){const s=i+n>>1;if(e[s]===t)return!0;e[s]>t?n=s-1:i=s+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:ht,overloads:[[[ht,ht],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[$i(ht),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:ht,overloads:[[[ht,ht],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[$i(ht),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[ht,[ht],(t,[e])=>!e.evaluate(t)],"is-supported-script":[ht,[gt],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[gt,[gt],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[gt,[gt],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[gt,$i(pt),(t,e)=>e.map((e=>se(e.evaluate(t)))).join("")],"resolved-locale":[gt,[mt],(t,[e])=>e.evaluate(t).resolvedLocale()]});class An{constructor(t,e){var i;this.expression=t,this._warningHistory={},this._evaluator=new ue,this._defaultValue=e?"color"===(i=e).type&&hn(i.default)?new Nt(0,0,0,0):"color"===i.type?Nt.parse(i.default)||null:"padding"===i.type?Qt.parse(i.default)||null:"variableAnchorOffsetCollection"===i.type?$t.parse(i.default)||null:void 0===i.default?null:i.default:null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,i,n,s,r){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=n,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=r,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,n,s,r){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=r||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 oe(`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 yn(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Oi}function bn(t,e){const i=new de(Oi,tn,[],e?function(t){const e={color:ut,string:gt,number:ct,enum:gt,boolean:ht,formatted:It,padding:Ct,resolvedImage:ft,variableAnchorOffsetCollection:At};return"array"===t.type?yt(e[t.value]||pt,t.length):e[t.type]}(e):void 0),n=i.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?rn(new An(n,e)):on(i.errors)}class _n{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!nn(e.expression)}evaluateWithoutErrorHandling(t,e,i,n,s,r){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,s,r)}evaluate(t,e,i,n,s,r){return this._styleExpression.evaluate(t,e,i,n,s,r)}}class vn{constructor(t,e,i,n){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!nn(e.expression),this.interpolationType=n}evaluateWithoutErrorHandling(t,e,i,n,s,r){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,s,r)}evaluate(t,e,i,n,s,r){return this._styleExpression.evaluate(t,e,i,n,s,r)}interpolationFactor(t,e,i){return this.interpolationType?Re.interpolationFactor(this.interpolationType,t,e,i):0}}function xn(t,e){const i=bn(t,e);if("error"===i.result)return i;const n=i.value.expression,s=en(n);if(!s&&!an(e))return on([new ot("","data expressions not supported")]);const r=sn(n,["zoom"]);if(!r&&!ln(e))return on([new ot("","zoom expressions not supported")]);const o=Sn(n);return o||r?o instanceof ot?on([o]):o instanceof Re&&!cn(e)?on([new ot("",'"interpolate" expressions cannot be used with this property')]):rn(o?new vn(s?"camera":"composite",i.value,o.labels,o instanceof Re?o.interpolation:void 0):new _n(s?"constant":"source",i.value)):on([new ot("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class wn{constructor(t,e){this._parameters=t,this._specification=e,rt(this,dn(this._parameters,this._specification))}static deserialize(t){return new wn(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Sn(t){let e=null;if(t instanceof pe)e=Sn(t.result);else if(t instanceof Te){for(const i of t.args)if(e=Sn(i),e)break}else(t instanceof ve||t instanceof Re)&&t.input instanceof Ui&&"zoom"===t.input.name&&(e=t);return e instanceof ot||t.eachChild((t=>{const i=Sn(t);i instanceof ot?e=i:!e&&i?e=new ot("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new ot("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function kn(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(!kn(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const Zn={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Bn(t){if(null==t)return{filter:()=>!0,needGeometry:!1};kn(t)||(t=Vn(t));const e=bn(t,Zn);if("error"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return{filter:(t,i,n)=>e.value.evaluate(t,i,{},n),needGeometry:Rn(t)}}function Gn(t,e){return te?1:0}function Rn(t){if(!Array.isArray(t))return!1;if("within"===t[0]||"distance"===t[0])return!0;for(let e=1;e"===e||"<="===e||">="===e?Tn(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map(Vn))):"all"===e?["all"].concat(t.slice(1).map(Vn)):"none"===e?["all"].concat(t.slice(1).map(Vn).map(zn)):"in"===e?Wn(t[1],t.slice(2)):"!in"===e?zn(Wn(t[1],t.slice(2))):"has"===e?Jn(t[1]):"!has"!==e||zn(Jn(t[1]));var i}function Tn(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 Wn(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(Gn)]]:["filter-in-small",t,["literal",e]]}}function Jn(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function zn(t){return["!",t]}function Pn(t){const e=typeof t;if("number"===e||"boolean"===e||"string"===e||null==t)return JSON.stringify(t);if(Array.isArray(t)){let e="[";for(const i of t)e+=`${Pn(i)},`;return`${e}]`}const i=Object.keys(t).sort();let n="{";for(let e=0;en.maximum?[new st(e,i,`${i} is greater than the maximum value ${n.maximum}`)]:[]}function Dn(t){const e=t.valueSpec,i=Fn(t.value.type);let n,s,r,o={};const a="categorical"!==i&&void 0===t.value.property,l=!a,c="array"===gn(t.value.stops)&&"array"===gn(t.value.stops[0])&&"object"===gn(t.value.stops[0][0]),g=Hn({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 st(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const n=t.value;return e=e.concat(Ln({key:t.key,value:n,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===gn(n)&&0===n.length&&e.push(new st(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&&g.push(new st(t.key,t.value,'missing required property "property"')),"identity"===i||t.value.stops||g.push(new st(t.key,t.value,'missing required property "stops"')),"exponential"===i&&t.valueSpec.expression&&!cn(t.valueSpec)&&g.push(new st(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!an(t.valueSpec)?g.push(new st(t.key,t.value,"property functions not supported")):a&&!ln(t.valueSpec)&&g.push(new st(t.key,t.value,"zoom functions not supported"))),"categorical"!==i&&!c||void 0!==t.value.property||g.push(new st(t.key,t.value,'"property" property is required')),g;function h(t){let i=[];const n=t.value,a=t.key;if("array"!==gn(n))return[new st(a,n,`array expected, ${gn(n)} found`)];if(2!==n.length)return[new st(a,n,`array length 2 expected, length ${n.length} found`)];if(c){if("object"!==gn(n[0]))return[new st(a,n,`object expected, ${gn(n[0])} found`)];if(void 0===n[0].zoom)return[new st(a,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new st(a,n,"object stop key must have value")];if(r&&r>Fn(n[0].zoom))return[new st(a,n[0].zoom,"stop zoom values must appear in ascending order")];Fn(n[0].zoom)!==r&&(r=Fn(n[0].zoom),s=void 0,o={}),i=i.concat(Hn({key:`${a}[0]`,value:n[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:En,value:u}}))}else i=i.concat(u({key:`${a}[0]`,value:n[0],valueSpec:{},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},n));return yn(Kn(n[1]))?i.concat([new st(`${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 u(t,r){const a=gn(t.value),l=Fn(t.value),c=null!==t.value?t.value:r;if(n){if(a!==n)return[new st(t.key,c,`${a} stop domain type must match previous stop domain type ${n}`)]}else n=a;if("number"!==a&&"string"!==a&&"boolean"!==a)return[new st(t.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==i){let n=`number expected, ${a} found`;return an(e)&&void 0===i&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new st(t.key,c,n)]}return"categorical"!==i||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===a&&void 0!==s&&lnew st(`${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 st(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&&!nn(i))return[new st(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!nn(i))return[new st(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!sn(i,["zoom","feature-state"]))return[new st(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!en(i))return[new st(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Nn(t){const e=t.key,i=t.value,n=t.valueSpec,s=[];return Array.isArray(n.values)?-1===n.values.indexOf(Fn(i))&&s.push(new st(e,i,`expected one of [${n.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(n.values).indexOf(Fn(i))&&s.push(new st(e,i,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(i)} found`)),s}function On(t){return kn(Kn(t.value))?Yn(rt({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Un(t)}function Un(t){const e=t.value,i=t.key;if("array"!==gn(e))return[new st(i,e,`array expected, ${gn(e)} found`)];const n=t.styleSpec;let s,r=[];if(e.length<1)return[new st(i,e,"filter array must have at least 1 element")];switch(r=r.concat(Nn({key:`${i}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),Fn(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===Fn(e[1])&&r.push(new st(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&r.push(new st(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(s=gn(e[1]),"string"!==s&&r.push(new st(`${i}[1]`,e[1],`string expected, ${s} found`)));for(let o=2;o{t in i&&e.push(new st(n,i[t],`"${t}" is prohibited for ref layers`))})),s.layers.forEach((e=>{Fn(e.id)===a&&(t=e)})),t?t.ref?e.push(new st(n,i.ref,"ref cannot reference another ref layer")):o=Fn(t.type):e.push(new st(n,i.ref,`ref layer "${a}" not found`))}else if("background"!==o)if(i.source){const t=s.sources&&s.sources[i.source],r=t&&Fn(t.type);t?"vector"===r&&"raster"===o?e.push(new st(n,i.source,`layer "${i.id}" requires a raster source`)):"raster-dem"!==r&&"hillshade"===o?e.push(new st(n,i.source,`layer "${i.id}" requires a raster-dem source`)):"raster"===r&&"raster"!==o?e.push(new st(n,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==r||i["source-layer"]?"raster-dem"===r&&"hillshade"!==o?e.push(new st(n,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==o||!i.paint||!i.paint["line-gradient"]||"geojson"===r&&t.lineMetrics||e.push(new st(n,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new st(n,i,`layer "${i.id}" must specify a "source-layer"`)):e.push(new st(n,i.source,`source "${i.source}" not found`))}else e.push(new st(n,i,'missing required property "source"'));return e=e.concat(Hn({key:n,value:i,valueSpec:r.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${n}.type`,value:i.type,valueSpec:r.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:i,objectKey:"type"}),filter:On,layout:t=>Hn({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>qn(rt({layerType:o},t))}}),paint:t=>Hn({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>Qn(rt({layerType:o},t))}})}})),e}function ts(t){const e=t.value,i=t.key,n=gn(e);return"string"!==n?[new st(i,e,`string expected, ${n} found`)]:[]}const es={promoteId:function({key:t,value:e}){if("string"===gn(e))return ts({key:t,value:e});{const i=[];for(const n in e)i.push(...ts({key:`${t}.${n}`,value:e[n]}));return i}}};function is(t){const e=t.value,i=t.key,n=t.styleSpec,s=t.style,r=t.validateSpec;if(!e.type)return[new st(i,e,'"type" is required')];const o=Fn(e.type);let a;switch(o){case"vector":case"raster":return a=Hn({key:i,value:e,valueSpec:n[`source_${o.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:es,validateSpec:r}),a;case"raster-dem":return a=function(t){var e;const i=null!==(e=t.sourceName)&&void 0!==e?e:"",n=t.value,s=t.styleSpec,r=s.source_raster_dem,o=t.style;let a=[];const l=gn(n);if(void 0===n)return a;if("object"!==l)return a.push(new st("source_raster_dem",n,`object expected, ${l} found`)),a;const c="custom"===Fn(n.encoding),g=["redFactor","greenFactor","blueFactor","baseShift"],h=t.value.encoding?`"${t.value.encoding}"`:"Default";for(const e in n)!c&&g.includes(e)?a.push(new st(e,n[e],`In "${i}": "${e}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):r[e]?a=a.concat(t.validateSpec({key:e,value:n[e],valueSpec:r[e],validateSpec:t.validateSpec,style:o,styleSpec:s})):a.push(new st(e,n[e],`unknown property "${e}"`));return a}({sourceName:i,value:e,style:t.style,styleSpec:n,validateSpec:r}),a;case"geojson":if(a=Hn({key:i,value:e,valueSpec:n.source_geojson,style:s,styleSpec:n,validateSpec:r,objectElementValidators:es}),e.cluster)for(const t in e.clusterProperties){const[n,s]=e.clusterProperties[t],o="string"==typeof n?[n,["accumulated"],["get",t]]:n;a.push(...Yn({key:`${i}.${t}.map`,value:s,validateSpec:r,expressionContext:"cluster-map"})),a.push(...Yn({key:`${i}.${t}.reduce`,value:o,validateSpec:r,expressionContext:"cluster-reduce"}))}return a;case"video":return Hn({key:i,value:e,valueSpec:n.source_video,style:s,validateSpec:r,styleSpec:n});case"image":return Hn({key:i,value:e,valueSpec:n.source_image,style:s,validateSpec:r,styleSpec:n});case"canvas":return[new st(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Nn({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:s,validateSpec:r,styleSpec:n})}}function ns(t){const e=t.value,i=t.styleSpec,n=i.light,s=t.style;let r=[];const o=gn(e);if(void 0===e)return r;if("object"!==o)return r=r.concat([new st("light",e,`object expected, ${o} found`)]),r;for(const o in e){const a=o.match(/^(.*)-transition$/);r=r.concat(a&&n[a[1]]&&n[a[1]].transition?t.validateSpec({key:o,value:e[o],valueSpec:i.transition,validateSpec:t.validateSpec,style:s,styleSpec:i}):n[o]?t.validateSpec({key:o,value:e[o],valueSpec:n[o],validateSpec:t.validateSpec,style:s,styleSpec:i}):[new st(o,e[o],`unknown property "${o}"`)])}return r}function ss(t){const e=t.value,i=t.styleSpec,n=i.sky,s=t.style,r=gn(e);if(void 0===e)return[];if("object"!==r)return[new st("sky",e,`object expected, ${r} found`)];let o=[];for(const r in e)o=o.concat(n[r]?t.validateSpec({key:r,value:e[r],valueSpec:n[r],style:s,styleSpec:i}):[new st(r,e[r],`unknown property "${r}"`)]);return o}function rs(t){const e=t.value,i=t.styleSpec,n=i.terrain,s=t.style;let r=[];const o=gn(e);if(void 0===e)return r;if("object"!==o)return r=r.concat([new st("terrain",e,`object expected, ${o} found`)]),r;for(const o in e)r=r.concat(n[o]?t.validateSpec({key:o,value:e[o],valueSpec:n[o],validateSpec:t.validateSpec,style:s,styleSpec:i}):[new st(o,e[o],`unknown property "${o}"`)]);return r}function os(t){let e=[];const i=t.value,n=t.key;if(Array.isArray(i)){const s=[],r=[];for(const o in i)i[o].id&&s.includes(i[o].id)&&e.push(new st(n,i,`all the sprites' ids must be unique, but ${i[o].id} is duplicated`)),s.push(i[o].id),i[o].url&&r.includes(i[o].url)&&e.push(new st(n,i,`all the sprites' URLs must be unique, but ${i[o].url} is duplicated`)),r.push(i[o].url),e=e.concat(Hn({key:`${n}[${o}]`,value:i[o],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return e}return ts({key:n,value:i})}const as={"*":()=>[],array:Ln,boolean:function(t){const e=t.value,i=t.key,n=gn(e);return"boolean"!==n?[new st(i,e,`boolean expected, ${n} found`)]:[]},number:En,color:function(t){const e=t.key,i=t.value,n=gn(i);return"string"!==n?[new st(e,i,`color expected, ${n} found`)]:Nt.parse(String(i))?[]:[new st(e,i,`color expected, "${i}" found`)]},constants:Xn,enum:Nn,filter:On,function:Dn,layer:$n,object:Hn,source:is,light:ns,sky:ss,terrain:rs,projection:function(t){const e=t.value,i=t.styleSpec,n=i.projection,s=t.style,r=gn(e);if(void 0===e)return[];if("object"!==r)return[new st("projection",e,`object expected, ${r} found`)];let o=[];for(const r in e)o=o.concat(n[r]?t.validateSpec({key:r,value:e[r],valueSpec:n[r],style:s,styleSpec:i}):[new st(r,e[r],`unknown property "${r}"`)]);return o},string:ts,formatted:function(t){return 0===ts(t).length?[]:Yn(t)},resolvedImage:function(t){return 0===ts(t).length?[]:Yn(t)},padding:function(t){const e=t.key,i=t.value;if("array"===gn(i)){if(i.length<1||i.length>4)return[new st(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];const n={type:"number"};let s=[];for(let r=0;r[]}})),t.constants&&(i=i.concat(Xn({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:ls}))),us(i)}function hs(t){return function(e){return t({...e,validateSpec:ls})}}function us(t){return[].concat(t).sort(((t,e)=>t.line-e.line))}function ds(t){return function(...e){return us(t.apply(this,e))}}gs.source=ds(hs(is)),gs.sprite=ds(hs(os)),gs.glyphs=ds(hs(cs)),gs.light=ds(hs(ns)),gs.sky=ds(hs(ss)),gs.terrain=ds(hs(rs)),gs.layer=ds(hs($n)),gs.filter=ds(hs(On)),gs.paintProperty=ds(hs(Qn)),gs.layoutProperty=ds(hs(qn));const ps=gs,ms=ps.light,Is=ps.sky,Cs=ps.paintProperty,fs=ps.layoutProperty;function As(t,e){let i=!1;if(e&&e.length)for(const n of e)t.fire(new E(new Error(n.message))),i=!0;return i}class ys{constructor(t,e,i){const n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const s=new Int32Array(this.arrayBuffer);t=s[0],this.d=(e=s[1])+2*(i=s[2]);for(let t=0;t=c[l+0]&&n>=c[l+1])?(o[h]=!0,r.push(s[h])):o[h]=!1}}}}_forEachCell(t,e,i,n,s,r,o,a){const l=this._convertToCellCoord(t),c=this._convertToCellCoord(e),g=this._convertToCellCoord(i),h=this._convertToCellCoord(n);for(let u=l;u<=g;u++)for(let l=c;l<=h;l++){const c=this.d*l+u;if((!a||a(this._convertFromCellCoord(u),this._convertFromCellCoord(l),this._convertFromCellCoord(u+1),this._convertFromCellCoord(l+1)))&&s.call(this,t,e,i,n,c,r,o,a))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,e=3+this.cells.length+1+1;let i=0;for(let t=0;t=0)continue;const r=t[n];s[n]=bs[i].shallow.indexOf(n)>=0?r:Ss(r,e)}t instanceof Error&&(s.message=t.message)}if(s.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==i&&(s.$name=i),s}function ks(t){if(ws(t))return t;if(Array.isArray(t))return t.map(ks);if("object"!=typeof t)throw new Error("can't deserialize object of type "+typeof t);const e=xs(t)||"Object";if(!bs[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:i}=bs[e];if(!i)throw new Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(t);const n=Object.create(i.prototype);for(const i of Object.keys(t)){if("$name"===i)continue;const s=t[i];n[i]=bs[e].shallow.indexOf(i)>=0?s:ks(s)}return n}class Zs{constructor(){this.first=!0}update(t,e){const i=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=e):this.lastFloorZoomt>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function Gs(t){for(const e of t)if(Ts(e.charCodeAt(0)))return!0;return!1}function Rs(t){for(const e of t)if(!Vs(e.charCodeAt(0)))return!1;return!0}function Vs(t){return!(Bs.Arabic(t)||Bs["Arabic Supplement"](t)||Bs["Arabic Extended-A"](t)||Bs["Arabic Presentation Forms-A"](t)||Bs["Arabic Presentation Forms-B"](t))}function Ts(t){return!(746!==t&&747!==t&&(t<4352||!(Bs["Bopomofo Extended"](t)||Bs.Bopomofo(t)||Bs["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||Bs["CJK Compatibility Ideographs"](t)||Bs["CJK Compatibility"](t)||Bs["CJK Radicals Supplement"](t)||Bs["CJK Strokes"](t)||!(!Bs["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Bs["CJK Unified Ideographs Extension A"](t)||Bs["CJK Unified Ideographs"](t)||Bs["Enclosed CJK Letters and Months"](t)||Bs["Hangul Compatibility Jamo"](t)||Bs["Hangul Jamo Extended-A"](t)||Bs["Hangul Jamo Extended-B"](t)||Bs["Hangul Jamo"](t)||Bs["Hangul Syllables"](t)||Bs.Hiragana(t)||Bs["Ideographic Description Characters"](t)||Bs.Kanbun(t)||Bs["Kangxi Radicals"](t)||Bs["Katakana Phonetic Extensions"](t)||Bs.Katakana(t)&&12540!==t||!(!Bs["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Bs["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Bs["Unified Canadian Aboriginal Syllabics"](t)||Bs["Unified Canadian Aboriginal Syllabics Extended"](t)||Bs["Vertical Forms"](t)||Bs["Yijing Hexagram Symbols"](t)||Bs["Yi Syllables"](t)||Bs["Yi Radicals"](t))))}function Ws(t){return!(Ts(t)||function(t){return!!(Bs["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||Bs["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||Bs["Letterlike Symbols"](t)||Bs["Number Forms"](t)||Bs["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||Bs["Control Pictures"](t)&&9251!==t||Bs["Optical Character Recognition"](t)||Bs["Enclosed Alphanumerics"](t)||Bs["Geometric Shapes"](t)||Bs["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Bs["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Bs["CJK Symbols and Punctuation"](t)||Bs.Katakana(t)||Bs["Private Use Area"](t)||Bs["CJK Compatibility Forms"](t)||Bs["Small Form Variants"](t)||Bs["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Js(t){return t>=1424&&t<=2303||Bs["Arabic Presentation Forms-A"](t)||Bs["Arabic Presentation Forms-B"](t)}function zs(t,e){return!(!e&&Js(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Bs.Khmer(t))}function Ps(t){for(const e of t)if(Js(e.charCodeAt(0)))return!0;return!1}const Ms=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText}isParsed(){return null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class Xs{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Zs,this.transition={})}isSupportedScript(t){return function(t,e){for(const i of t)if(!zs(i.charCodeAt(0),e))return!1;return!0}(t,"loaded"===Ms.getRTLTextPluginStatus())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),i=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*e}}}class Fs{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(hn(t))return new wn(t,e);if(yn(t)){const i=xn(t,e);if("error"===i.result)throw new Error(i.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return i.value}{let i=t;return"color"===e.type&&"string"==typeof t?i=Nt.parse(t):"padding"!==e.type||"number"!=typeof t&&!Array.isArray(t)?"variableAnchorOffsetCollection"===e.type&&Array.isArray(t)&&(i=$t.parse(t)):i=Qt.parse(t),{kind:"constant",evaluate:()=>i}}}(void 0===e?t.specification.default:e,t.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,i){return this.property.possiblyEvaluate(this,t,e,i)}}class Ks{constructor(t){this.property=t,this.value=new Fs(t,void 0)}transitioned(t,e){return new Ls(this.property,this.value,e,C({},t.transition,this.transition),t.now)}untransitioned(){return new Ls(this.property,this.value,null,{},0)}}class Hs{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return b(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Ks(this._values[t].property)),this._values[t].value=new Fs(this._values[t].property,null===e?void 0:b(e))}getTransition(t){return b(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Ks(this._values[t].property)),this._values[t].transition=b(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const i=this.getValue(e);void 0!==i&&(t[e]=i);const n=this.getTransition(e);void 0!==n&&(t[`${e}-transition`]=n)}return t}transitioned(t,e){const i=new Es(this._properties);for(const n of Object.keys(this._values))i._values[n]=this._values[n].transitioned(t,e._values[n]);return i}untransitioned(){const t=new Es(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class Ls{constructor(t,e,i,n,s){this.property=t,this.value=e,this.begin=s+n.delay||0,this.end=this.begin+n.duration||0,t.specification.transition&&(n.delay||n.duration)&&(this.prior=i)}possiblyEvaluate(t,e,i){const n=t.now||0,s=this.value.possiblyEvaluate(t,e,i),r=this.prior;if(r){if(n>this.end)return this.prior=null,s;if(this.value.isDataDriven())return this.prior=null,s;if(n=1)return 1;const e=t*t,i=e*t;return 4*(t<.5?i:3*(t-e)+i-.75)}(o))}}return s}}class Es{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,i){const n=new Ns(this._properties);for(const s of Object.keys(this._values))n._values[s]=this._values[s].possiblyEvaluate(t,e,i);return n}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Ds{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return void 0!==this._values[t].value}getValue(t){return b(this._values[t].value)}setValue(t,e){this._values[t]=new Fs(this._values[t].property,null===e?void 0:b(e))}serialize(){const t={};for(const e of Object.keys(this._values)){const i=this.getValue(e);void 0!==i&&(t[e]=i)}return t}possiblyEvaluate(t,e,i){const n=new Ns(this._properties);for(const s of Object.keys(this._values))n._values[s]=this._values[s].possiblyEvaluate(t,e,i);return n}}class Ys{constructor(t,e,i){this.property=t,this.value=e,this.parameters=i}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,e,i,n){return this.property.evaluate(this.value,this.parameters,t,e,i,n)}}class Ns{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Os{constructor(t){this.specification=t}possiblyEvaluate(t,e){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(e)}interpolate(t,e,i){const n=Ge[this.specification.type];return n?n(t,e,i):t}}class Us{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,i,n){return new Ys(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},i,n)}:t.expression,e)}interpolate(t,e,i){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new Ys(this,{kind:"constant",value:void 0},t.parameters);const n=Ge[this.specification.type];if(n){const s=n(t.value.value,e.value.value,i);return new Ys(this,{kind:"constant",value:s},t.parameters)}return t}evaluate(t,e,i,n,s,r){return"constant"===t.kind?t.value:t.evaluate(e,i,n,s,r)}}class js extends Us{possiblyEvaluate(t,e,i,n){if(void 0===t.value)return new Ys(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const s=t.expression.evaluate(e,null,{},i,n),r="resolvedImage"===t.property.specification.type&&"string"!=typeof s?s.name:s,o=this._calculate(r,r,r,e);return new Ys(this,{kind:"constant",value:o},e)}if("camera"===t.expression.kind){const i=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new Ys(this,{kind:"constant",value:i},e)}return new Ys(this,t.expression,e)}evaluate(t,e,i,n,s,r){if("source"===t.kind){const o=t.evaluate(e,i,n,s,r);return this._calculate(o,o,o,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},i,n),t.evaluate({zoom:Math.floor(e.zoom)},i,n),t.evaluate({zoom:Math.floor(e.zoom)+1},i,n),e):t.value}_calculate(t,e,i,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class Qs{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,n){if(void 0!==t.value){if("constant"===t.expression.kind){const s=t.expression.evaluate(e,null,{},i,n);return this._calculate(s,s,s,e)}return this._calculate(t.expression.evaluate(new Xs(Math.floor(e.zoom-1),e)),t.expression.evaluate(new Xs(Math.floor(e.zoom),e)),t.expression.evaluate(new Xs(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,i,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class qs{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,n){return!!t.expression.evaluate(e,null,{},i,n)}interpolate(){return!1}}class $s{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const i=t[e];i.specification.overridable&&this.overridableProperties.push(e);const n=this.defaultPropertyValues[e]=new Fs(i,void 0),s=this.defaultTransitionablePropertyValues[e]=new Ks(i);this.defaultTransitioningPropertyValues[e]=s.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({})}}}_s("DataDrivenProperty",Us),_s("DataConstantProperty",Os),_s("CrossFadedDataDrivenProperty",js),_s("CrossFadedProperty",Qs),_s("ColorRampProperty",qs);const tr="-transition";class er extends D{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==t.type&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),e.layout&&(this._unevaluatedLayout=new Ds(e.layout)),e.paint)){this._transitionablePaint=new Hs(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ns(e.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,i={}){null!=e&&this._validate(fs,`layers.${this.id}.layout.${t}`,t,e,i)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return t.endsWith(tr)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,i={}){if(null!=e&&this._validate(Cs,`layers.${this.id}.paint.${t}`,t,e,i))return!1;if(t.endsWith(tr))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{const i=this._transitionablePaint._values[t],n="cross-faded-data-driven"===i.property.specification["property-type"],s=i.value.isDataDriven(),r=i.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const o=this._transitionablePaint._values[t].value;return o.isDataDriven()||s||n||this._handleOverridablePaintPropertyUpdate(t,r,o)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,i){return!1}isHidden(t){return!!(this.minzoom&&t=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),y(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,i,n,s={}){return(!s||!1!==s.validate)&&As(this,t.call(ps,{key:e,layerType:this.type,objectKey:i,value:n,styleSpec:Y,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof Ys&&an(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}}const ir={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class nr{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class sr{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function rr(t,e=1){let i=0,n=0;return{members:t.map((t=>{const s=ir[t.type].BYTES_PER_ELEMENT,r=i=or(i,Math.max(e,s)),o=t.components||1;return n=Math.max(n,s),i+=s*o,{name:t.name,type:t.type,components:o,offset:r}})),size:or(i,Math.max(n,e)),alignment:e}}function or(t,e){return Math.ceil(t/e)*e}class ar extends sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const n=2*t;return this.int16[n+0]=e,this.int16[n+1]=i,t}}ar.prototype.bytesPerElement=4,_s("StructArrayLayout2i4",ar);class lr extends sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i)}emplace(t,e,i,n){const s=3*t;return this.int16[s+0]=e,this.int16[s+1]=i,this.int16[s+2]=n,t}}lr.prototype.bytesPerElement=6,_s("StructArrayLayout3i6",lr);class cr extends sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,i,n)}emplace(t,e,i,n,s){const r=4*t;return this.int16[r+0]=e,this.int16[r+1]=i,this.int16[r+2]=n,this.int16[r+3]=s,t}}cr.prototype.bytesPerElement=8,_s("StructArrayLayout4i8",cr);class gr extends sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,s,r){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,n,s,r)}emplace(t,e,i,n,s,r,o){const a=6*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.int16[a+2]=n,this.int16[a+3]=s,this.int16[a+4]=r,this.int16[a+5]=o,t}}gr.prototype.bytesPerElement=12,_s("StructArrayLayout2i4i12",gr);class hr extends sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,s,r){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,n,s,r)}emplace(t,e,i,n,s,r,o){const a=4*t,l=8*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.uint8[l+4]=n,this.uint8[l+5]=s,this.uint8[l+6]=r,this.uint8[l+7]=o,t}}hr.prototype.bytesPerElement=8,_s("StructArrayLayout2i4ub8",hr);class ur extends sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const n=2*t;return this.float32[n+0]=e,this.float32[n+1]=i,t}}ur.prototype.bytesPerElement=8,_s("StructArrayLayout2f8",ur);class dr extends sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,s,r,o,a,l,c){const g=this.length;return this.resize(g+1),this.emplace(g,t,e,i,n,s,r,o,a,l,c)}emplace(t,e,i,n,s,r,o,a,l,c,g){const h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=i,this.uint16[h+2]=n,this.uint16[h+3]=s,this.uint16[h+4]=r,this.uint16[h+5]=o,this.uint16[h+6]=a,this.uint16[h+7]=l,this.uint16[h+8]=c,this.uint16[h+9]=g,t}}dr.prototype.bytesPerElement=20,_s("StructArrayLayout10ui20",dr);class pr extends sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,s,r,o,a,l,c,g,h){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,i,n,s,r,o,a,l,c,g,h)}emplace(t,e,i,n,s,r,o,a,l,c,g,h,u){const d=12*t;return this.int16[d+0]=e,this.int16[d+1]=i,this.int16[d+2]=n,this.int16[d+3]=s,this.uint16[d+4]=r,this.uint16[d+5]=o,this.uint16[d+6]=a,this.uint16[d+7]=l,this.int16[d+8]=c,this.int16[d+9]=g,this.int16[d+10]=h,this.int16[d+11]=u,t}}pr.prototype.bytesPerElement=24,_s("StructArrayLayout4i4ui4i24",pr);class mr extends sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i)}emplace(t,e,i,n){const s=3*t;return this.float32[s+0]=e,this.float32[s+1]=i,this.float32[s+2]=n,t}}mr.prototype.bytesPerElement=12,_s("StructArrayLayout3f12",mr);class Ir extends sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}Ir.prototype.bytesPerElement=4,_s("StructArrayLayout1ul4",Ir);class Cr extends sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,s,r,o,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,i,n,s,r,o,a,l)}emplace(t,e,i,n,s,r,o,a,l,c){const g=10*t,h=5*t;return this.int16[g+0]=e,this.int16[g+1]=i,this.int16[g+2]=n,this.int16[g+3]=s,this.int16[g+4]=r,this.int16[g+5]=o,this.uint32[h+3]=a,this.uint16[g+8]=l,this.uint16[g+9]=c,t}}Cr.prototype.bytesPerElement=20,_s("StructArrayLayout6i1ul2ui20",Cr);class fr extends sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,s,r){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,n,s,r)}emplace(t,e,i,n,s,r,o){const a=6*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.int16[a+2]=n,this.int16[a+3]=s,this.int16[a+4]=r,this.int16[a+5]=o,t}}fr.prototype.bytesPerElement=12,_s("StructArrayLayout2i2i2i12",fr);class Ar extends sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,s){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i,n,s)}emplace(t,e,i,n,s,r){const o=4*t,a=8*t;return this.float32[o+0]=e,this.float32[o+1]=i,this.float32[o+2]=n,this.int16[a+6]=s,this.int16[a+7]=r,t}}Ar.prototype.bytesPerElement=16,_s("StructArrayLayout2f1f2i16",Ar);class yr extends sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,s,r){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,n,s,r)}emplace(t,e,i,n,s,r,o){const a=16*t,l=4*t,c=8*t;return this.uint8[a+0]=e,this.uint8[a+1]=i,this.float32[l+1]=n,this.float32[l+2]=s,this.int16[c+6]=r,this.int16[c+7]=o,t}}yr.prototype.bytesPerElement=16,_s("StructArrayLayout2ub2f2i16",yr);class br extends sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i)}emplace(t,e,i,n){const s=3*t;return this.uint16[s+0]=e,this.uint16[s+1]=i,this.uint16[s+2]=n,t}}br.prototype.bytesPerElement=6,_s("StructArrayLayout3ui6",br);class _r extends sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,n,s,r,o,a,l,c,g,h,u,d,p,m,I){const C=this.length;return this.resize(C+1),this.emplace(C,t,e,i,n,s,r,o,a,l,c,g,h,u,d,p,m,I)}emplace(t,e,i,n,s,r,o,a,l,c,g,h,u,d,p,m,I,C){const f=24*t,A=12*t,y=48*t;return this.int16[f+0]=e,this.int16[f+1]=i,this.uint16[f+2]=n,this.uint16[f+3]=s,this.uint32[A+2]=r,this.uint32[A+3]=o,this.uint32[A+4]=a,this.uint16[f+10]=l,this.uint16[f+11]=c,this.uint16[f+12]=g,this.float32[A+7]=h,this.float32[A+8]=u,this.uint8[y+36]=d,this.uint8[y+37]=p,this.uint8[y+38]=m,this.uint32[A+10]=I,this.int16[f+22]=C,t}}_r.prototype.bytesPerElement=48,_s("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",_r);class vr extends sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,n,s,r,o,a,l,c,g,h,u,d,p,m,I,C,f,A,y,b,_,v,x,w,S,k){const Z=this.length;return this.resize(Z+1),this.emplace(Z,t,e,i,n,s,r,o,a,l,c,g,h,u,d,p,m,I,C,f,A,y,b,_,v,x,w,S,k)}emplace(t,e,i,n,s,r,o,a,l,c,g,h,u,d,p,m,I,C,f,A,y,b,_,v,x,w,S,k,Z){const B=32*t,G=16*t;return this.int16[B+0]=e,this.int16[B+1]=i,this.int16[B+2]=n,this.int16[B+3]=s,this.int16[B+4]=r,this.int16[B+5]=o,this.int16[B+6]=a,this.int16[B+7]=l,this.uint16[B+8]=c,this.uint16[B+9]=g,this.uint16[B+10]=h,this.uint16[B+11]=u,this.uint16[B+12]=d,this.uint16[B+13]=p,this.uint16[B+14]=m,this.uint16[B+15]=I,this.uint16[B+16]=C,this.uint16[B+17]=f,this.uint16[B+18]=A,this.uint16[B+19]=y,this.uint16[B+20]=b,this.uint16[B+21]=_,this.uint16[B+22]=v,this.uint32[G+12]=x,this.float32[G+13]=w,this.float32[G+14]=S,this.uint16[B+30]=k,this.uint16[B+31]=Z,t}}vr.prototype.bytesPerElement=64,_s("StructArrayLayout8i15ui1ul2f2ui64",vr);class xr extends sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}xr.prototype.bytesPerElement=4,_s("StructArrayLayout1f4",xr);class wr extends sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i)}emplace(t,e,i,n){const s=3*t;return this.uint16[6*t+0]=e,this.float32[s+1]=i,this.float32[s+2]=n,t}}wr.prototype.bytesPerElement=12,_s("StructArrayLayout1ui2f12",wr);class Sr extends sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i)}emplace(t,e,i,n){const s=4*t;return this.uint32[2*t+0]=e,this.uint16[s+2]=i,this.uint16[s+3]=n,t}}Sr.prototype.bytesPerElement=8,_s("StructArrayLayout1ul2ui8",Sr);class kr extends sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=i,t}}kr.prototype.bytesPerElement=4,_s("StructArrayLayout2ui4",kr);class Zr extends sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}Zr.prototype.bytesPerElement=2,_s("StructArrayLayout1ui2",Zr);class Br extends sr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,n){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,i,n)}emplace(t,e,i,n,s){const r=4*t;return this.float32[r+0]=e,this.float32[r+1]=i,this.float32[r+2]=n,this.float32[r+3]=s,t}}Br.prototype.bytesPerElement=16,_s("StructArrayLayout4f16",Br);class Gr extends nr{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new r(this.anchorPointX,this.anchorPointY)}}Gr.prototype.size=20;class Rr extends Cr{get(t){return new Gr(this,t)}}_s("CollisionBoxArray",Rr);class Vr extends nr{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Vr.prototype.size=48;class Tr extends _r{get(t){return new Vr(this,t)}}_s("PlacedSymbolArray",Tr);class Wr extends nr{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}Wr.prototype.size=64;class Jr extends vr{get(t){return new Wr(this,t)}}_s("SymbolInstanceArray",Jr);class zr extends xr{getoffsetX(t){return this.float32[1*t+0]}}_s("GlyphOffsetArray",zr);class Pr extends lr{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}_s("SymbolLineVertexArray",Pr);class Mr extends nr{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}Mr.prototype.size=12;class Xr extends wr{get(t){return new Mr(this,t)}}_s("TextAnchorOffsetArray",Xr);class Fr extends nr{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}Fr.prototype.size=8;class Kr extends Sr{get(t){return new Fr(this,t)}}_s("FeatureIndexArray",Kr);class Hr extends ar{}class Lr extends ar{}class Er extends ar{}class Dr extends gr{}class Yr extends hr{}class Nr extends ur{}class Or extends dr{}class Ur extends pr{}class jr extends mr{}class Qr extends Ir{}class qr extends fr{}class $r extends yr{}class to extends br{}class eo extends kr{}const io=rr([{name:"a_pos",components:2,type:"Int16"}],4),{members:no}=io;class so{constructor(t=[]){this.segments=t}prepareSegment(t,e,i,n){let s=this.segments[this.segments.length-1];return t>so.MAX_VERTEX_ARRAY_LENGTH&&v(`Max vertices per segment is ${so.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!s||s.vertexLength+t>so.MAX_VERTEX_ARRAY_LENGTH||s.sortKey!==n)&&(s={vertexOffset:e.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0},void 0!==n&&(s.sortKey=n),this.segments.push(s)),s}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,i,n){return new so([{vertexOffset:t,primitiveOffset:e,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}}function ro(t,e){return 256*(t=m(Math.floor(t),0,255))+m(Math.floor(e),0,255)}so.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,_s("SegmentVector",so);const oo=rr([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var ao={exports:{}},lo={exports:{}};lo.exports=function(t,e){var i,n,s,r,o,a,l,c;for(n=t.length-(i=3&t.length),s=e,o=3432918353,a=461845907,c=0;c>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|s>>>19))+((5*(s>>>16)&65535)<<16)&4294967295))+((58964+(r>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&t.charCodeAt(c+2))<<16;case 2:l^=(255&t.charCodeAt(c+1))<<8;case 1:s^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(c)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return s^=t.length,s=2246822507*(65535&(s^=s>>>16))+((2246822507*(s>>>16)&65535)<<16)&4294967295,s=3266489909*(65535&(s^=s>>>13))+((3266489909*(s>>>16)&65535)<<16)&4294967295,(s^=s>>>16)>>>0};var co=lo.exports,go={exports:{}};go.exports=function(t,e){for(var i,n=t.length,s=e^n,r=0;n>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(r)|(255&t.charCodeAt(++r))<<8|(255&t.charCodeAt(++r))<<16|(255&t.charCodeAt(++r))<<24))+((1540483477*(i>>>16)&65535)<<16),s=1540483477*(65535&s)+((1540483477*(s>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),n-=4,++r;switch(n){case 3:s^=(255&t.charCodeAt(r+2))<<16;case 2:s^=(255&t.charCodeAt(r+1))<<8;case 1:s=1540483477*(65535&(s^=255&t.charCodeAt(r)))+((1540483477*(s>>>16)&65535)<<16)}return s=1540483477*(65535&(s^=s>>>13))+((1540483477*(s>>>16)&65535)<<16),(s^=s>>>15)>>>0};var ho=co,uo=go.exports;ao.exports=ho,ao.exports.murmur3=ho,ao.exports.murmur2=uo;var po=i(ao.exports);class mo{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,i,n){this.ids.push(Io(t)),this.positions.push(e,i,n)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const e=Io(t);let i=0,n=this.ids.length-1;for(;i>1;this.ids[t]>=e?n=t:i=t+1}const s=[];for(;this.ids[i]===e;)s.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return s}static serialize(t,e){const i=new Float64Array(t.ids),n=new Uint32Array(t.positions);return Co(i,n,0,i.length-1),e&&e.push(i.buffer,n.buffer),{ids:i,positions:n}}static deserialize(t){const e=new mo;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function Io(t){const e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:po(String(t))}function Co(t,e,i,n){for(;i>1];let r=i-1,o=n+1;for(;;){do{r++}while(t[r]s);if(r>=o)break;fo(t,r,o),fo(e,3*r,3*o),fo(e,3*r+1,3*o+1),fo(e,3*r+2,3*o+2)}o-i`u_${t}`)),this.type=i}setUniform(t,e,i){t.set(i.constantOr(this.value))}getBinding(t,e,i){return"color"===this.type?new _o(t,e):new yo(t,e)}}class So{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setUniform(t,e,i,n){const s="u_pattern_to"===n?this.patternTo:"u_pattern_from"===n?this.patternFrom:"u_pixel_ratio_to"===n?this.pixelRatioTo:"u_pixel_ratio_from"===n?this.pixelRatioFrom:null;s&&t.set(s)}getBinding(t,e,i){return"u_pattern"===i.substr(0,9)?new bo(t,e):new yo(t,e)}}class ko{constructor(t,e,i,n){this.expression=t,this.type=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===i?2:1,offset:0}))),this.paintVertexArray=new n}populatePaintArray(t,e,i,n,s){const r=this.paintVertexArray.length,o=this.expression.evaluate(new Xs(0),e,{},n,[],s);this.paintVertexArray.resize(t),this._setPaintValue(r,t,o)}updatePaintArray(t,e,i,n){const s=this.expression.evaluate({zoom:0},i,n);this._setPaintValue(t,e,s)}_setPaintValue(t,e,i){if("color"===this.type){const n=xo(i);for(let i=t;i`u_${t}_t`)),this.type=i,this.useIntegerZoom=n,this.zoom=s,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===i?4:2,offset:0}))),this.paintVertexArray=new r}populatePaintArray(t,e,i,n,s){const r=this.expression.evaluate(new Xs(this.zoom),e,{},n,[],s),o=this.expression.evaluate(new Xs(this.zoom+1),e,{},n,[],s),a=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(a,t,r,o)}updatePaintArray(t,e,i,n){const s=this.expression.evaluate({zoom:this.zoom},i,n),r=this.expression.evaluate({zoom:this.zoom+1},i,n);this._setPaintValue(t,e,s,r)}_setPaintValue(t,e,i,n){if("color"===this.type){const s=xo(i),r=xo(n);for(let i=t;i`#define HAS_UNIFORM_${t}`)))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const i=this.binders[e];if(i instanceof ko||i instanceof Zo)for(let e=0;e!0)){this.programConfigurations={};for(const n of t)this.programConfigurations[n.id]=new Go(n,e,i);this.needsUpload=!1,this._featureMap=new mo,this._bufferOffset=0}populatePaintArrays(t,e,i,n,s,r){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(t,e,n,s,r);void 0!==e.id&&this._featureMap.add(e.id,i,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,i,n){for(const s of i)this.needsUpload=this.programConfigurations[s.id].updatePaintArrays(t,this._featureMap,e,s,n)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Vo(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function To(t,e,i){const n={color:{source:ur,composite:Br},number:{source:xr,composite:ur}},s=function(t){return{"line-pattern":{source:Or,composite:Or},"fill-pattern":{source:Or,composite:Or},"fill-extrusion-pattern":{source:Or,composite:Or}}[t]}(t);return s&&s[i]||n[e][i]}_s("ConstantBinder",wo),_s("CrossFadedConstantBinder",So),_s("SourceExpressionBinder",ko),_s("CrossFadedCompositeBinder",Bo),_s("CompositeExpressionBinder",Zo),_s("ProgramConfiguration",Go,{omit:["_buffers"]}),_s("ProgramConfigurationSet",Ro);const Wo=8192,Jo=Math.pow(2,14)-1,zo=-Jo-1;function Po(t){const e=Wo/t.extent,i=t.loadGeometry();for(let t=0;ti.x+1||ri.y+1)&&v("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function Mo(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Po(t):[]}}function Xo(t,e,i,n,s){t.emplaceBack(2*e+(n+1)/2,2*i+(s+1)/2)}class Fo{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Lr,this.indexArray=new to,this.segments=new so,this.programConfigurations=new Ro(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){const n=this.layers[0],s=[];let r=null,o=!1;"circle"===n.type&&(r=n.layout.get("circle-sort-key"),o=!r.isConstant());for(const{feature:e,id:n,index:a,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Mo(e,t);if(!this.layers[0]._featureFilter.filter(new Xs(this.zoom),c,i))continue;const g=o?r.evaluate(c,{},i):void 0,h={id:n,properties:e.properties,type:e.type,sourceLayerIndex:l,index:a,geometry:t?c.geometry:Po(e),patterns:{},sortKey:g};s.push(h)}o&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of s){const{geometry:s,index:r,sourceLayerIndex:o}=n,a=t[r].feature;this.addFeature(n,s,r,i),e.featureIndex.insert(a,s,r,o,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,no),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,i,n){for(const i of e)for(const e of i){const i=e.x,n=e.y;if(i<0||i>=Wo||n<0||n>=Wo)continue;const s=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),r=s.vertexLength;Xo(this.layoutVertexArray,i,n,-1,-1),Xo(this.layoutVertexArray,i,n,1,-1),Xo(this.layoutVertexArray,i,n,1,1),Xo(this.layoutVertexArray,i,n,-1,1),this.indexArray.emplaceBack(r,r+1,r+2),this.indexArray.emplaceBack(r,r+3,r+2),s.vertexLength+=4,s.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{},n)}}function Ko(t,e){for(let i=0;i1){if(Do(t,e))return!0;for(let n=0;n1?i:i.sub(e)._mult(s)._add(e))}function Uo(t,e){let i,n,s,r=!1;for(let o=0;oe.y!=s.y>e.y&&e.x<(s.x-n.x)*(e.y-n.y)/(s.y-n.y)+n.x&&(r=!r)}return r}function jo(t,e){let i=!1;for(let n=0,s=t.length-1;ne.y!=o.y>e.y&&e.x<(o.x-r.x)*(e.y-r.y)/(o.y-r.y)+r.x&&(i=!i)}return i}function Qo(t,e,i){const n=i[0],s=i[2];if(t.xs.x&&e.x>s.x||t.ys.y&&e.y>s.y)return!1;const r=x(t,e,i[0]);return r!==x(t,e,i[1])||r!==x(t,e,i[2])||r!==x(t,e,i[3])}function qo(t,e,i){const n=e.paint.get(t).value;return"constant"===n.kind?n.value:i.programConfigurations.get(e.id).getMaxValue(t)}function $o(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function ta(t,e,i,n,s){if(!e[0]&&!e[1])return t;const o=r.convert(e)._mult(s);"viewport"===i&&o._rotate(-n);const a=[];for(let e=0;eua(t,e)))}(l,a),u=g?c*o:c;for(const t of n)for(const e of t){const t=g?e:ua(e,a);let i=u;const n=ga([],[e.x,e.y,0,1],a);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?i*=n[3]/r.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(i*=r.cameraToCenterDistance/n[3]),Ho(h,t,i))return!0}return!1}}function ua(t,e){const i=ga([],[t.x,t.y,0,1],e);return new r(i[0]/i[3],i[1]/i[3])}class da extends Fo{}let pa;_s("HeatmapBucket",da,{omit:["layers"]});var ma={get paint(){return pa=pa||new $s({"heatmap-radius":new Us(Y.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Us(Y.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Os(Y.paint_heatmap["heatmap-intensity"]),"heatmap-color":new qs(Y.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Os(Y.paint_heatmap["heatmap-opacity"])})}};function Ia(t,{width:e,height:i},n,s){if(s){if(s instanceof Uint8ClampedArray)s=new Uint8Array(s.buffer);else if(s.length!==e*i*n)throw new RangeError(`mismatched image size. expected: ${s.length} but got: ${e*i*n}`)}else s=new Uint8Array(e*i*n);return t.width=e,t.height=i,t.data=s,t}function Ca(t,{width:e,height:i},n){if(e===t.width&&i===t.height)return;const s=Ia({},{width:e,height:i},n);fa(t,s,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,i)},n),t.width=e,t.height=i,t.data=s.data}function fa(t,e,i,n,s,r){if(0===s.width||0===s.height)return e;if(s.width>t.width||s.height>t.height||i.x>t.width-s.width||i.y>t.height-s.height)throw new RangeError("out of range source coordinates for image copy");if(s.width>e.width||s.height>e.height||n.x>e.width-s.width||n.y>e.height-s.height)throw new RangeError("out of range destination coordinates for image copy");const o=t.data,a=e.data;if(o===a)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l{e[t.evaluationKey]=r;const o=t.expression.evaluate(e);s.data[i+n+0]=Math.floor(255*o.r/o.a),s.data[i+n+1]=Math.floor(255*o.g/o.a),s.data[i+n+2]=Math.floor(255*o.b/o.a),s.data[i+n+3]=Math.floor(255*o.a)};if(t.clips)for(let e=0,s=0;e80*i){n=r=t[0],s=o=t[1];for(var p=i;pr&&(r=a),l>o&&(o=l);c=0!==(c=Math.max(r-n,o-s))?32767/c:0}return Va(u,d,i,n,s,c,0),d}function Ga(t,e,i,n,s){var r,o;if(s===tl(t,e,i,n)>0)for(r=e;r=e;r-=n)o=Qa(r,t[r],t[r+1],o);return o&&Da(o,o.next)&&(qa(o),o=o.next),o}function Ra(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!Da(n,n.next)&&0!==Ea(n.prev,n,n.next))n=n.next;else{if(qa(n),(n=e=n.prev)===n.next)break;i=!0}}while(i||n!==e);return e}function Va(t,e,i,n,s,r,o){if(t){!o&&r&&function(t,e,i,n){var s=t;do{0===s.z&&(s.z=Fa(s.x,s.y,e,i,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next}while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,function(t){var e,i,n,s,r,o,a,l,c=1;do{for(i=t,t=null,r=null,o=0;i;){for(o++,n=i,a=0,e=0;e0||l>0&&n;)0!==a&&(0===l||!n||i.z<=n.z)?(s=i,i=i.nextZ,a--):(s=n,n=n.nextZ,l--),r?r.nextZ=s:t=s,s.prevZ=r,r=s;i=n}r.nextZ=null,c*=2}while(o>1)}(s)}(t,n,s,r);for(var a,l,c=t;t.prev!==t.next;)if(a=t.prev,l=t.next,r?Wa(t,n,s,r):Ta(t))e.push(a.i/i|0),e.push(t.i/i|0),e.push(l.i/i|0),qa(t),t=l.next,c=l.next;else if((t=l)===c){o?1===o?Va(t=Ja(Ra(t),e,i),e,i,n,s,r,2):2===o&&za(t,e,i,n,s,r):Va(Ra(t),e,i,n,s,r,1);break}}}function Ta(t){var e=t.prev,i=t,n=t.next;if(Ea(e,i,n)>=0)return!1;for(var s=e.x,r=i.x,o=n.x,a=e.y,l=i.y,c=n.y,g=sr?s>o?s:o:r>o?r:o,d=a>l?a>c?a:c:l>c?l:c,p=n.next;p!==e;){if(p.x>=g&&p.x<=u&&p.y>=h&&p.y<=d&&Ha(s,a,r,l,o,c,p.x,p.y)&&Ea(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Wa(t,e,i,n){var s=t.prev,r=t,o=t.next;if(Ea(s,r,o)>=0)return!1;for(var a=s.x,l=r.x,c=o.x,g=s.y,h=r.y,u=o.y,d=al?a>c?a:c:l>c?l:c,I=g>h?g>u?g:u:h>u?h:u,C=Fa(d,p,e,i,n),f=Fa(m,I,e,i,n),A=t.prevZ,y=t.nextZ;A&&A.z>=C&&y&&y.z<=f;){if(A.x>=d&&A.x<=m&&A.y>=p&&A.y<=I&&A!==s&&A!==o&&Ha(a,g,l,h,c,u,A.x,A.y)&&Ea(A.prev,A,A.next)>=0)return!1;if(A=A.prevZ,y.x>=d&&y.x<=m&&y.y>=p&&y.y<=I&&y!==s&&y!==o&&Ha(a,g,l,h,c,u,y.x,y.y)&&Ea(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(;A&&A.z>=C;){if(A.x>=d&&A.x<=m&&A.y>=p&&A.y<=I&&A!==s&&A!==o&&Ha(a,g,l,h,c,u,A.x,A.y)&&Ea(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;y&&y.z<=f;){if(y.x>=d&&y.x<=m&&y.y>=p&&y.y<=I&&y!==s&&y!==o&&Ha(a,g,l,h,c,u,y.x,y.y)&&Ea(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function Ja(t,e,i){var n=t;do{var s=n.prev,r=n.next.next;!Da(s,r)&&Ya(s,n,n.next,r)&&Ua(s,r)&&Ua(r,s)&&(e.push(s.i/i|0),e.push(n.i/i|0),e.push(r.i/i|0),qa(n),qa(n.next),n=t=r),n=n.next}while(n!==t);return Ra(n)}function za(t,e,i,n,s,r){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&La(o,a)){var l=ja(o,a);return o=Ra(o,o.next),l=Ra(l,l.next),Va(o,e,i,n,s,r,0),void Va(l,e,i,n,s,r,0)}a=a.next}o=o.next}while(o!==t)}function Pa(t,e){return t.x-e.x}function Ma(t,e){var i=function(t,e){var i,n=e,s=t.x,r=t.y,o=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){var a=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=s&&a>o&&(o=a,i=n.x=n.x&&n.x>=g&&s!==n.x&&Ha(ri.x||n.x===i.x&&Xa(i,n)))&&(i=n,u=l)),n=n.next}while(n!==c);return i}(t,e);if(!i)return e;var n=ja(i,t);return Ra(n,n.next),Ra(i,i.next)}function Xa(t,e){return Ea(t.prev,t,e.prev)<0&&Ea(e.next,t,t.next)<0}function Fa(t,e,i,n,s){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*s|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*s|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ka(t){var e=t,i=t;do{(e.x=(t-o)*(r-a)&&(t-o)*(n-a)>=(i-o)*(e-a)&&(i-o)*(r-a)>=(s-o)*(n-a)}function La(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Ya(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Ua(t,e)&&Ua(e,t)&&function(t,e){var i=t,n=!1,s=(t.x+e.x)/2,r=(t.y+e.y)/2;do{i.y>r!=i.next.y>r&&i.next.y!==i.y&&s<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(Ea(t.prev,t,e.prev)||Ea(t,e.prev,e))||Da(t,e)&&Ea(t.prev,t,t.next)>0&&Ea(e.prev,e,e.next)>0)}function Ea(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Da(t,e){return t.x===e.x&&t.y===e.y}function Ya(t,e,i,n){var s=Oa(Ea(t,e,i)),r=Oa(Ea(t,e,n)),o=Oa(Ea(i,n,t)),a=Oa(Ea(i,n,e));return s!==r&&o!==a||!(0!==s||!Na(t,i,e))||!(0!==r||!Na(t,n,e))||!(0!==o||!Na(i,t,n))||!(0!==a||!Na(i,e,n))}function Na(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Oa(t){return t>0?1:t<0?-1:0}function Ua(t,e){return Ea(t.prev,t,t.next)<0?Ea(t,e,t.next)>=0&&Ea(t,t.prev,e)>=0:Ea(t,e,t.prev)<0||Ea(t,t.next,e)<0}function ja(t,e){var i=new $a(t.i,t.x,t.y),n=new $a(e.i,e.x,e.y),s=t.next,r=e.prev;return t.next=e,e.prev=t,i.next=s,s.prev=i,n.next=i,i.prev=n,r.next=n,n.prev=r,n}function Qa(t,e,i,n){var s=new $a(t,e,i);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function qa(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function $a(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function tl(t,e,i,n){for(var s=0,r=e,o=i-n;r0&&i.holes.push(n+=t[s-1].length)}return i};var el=i(Za.exports);function il(t,e,i){const n=i.patternDependencies;let s=!1;for(const i of e){const e=i.paint.get(`${t}-pattern`);e.isConstant()||(s=!0);const r=e.constantOr(null);r&&(s=!0,n[r.to]=!0,n[r.from]=!0)}return s}function nl(t,e,i,n,s){const r=s.patternDependencies;for(const o of e){const e=o.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:n-1},i,{},s.availableImages),a=e.evaluate({zoom:n},i,{},s.availableImages),l=e.evaluate({zoom:n+1},i,{},s.availableImages);t=t&&t.name?t.name:t,a=a&&a.name?a.name:a,l=l&&l.name?l.name:l,r[t]=!0,r[a]=!0,r[l]=!0,i.patterns[o.id]={min:t,mid:a,max:l}}}return i}class sl{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Er,this.indexArray=new to,this.indexArray2=new eo,this.programConfigurations=new Ro(t.layers,t.zoom),this.segments=new so,this.segments2=new so,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.hasPattern=il("fill",this.layers,e);const n=this.layers[0].layout.get("fill-sort-key"),s=!n.isConstant(),r=[];for(const{feature:o,id:a,index:l,sourceLayerIndex:c}of t){const t=this.layers[0]._featureFilter.needGeometry,g=Mo(o,t);if(!this.layers[0]._featureFilter.filter(new Xs(this.zoom),g,i))continue;const h=s?n.evaluate(g,{},i,e.availableImages):void 0,u={id:a,properties:o.properties,type:o.type,sourceLayerIndex:c,index:l,geometry:t?g.geometry:Po(o),patterns:{},sortKey:h};r.push(u)}s&&r.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of r){const{geometry:s,index:r,sourceLayerIndex:o}=n;if(this.hasPattern){const t=nl("fill",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,s,r,i,{});e.featureIndex.insert(t[r].feature,s,r,o,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}addFeatures(t,e,i){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ka),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,i,n,s){for(const t of Ai(e,500)){let e=0;for(const i of t)e+=i.length;const i=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),n=i.vertexLength,s=[],r=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&r.push(s.length/2);const i=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),n=i.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(n+e.length-1,n),s.push(e[0].x),s.push(e[0].y);for(let t=1;t>3}if(s--,1===n||2===n)r+=t.readSVarint(),o+=t.readSVarint(),1===n&&(e&&a.push(e),e=[]),e.push(new dl(r,o));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&a.push(e),a},ml.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,i=1,n=0,s=0,r=0,o=1/0,a=-1/0,l=1/0,c=-1/0;t.pos>3}if(n--,1===i||2===i)(s+=t.readSVarint())a&&(a=s),(r+=t.readSVarint())c&&(c=r);else if(7!==i)throw new Error("unknown command "+i)}return[o,l,a,c]},ml.prototype.toGeoJSON=function(t,e,i){var n,s,r=this.extent*Math.pow(2,i),o=this.extent*t,a=this.extent*e,l=this.loadGeometry(),c=ml.types[this.type];function g(t){for(var e=0;e>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(i))}yl.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new fl(this._pbf,e,this.extent,this._keys,this._values)};var _l=Al;function vl(t,e,i){if(3===t){var n=new _l(i,i.readVarint()+i.pos);n.length&&(e[n.name]=n)}}ul.VectorTile=function(t,e){this.layers=t.readFields(vl,{},e)},ul.VectorTileFeature=pl,ul.VectorTileLayer=Al;const xl=ul.VectorTileFeature.types,wl=Math.pow(2,13);function Sl(t,e,i,n,s,r,o,a){t.emplaceBack(e,i,2*Math.floor(n*wl)+o,s*wl*2,r*wl*2,Math.round(a))}class kl{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Dr,this.centroidVertexArray=new Hr,this.indexArray=new to,this.programConfigurations=new Ro(t.layers,t.zoom),this.segments=new so,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.features=[],this.hasPattern=il("fill-extrusion",this.layers,e);for(const{feature:n,id:s,index:r,sourceLayerIndex:o}of t){const t=this.layers[0]._featureFilter.needGeometry,a=Mo(n,t);if(!this.layers[0]._featureFilter.filter(new Xs(this.zoom),a,i))continue;const l={id:s,sourceLayerIndex:o,index:r,geometry:t?a.geometry:Po(n),properties:n.properties,type:n.type,patterns:{}};this.hasPattern?this.features.push(nl("fill-extrusion",this.layers,l,this.zoom,e)):this.addFeature(l,l.geometry,r,i,{}),e.featureIndex.insert(n,l.geometry,r,o,this.index,!0)}}addFeatures(t,e,i){for(const t of this.features){const{geometry:n}=t;this.addFeature(t,n,t.index,e,i)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,hl),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,gl.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,e,i,n,s){for(const i of Ai(e,500)){const e={x:0,y:0,vertexCount:0};let n=0;for(const t of i)n+=t.length;let s=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const t of i){if(0===t.length)continue;if(Bl(t))continue;let i=0;for(let n=0;n=1){const o=t[n-1];if(!Zl(r,o)){s.vertexLength+4>so.MAX_VERTEX_ARRAY_LENGTH&&(s=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const t=r.sub(o)._perp()._unit(),n=o.dist(r);i+n>32768&&(i=0),Sl(this.layoutVertexArray,r.x,r.y,t.x,t.y,0,0,i),Sl(this.layoutVertexArray,r.x,r.y,t.x,t.y,0,1,i),e.x+=2*r.x,e.y+=2*r.y,e.vertexCount+=2,i+=n,Sl(this.layoutVertexArray,o.x,o.y,t.x,t.y,0,0,i),Sl(this.layoutVertexArray,o.x,o.y,t.x,t.y,0,1,i),e.x+=2*o.x,e.y+=2*o.y,e.vertexCount+=2;const a=s.vertexLength;this.indexArray.emplaceBack(a,a+2,a+1),this.indexArray.emplaceBack(a+1,a+2,a+3),s.vertexLength+=4,s.primitiveLength+=2}}}}if(s.vertexLength+n>so.MAX_VERTEX_ARRAY_LENGTH&&(s=this.segments.prepareSegment(n,this.layoutVertexArray,this.indexArray)),"Polygon"!==xl[t.type])continue;const r=[],o=[],a=s.vertexLength;for(const t of i)if(0!==t.length){t!==i[0]&&o.push(r.length/2);for(let i=0;iWo)||t.y===e.y&&(t.y<0||t.y>Wo)}function Bl(t){return t.every((t=>t.x<0))||t.every((t=>t.x>Wo))||t.every((t=>t.y<0))||t.every((t=>t.y>Wo))}let Gl;_s("FillExtrusionBucket",kl,{omit:["layers","features"]});var Rl={get paint(){return Gl=Gl||new $s({"fill-extrusion-opacity":new Os(Y["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Us(Y["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Os(Y["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Os(Y["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new js(Y["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Us(Y["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Us(Y["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Os(Y["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Vl extends er{constructor(t){super(t,Rl)}createBucket(t){return new kl(t)}queryRadius(){return $o(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,e,i,n,s,o,a,l){const c=ta(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),o.angle,a),g=this.paint.get("fill-extrusion-height").evaluate(e,i),h=this.paint.get("fill-extrusion-base").evaluate(e,i),u=function(t,e,i,n){const s=[];for(const i of t){const t=[i.x,i.y,0,1];ga(t,t,e),s.push(new r(t[0]/t[3],t[1]/t[3]))}return s}(c,l),d=function(t,e,i,n){const s=[],o=[],a=n[8]*e,l=n[9]*e,c=n[10]*e,g=n[11]*e,h=n[8]*i,u=n[9]*i,d=n[10]*i,p=n[11]*i;for(const e of t){const t=[],i=[];for(const s of e){const e=s.x,o=s.y,m=n[0]*e+n[4]*o+n[12],I=n[1]*e+n[5]*o+n[13],C=n[2]*e+n[6]*o+n[14],f=n[3]*e+n[7]*o+n[15],A=C+c,y=f+g,b=m+h,_=I+u,v=C+d,x=f+p,w=new r((m+a)/y,(I+l)/y);w.z=A/y,t.push(w);const S=new r(b/x,_/x);S.z=v/x,i.push(S)}s.push(t),o.push(i)}return[s,o]}(n,h,g,l);return function(t,e,i){let n=1/0;Lo(i,e)&&(n=Wl(i,e[0]));for(let s=0;st.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={}})),this.layoutVertexArray=new Yr,this.layoutVertexArray2=new Nr,this.indexArray=new to,this.programConfigurations=new Ro(t.layers,t.zoom),this.segments=new so,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.hasPattern=il("line",this.layers,e);const n=this.layers[0].layout.get("line-sort-key"),s=!n.isConstant(),r=[];for(const{feature:e,id:o,index:a,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Mo(e,t);if(!this.layers[0]._featureFilter.filter(new Xs(this.zoom),c,i))continue;const g=s?n.evaluate(c,{},i):void 0,h={id:o,properties:e.properties,type:e.type,sourceLayerIndex:l,index:a,geometry:t?c.geometry:Po(e),patterns:{},sortKey:g};r.push(h)}s&&r.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of r){const{geometry:s,index:r,sourceLayerIndex:o}=n;if(this.hasPattern){const t=nl("line",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,s,r,i,{});e.featureIndex.insert(t[r].feature,s,r,o,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}addFeatures(t,e,i){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Ml)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,zl),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,i,n,s){const r=this.layers[0].layout,o=r.get("line-join").evaluate(t,{}),a=r.get("line-cap"),l=r.get("line-miter-limit"),c=r.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const i of e)this.addLine(i,t,o,a,l,c);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,s,n)}addLine(t,e,i,n,s,r){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e=2&&t[a-1].equals(t[a-2]);)a--;let l=0;for(;l0;if(b&&e>l){const t=h.dist(u);if(t>2*c){const e=h.sub(h.sub(u)._mult(c/t)._round());this.updateDistance(u,e),this.addCurrentVertex(e,p,0,0,g),u=e}}const v=u&&d;let x=v?i:o?"butt":n;if(v&&"round"===x&&(As&&(x="bevel"),"bevel"===x&&(A>2&&(x="flipbevel"),A100)I=m.mult(-1);else{const t=A*p.add(m).mag()/p.sub(m).mag();I._perp()._mult(t*(_?-1:1))}this.addCurrentVertex(h,I,0,0,g),this.addCurrentVertex(h,I.mult(-1),0,0,g)}else if("bevel"===x||"fakeround"===x){const t=-Math.sqrt(A*A-1),e=_?t:0,i=_?0:t;if(u&&this.addCurrentVertex(h,p,e,i,g),"fakeround"===x){const t=Math.round(180*y/Math.PI/20);for(let e=1;e2*c){const e=h.add(d.sub(h)._mult(c/t)._round());this.updateDistance(h,e),this.addCurrentVertex(e,m,0,0,g),h=e}}}}addCurrentVertex(t,e,i,n,s,r=!1){const o=e.y*n-e.x,a=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*i,e.y-e.x*i,r,!1,i,s),this.addHalfVertex(t,o,a,r,!0,-n,s),this.distance>Kl/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,i,n,s,r))}addHalfVertex({x:t,y:e},i,n,s,r,o,a){const l=.5*(this.lineClips?this.scaledDistance*(Kl-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(s?1:0),(e<<1)+(r?1:0),Math.round(63*i)+128,Math.round(63*n)+128,1+(0===o?0:o<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const c=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,c),a.primitiveLength++),r?this.e2=c:this.e1=c}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}}let Ll,El;_s("LineBucket",Hl,{omit:["layers","patternFeatures"]});var Dl={get paint(){return El=El||new $s({"line-opacity":new Us(Y.paint_line["line-opacity"]),"line-color":new Us(Y.paint_line["line-color"]),"line-translate":new Os(Y.paint_line["line-translate"]),"line-translate-anchor":new Os(Y.paint_line["line-translate-anchor"]),"line-width":new Us(Y.paint_line["line-width"]),"line-gap-width":new Us(Y.paint_line["line-gap-width"]),"line-offset":new Us(Y.paint_line["line-offset"]),"line-blur":new Us(Y.paint_line["line-blur"]),"line-dasharray":new Qs(Y.paint_line["line-dasharray"]),"line-pattern":new js(Y.paint_line["line-pattern"]),"line-gradient":new qs(Y.paint_line["line-gradient"])})},get layout(){return Ll=Ll||new $s({"line-cap":new Os(Y.layout_line["line-cap"]),"line-join":new Us(Y.layout_line["line-join"]),"line-miter-limit":new Os(Y.layout_line["line-miter-limit"]),"line-round-limit":new Os(Y.layout_line["line-round-limit"]),"line-sort-key":new Us(Y.layout_line["line-sort-key"])})}};class Yl extends Us{possiblyEvaluate(t,e){return e=new Xs(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,i,n){return e=C({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,i,n)}}let Nl;class Ol extends er{constructor(t){super(t,Dl),this.gradientVersion=0,Nl||(Nl=new Yl(Dl.paint.properties["line-width"].specification),Nl.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if("line-gradient"===t){const t=this.gradientExpression();this.stepInterpolant=!!function(t){return void 0!==t._styleExpression}(t)&&t._styleExpression.expression instanceof ve,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=Nl.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Hl(t)}queryRadius(t){const e=t,i=Ul(qo("line-width",this,e),qo("line-gap-width",this,e)),n=qo("line-offset",this,e);return i/2+Math.abs(n)+$o(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,i,n,s,o,a){const l=ta(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,a),c=a/2*Ul(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),g=this.paint.get("line-offset").evaluate(e,i);return g&&(n=function(t,e){const i=[];for(let n=0;n=3)for(let e=0;e0?e+2*t:t}const jl=rr([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Ql=rr([{name:"a_projected_pos",components:3,type:"Float32"}],4);rr([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const ql=rr([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);rr([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const $l=rr([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),tc=rr([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function ec(t,e,i){return t.sections.forEach((t=>{t.text=function(t,e,i){const n=e.layout.get("text-transform").evaluate(i,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),Ms.applyArabicShaping&&(t=Ms.applyArabicShaping(t)),t}(t.text,e,i)})),t}rr([{name:"triangle",components:3,type:"Uint16"}]),rr([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),rr([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),rr([{type:"Float32",name:"offsetX"}]),rr([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),rr([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const ic={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var nc=24,sc=ac,rc=function(t,e,i,n,s){var r,o,a=8*s-n-1,l=(1<>1,g=-7,h=s-1,u=-1,d=t[e+h];for(h+=u,r=d&(1<<-g)-1,d>>=-g,g+=a;g>0;r=256*r+t[e+h],h+=u,g-=8);for(o=r&(1<<-g)-1,r>>=-g,g+=n;g>0;o=256*o+t[e+h],h+=u,g-=8);if(0===r)r=1-c;else{if(r===l)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,n),r-=c}return(d?-1:1)*o*Math.pow(2,r-n)},oc=function(t,e,i,n,s,r){var o,a,l,c=8*r-s-1,g=(1<>1,u=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,d=0,p=1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=g):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+h>=1?u/l:u*Math.pow(2,1-h))*l>=2&&(o++,l/=2),o+h>=g?(a=0,o=g):o+h>=1?(a=(e*l-1)*Math.pow(2,s),o+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,s),o=0));s>=8;t[i+d]=255&a,d+=p,a/=256,s-=8);for(o=o<0;t[i+d]=255&o,d+=p,o/=256,c-=8);t[i+d-p]|=128*m};function ac(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}ac.Varint=0,ac.Fixed64=1,ac.Bytes=2,ac.Fixed32=5;var lc=4294967296,cc=1/lc,gc="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function hc(t){return t.type===ac.Bytes?t.readVarint()+t.pos:t.pos+1}function uc(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function dc(t,e,i){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(var s=i.pos-1;s>=t;s--)i.buf[s+n]=i.buf[s]}function pc(t,e){for(var i=0;i>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function wc(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}ac.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos>3,r=this.pos;this.type=7&n,t(s,e,this),this.pos===r&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=vc(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=wc(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=vc(this.buf,this.pos)+vc(this.buf,this.pos+4)*lc;return this.pos+=8,t},readSFixed64:function(){var t=vc(this.buf,this.pos)+wc(this.buf,this.pos+4)*lc;return this.pos+=8,t},readFloat:function(){var t=rc(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=rc(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,n=this.buf;return e=127&(i=n[this.pos++]),i<128?e:(e|=(127&(i=n[this.pos++]))<<7,i<128?e:(e|=(127&(i=n[this.pos++]))<<14,i<128?e:(e|=(127&(i=n[this.pos++]))<<21,i<128?e:function(t,e,i){var n,s,r=i.buf;if(n=(112&(s=r[i.pos++]))>>4,s<128)return uc(t,n,e);if(n|=(127&(s=r[i.pos++]))<<3,s<128)return uc(t,n,e);if(n|=(127&(s=r[i.pos++]))<<10,s<128)return uc(t,n,e);if(n|=(127&(s=r[i.pos++]))<<17,s<128)return uc(t,n,e);if(n|=(127&(s=r[i.pos++]))<<24,s<128)return uc(t,n,e);if(n|=(1&(s=r[i.pos++]))<<31,s<128)return uc(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&gc?function(t,e,i){return gc.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){for(var n="",s=e;s239?4:l>223?3:l>191?2:1;if(s+g>i)break;1===g?l<128&&(c=l):2===g?128==(192&(r=t[s+1]))&&(c=(31&l)<<6|63&r)<=127&&(c=null):3===g?(o=t[s+2],128==(192&(r=t[s+1]))&&128==(192&o)&&((c=(15&l)<<12|(63&r)<<6|63&o)<=2047||c>=55296&&c<=57343)&&(c=null)):4===g&&(o=t[s+2],a=t[s+3],128==(192&(r=t[s+1]))&&128==(192&o)&&128==(192&a)&&((c=(15&l)<<18|(63&r)<<12|(63&o)<<6|63&a)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,g=1):c>65535&&(c-=65536,n+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),n+=String.fromCharCode(c),s+=g}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==ac.Bytes)return t.push(this.readVarint(e));var i=hc(this);for(t=t||[];this.pos127;);else if(e===ac.Bytes)this.pos=this.readVarint()+this.pos;else if(e===ac.Fixed32)this.pos+=4;else{if(e!==ac.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var i,n;if(t>=0?(i=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?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,i.buf[i.pos]=127&(t>>>=7)}(i,0,e),function(t,e){var 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:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,i){for(var n,s,r=0;r55295&&n<57344){if(!s){n>56319||r+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):s=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,s=n;continue}n=s-55296<<10|n-56320|65536,s=null}else s&&(t[i++]=239,t[i++]=191,t[i++]=189,s=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);var i=this.pos-e;i>=128&&dc(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),oc(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),oc(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i=128&&dc(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,i){this.writeTag(t,ac.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,pc,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,mc,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,fc,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Ic,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Cc,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Ac,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,yc,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,bc,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,_c,e)},writeBytesField:function(t,e){this.writeTag(t,ac.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,ac.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,ac.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,ac.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,ac.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,ac.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,ac.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,ac.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,ac.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,ac.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var Sc=i(sc);const kc=3;function Zc(t,e,i){1===t&&i.readMessage(Bc,e)}function Bc(t,e,i){if(3===t){const{id:t,bitmap:n,width:s,height:r,left:o,top:a,advance:l}=i.readMessage(Gc,{});e.push({id:t,bitmap:new Aa({width:s+2*kc,height:r+2*kc},n),metrics:{width:s,height:r,left:o,top:a,advance:l}})}}function Gc(t,e,i){1===t?e.id=i.readVarint():2===t?e.bitmap=i.readBytes():3===t?e.width=i.readVarint():4===t?e.height=i.readVarint():5===t?e.left=i.readSVarint():6===t?e.top=i.readSVarint():7===t&&(e.advance=i.readVarint())}const Rc=kc;function Vc(t){let e=0,i=0;for(const n of t)e+=n.w*n.h,i=Math.max(i,n.w);t.sort(((t,e)=>e.h-t.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let s=0,r=0;for(const e of t)for(let t=n.length-1;t>=0;t--){const i=n[t];if(!(e.w>i.w||e.h>i.h)){if(e.x=i.x,e.y=i.y,r=Math.max(r,e.y+e.h),s=Math.max(s,e.x+e.w),e.w===i.w&&e.h===i.h){const e=n.pop();t=0&&i>=t&&Kc[this.text.charCodeAt(i)];i--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e)}substring(t,e){const i=new Xc;return i.text=this.text.substring(t,e),i.sectionIndex=this.sectionIndex.slice(t,e),i.sections=this.sections,i}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}addTextSection(t,e){this.text+=t.text,this.sections.push(Mc.forText(t.scale,t.fontStack||e));const i=this.sections.length-1;for(let e=0;e=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Fc(e,i,n,s,r,o,a,l,c,g,h,u,d,p,m){const I=Xc.fromFeature(e,r);let C;u===t.ai.vertical&&I.verticalizePunctuation();const{processBidirectionalText:f,processStyledBidirectionalText:A}=Ms;if(f&&1===I.sections.length){C=[];const t=f(I.toString(),Uc(I,g,o,i,s,p));for(const e of t){const t=new Xc;t.text=e,t.sections=I.sections;for(let i=0;i0&&n>_&&(_=n)}else{const t=n[m.fontStack],e=t&&t[C];if(e&&e.rect)v=e.rect,y=e.metrics;else{const t=i[m.fontStack],e=t&&t[C];if(!e)continue;y=e.metrics}f=(r-m.scale)*nc}S?(e.verticalizable=!0,b.push({glyph:C,imageName:x,x:d,y:p+f,vertical:S,scale:m.scale,fontStack:m.fontStack,sectionIndex:I,metrics:y,rect:v}),d+=w*m.scale+g):(b.push({glyph:C,imageName:x,x:d,y:p+f,vertical:S,scale:m.scale,fontStack:m.fontStack,sectionIndex:I,metrics:y,rect:v}),d+=y.advance*m.scale+g)}0!==b.length&&(m=Math.max(d-g,m),Qc(b,0,b.length-1,C,_)),d=0;const v=o*r+_;y.lineOffset=Math.max(_,l),p+=v,I=Math.max(v,I),++f}var A;const y=p-Pc,{horizontalAlign:b,verticalAlign:_}=jc(a);(function(t,e,i,n,s,r,o,a,l){const c=(e-i)*s;let g=0;g=r!==o?-a*n-Pc:(-n*l+.5)*o;for(const e of t)for(const t of e.positionedGlyphs)t.x+=c,t.y+=g})(e.positionedLines,C,b,_,m,I,o,y,r.length),e.top+=-_*y,e.bottom=e.top+y,e.left+=-b*m,e.right=e.left+m}(b,i,n,s,C,a,l,c,u,g,d,m),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(y)&&b}const Kc={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Hc={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},Lc={40:!0};function Ec(t,e,i,n,s,r){if(e.imageName){const t=n[e.imageName];return t?t.displaySize[0]*e.scale*nc/r+s:0}{const n=i[e.fontStack],r=n&&n[t];return r?r.metrics.advance*e.scale+s:0}}function Dc(t,e,i,n){const s=Math.pow(t-e,2);return n?t=0;let c=0;for(let i=0;ic){const t=Math.ceil(r/c);s*=t/o,o=t}return{x1:n,y1:s,x2:n+r,y2:s+o}}function tg(t,e,i,n,s,r){const o=t.image;let a;if(o.content){const t=o.content,e=o.pixelRatio||1;a=[t[0]/e,t[1]/e,o.displaySize[0]-t[2]/e,o.displaySize[1]-t[3]/e]}const l=e.left*r,c=e.right*r;let g,h,u,d;"width"===i||"both"===i?(d=s[0]+l-n[3],h=s[0]+c+n[1]):(d=s[0]+(l+c-o.displaySize[0])/2,h=d+o.displaySize[0]);const p=e.top*r,m=e.bottom*r;return"height"===i||"both"===i?(g=s[1]+p-n[0],u=s[1]+m+n[2]):(g=s[1]+(p+m-o.displaySize[1])/2,u=g+o.displaySize[1]),{image:o,top:g,right:h,bottom:u,left:d,collisionPadding:a}}const eg=255,ig=128,ng=eg*ig;function sg(t,e){const{expression:i}=e;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new Xs(t+1))};if("source"===i.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:n}=i;let s=0;for(;st.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=oa([]),this.placementViewportMatrix=oa([]);const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=sg(this.zoom,i["text-size"]),this.iconSizeData=sg(this.zoom,i["icon-size"]);const n=this.layers[0].layout,s=n.get("symbol-sort-key"),r=n.get("symbol-z-order");this.canOverlap="never"!==rg(n,"text-overlap","text-allow-overlap")||"never"!==rg(n,"icon-overlap","icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==r&&!s.isConstant(),this.sortFeaturesByY=("viewport-y"===r||"auto"===r&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===n.get("symbol-placement")&&(this.writingModes=n.get("text-writing-mode").map((e=>t.ai[e]))),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=e.sourceID}createArrays(){this.text=new hg(new Ro(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new hg(new Ro(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new zr,this.lineVertexArray=new Pr,this.symbolInstances=new Jr,this.textAnchorOffsets=new Xr}calculateGlyphDependencies(t,e,i,n,s){for(let r=0;r0)&&("constant"!==o.value.kind||o.value.value.length>0),g="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,h=r.get("symbol-sort-key");if(this.features=[],!c&&!g)return;const u=i.iconDependencies,d=i.glyphDependencies,p=i.availableImages,m=new Xs(this.zoom);for(const{feature:i,id:a,index:l,sourceLayerIndex:I}of e){const e=s._featureFilter.needGeometry,C=Mo(i,e);if(!s._featureFilter.filter(m,C,n))continue;let f,A;if(e||(C.geometry=Po(i)),c){const t=s.getValueAndResolveTokens("text-field",C,n,p),e=jt.factory(t),i=this.hasRTLText=this.hasRTLText||gg(e);(!i||"unavailable"===Ms.getRTLTextPluginStatus()||i&&Ms.isParsed())&&(f=ec(e,s,C))}if(g){const t=s.getValueAndResolveTokens("icon-image",C,n,p);A=t instanceof te?t:te.fromString(t)}if(!f&&!A)continue;const y=this.sortFeaturesByKey?h.evaluate(C,{},n):void 0;if(this.features.push({id:a,text:f,icon:A,index:l,sourceLayerIndex:I,geometry:C.geometry,properties:i.properties,type:og[i.type],sortKey:y}),A&&(u[A.name]=!0),f){const e=o.evaluate(C,{},n).join(","),i="viewport"!==r.get("text-rotation-alignment")&&"point"!==r.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(t.ai.vertical)>=0;for(const t of f.sections)if(t.image)u[t.image.name]=!0;else{const n=Gs(f.toString()),s=t.fontStack||e,r=d[s]=d[s]||{};this.calculateGlyphDependencies(t.text,r,i,this.allowVerticalPlacement,n)}}}"line"===r.get("symbol-placement")&&(this.features=function(t){const e={},i={},n=[];let s=0;function r(e){n.push(t[e]),s++}function o(t,e,s){const r=i[t];return delete i[t],i[e]=r,n[r].geometry[0].pop(),n[r].geometry[0]=n[r].geometry[0].concat(s[0]),r}function a(t,i,s){const r=e[i];return delete e[i],e[t]=r,n[r].geometry[0].shift(),n[r].geometry[0]=s[0].concat(n[r].geometry[0]),r}function l(t,e,i){const n=i?e[0][e[0].length-1]:e[0][0];return`${t}:${n.x}:${n.y}`}for(let c=0;ct.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey))}update(t,e,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,i),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,i))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){const i=this.lineVertexArray.length;if(void 0!==t.segment){let i=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]);const s={};for(let n=t.segment+1;n=0;i--)s[i]={x:e[i].x,y:e[i].y,tileUnitDistanceFromAnchor:n},i>0&&(n+=e[i-1].dist(e[i]));for(let t=0;t0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){const i=t.placedSymbolArray.get(e),n=i.vertexStartIndex+4*i.numGlyphs;for(let e=i.vertexStartIndex;en[t]-n[e]||s[e]-s[t])),r}addToSortKeyRanges(t,e){const i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===e?i.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach(((t,e,i)=>{t>=0&&i.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let pg,mg;_s("SymbolBucket",dg,{omit:["layers","collisionBoxArray","features","compareText"]}),dg.MAX_GLYPHS=65535,dg.addDynamicAttributes=cg;var Ig={get paint(){return mg=mg||new $s({"icon-opacity":new Us(Y.paint_symbol["icon-opacity"]),"icon-color":new Us(Y.paint_symbol["icon-color"]),"icon-halo-color":new Us(Y.paint_symbol["icon-halo-color"]),"icon-halo-width":new Us(Y.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Us(Y.paint_symbol["icon-halo-blur"]),"icon-translate":new Os(Y.paint_symbol["icon-translate"]),"icon-translate-anchor":new Os(Y.paint_symbol["icon-translate-anchor"]),"text-opacity":new Us(Y.paint_symbol["text-opacity"]),"text-color":new Us(Y.paint_symbol["text-color"],{runtimeType:ut,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new Us(Y.paint_symbol["text-halo-color"]),"text-halo-width":new Us(Y.paint_symbol["text-halo-width"]),"text-halo-blur":new Us(Y.paint_symbol["text-halo-blur"]),"text-translate":new Os(Y.paint_symbol["text-translate"]),"text-translate-anchor":new Os(Y.paint_symbol["text-translate-anchor"])})},get layout(){return pg=pg||new $s({"symbol-placement":new Os(Y.layout_symbol["symbol-placement"]),"symbol-spacing":new Os(Y.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Os(Y.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Us(Y.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Os(Y.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Os(Y.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Os(Y.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Os(Y.layout_symbol["icon-ignore-placement"]),"icon-optional":new Os(Y.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Os(Y.layout_symbol["icon-rotation-alignment"]),"icon-size":new Us(Y.layout_symbol["icon-size"]),"icon-text-fit":new Os(Y.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Os(Y.layout_symbol["icon-text-fit-padding"]),"icon-image":new Us(Y.layout_symbol["icon-image"]),"icon-rotate":new Us(Y.layout_symbol["icon-rotate"]),"icon-padding":new Us(Y.layout_symbol["icon-padding"]),"icon-keep-upright":new Os(Y.layout_symbol["icon-keep-upright"]),"icon-offset":new Us(Y.layout_symbol["icon-offset"]),"icon-anchor":new Us(Y.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Os(Y.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Os(Y.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Os(Y.layout_symbol["text-rotation-alignment"]),"text-field":new Us(Y.layout_symbol["text-field"]),"text-font":new Us(Y.layout_symbol["text-font"]),"text-size":new Us(Y.layout_symbol["text-size"]),"text-max-width":new Us(Y.layout_symbol["text-max-width"]),"text-line-height":new Os(Y.layout_symbol["text-line-height"]),"text-letter-spacing":new Us(Y.layout_symbol["text-letter-spacing"]),"text-justify":new Us(Y.layout_symbol["text-justify"]),"text-radial-offset":new Us(Y.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Os(Y.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Us(Y.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Us(Y.layout_symbol["text-anchor"]),"text-max-angle":new Os(Y.layout_symbol["text-max-angle"]),"text-writing-mode":new Os(Y.layout_symbol["text-writing-mode"]),"text-rotate":new Us(Y.layout_symbol["text-rotate"]),"text-padding":new Os(Y.layout_symbol["text-padding"]),"text-keep-upright":new Os(Y.layout_symbol["text-keep-upright"]),"text-transform":new Us(Y.layout_symbol["text-transform"]),"text-offset":new Us(Y.layout_symbol["text-offset"]),"text-allow-overlap":new Os(Y.layout_symbol["text-allow-overlap"]),"text-overlap":new Os(Y.layout_symbol["text-overlap"]),"text-ignore-placement":new Os(Y.layout_symbol["text-ignore-placement"]),"text-optional":new Os(Y.layout_symbol["text-optional"])})}};class Cg{constructor(t){if(void 0===t.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:lt,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}_s("FormatSectionOverride",Cg,{omit:["defaultValue"]});class fg extends er{constructor(t){super(t,Ig)}recalculate(t,e){if(super.recalculate(t,e),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){const t=this.layout.get("text-writing-mode");if(t){const e=[];for(const i of t)e.indexOf(i)<0&&e.push(i);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,e,i,n){const s=this.layout.get(t).evaluate(e,{},i,n),r=this._unevaluatedLayout._values[t];return r.isDataDriven()||yn(r.value)||!s?s:function(t,e){return e.replace(/{([^{}]+)}/g,((e,i)=>t&&i in t?String(t[i]):""))}(e.properties,s)}createBucket(t){return new dg(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Ig.paint.overridableProperties){if(!fg.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),i=new Cg(e),n=new An(i,e.property.specification);let s=null;s="constant"===e.value.kind||"source"===e.value.kind?new _n("source",n):new vn("composite",n,e.value.zoomStops),this.paint._values[t]=new Ys(e.property,s,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven())&&fg.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const i=t.get("text-field"),n=Ig.paint.properties[e];let s=!1;const r=t=>{for(const e of t)if(n.overrides&&n.overrides.hasOverride(e))return void(s=!0)};if("constant"===i.value.kind&&i.value.value instanceof jt)r(i.value.value.sections);else if("source"===i.value.kind){const t=e=>{s||(e instanceof re&&ne(e.value)===It?r(e.value.sections):e instanceof De?r(e.sections):e.eachChild(t))},e=i.value;e._styleExpression&&t(e._styleExpression.expression)}return s}}let Ag;var yg={get paint(){return Ag=Ag||new $s({"background-color":new Os(Y.paint_background["background-color"]),"background-pattern":new Qs(Y.paint_background["background-pattern"]),"background-opacity":new Os(Y.paint_background["background-opacity"])})}};class bg extends er{constructor(t){super(t,yg)}}let _g;var vg={get paint(){return _g=_g||new $s({"raster-opacity":new Os(Y.paint_raster["raster-opacity"]),"raster-hue-rotate":new Os(Y.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Os(Y.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Os(Y.paint_raster["raster-brightness-max"]),"raster-saturation":new Os(Y.paint_raster["raster-saturation"]),"raster-contrast":new Os(Y.paint_raster["raster-contrast"]),"raster-resampling":new Os(Y.paint_raster["raster-resampling"]),"raster-fade-duration":new Os(Y.paint_raster["raster-fade-duration"])})}};class xg extends er{constructor(t){super(t,vg)}}class wg extends er{constructor(t){super(t,{}),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Sg{constructor(t){this._methodToThrottle=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._methodToThrottle()}),0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const kg=6371008.8;class Zg{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Zg(I(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,i=this.lat*e,n=t.lat*e,s=Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return kg*Math.acos(Math.min(s,1))}static convert(t){if(t instanceof Zg)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Zg(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Zg(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const Bg=2*Math.PI*kg;function Gg(t){return Bg*Math.cos(t*Math.PI/180)}function Rg(t){return(180+t)/360}function Vg(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Tg(t,e){return t/Gg(e)}function Wg(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}class Jg{constructor(t,e,i=0){this.x=+t,this.y=+e,this.z=+i}static fromLngLat(t,e=0){const i=Zg.convert(t);return new Jg(Rg(i.lng),Vg(i.lat),Tg(e,i.lat))}toLngLat(){return new Zg(360*this.x-180,Wg(this.y))}toAltitude(){return this.z*Gg(Wg(this.y))}meterInMercatorCoordinateUnits(){return 1/Bg*(t=Wg(this.y),1/Math.cos(t*Math.PI/180));var t}}function zg(t,e,i){var n=2*Math.PI*6378137/256/Math.pow(2,i);return[t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}class Pg{constructor(t,e,i){if(t<0||t>25||i<0||i>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))throw new Error(`x=${e}, y=${i}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=e,this.y=i,this.key=Fg(0,t,t,e,i)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,i){const n=(r=this.y,o=this.z,a=zg(256*(s=this.x),256*(r=Math.pow(2,o)-r-1),o),l=zg(256*(s+1),256*(r+1),o),a[0]+","+a[1]+","+l[0]+","+l[1]);var s,r,o,a,l;const c=function(t,e,i){let n,s="";for(let r=t;r>0;r--)n=1<1?"@2x":"").replace(/{quadkey}/g,c).replace(/{bbox-epsg-3857}/g,n)}isChildOf(t){const e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){const e=Math.pow(2,this.z);return new r((t.x*e-this.x)*Wo,(t.y*e-this.y)*Wo)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Mg{constructor(t,e){this.wrap=t,this.canonical=e,this.key=Fg(t,e.z,e.z,e.x,e.y)}}class Xg{constructor(t,e,i,n,s){if(t= z; overscaledZ = ${t}; z = ${i}`);this.overscaledZ=t,this.wrap=e,this.canonical=new Pg(i,+n,+s),this.key=Fg(e,t,i,n,s)}clone(){return new Xg(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const e=this.canonical.z-t;return t>this.canonical.z?new Xg(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Xg(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const i=this.canonical.z-t;return t>this.canonical.z?Fg(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):Fg(this.wrap*+e,t,t,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new Xg(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,i=2*this.canonical.x,n=2*this.canonical.y;return[new Xg(e,this.wrap,e,i,n),new Xg(e,this.wrap,e,i+1,n),new Xg(e,this.wrap,e,i,n+1),new Xg(e,this.wrap,e,i+1,n+1)]}isLessThan(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.ythis.max&&(this.max=i),i=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}unpack(t,e,i){return t*this.redFactor+e*this.greenFactor+i*this.blueFactor-this.baseShift}getPixels(){return new ya({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,i){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let n=e*this.dim,s=e*this.dim+this.dim,r=i*this.dim,o=i*this.dim+this.dim;switch(e){case-1:n=s-1;break;case 1:s=n+1}switch(i){case-1:r=o-1;break;case 1:o=r+1}const a=-e*this.dim,l=-i*this.dim;for(let e=r;e=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class Lg{constructor(t,e,i,n,s){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=i,t._y=n,this.properties=t.properties,this.id=s}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t}}class Eg{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new ys(Wo,16,0),this.grid3D=new ys(Wo,16,0),this.featureIndexArray=new Kr,this.promoteId=e}insert(t,e,i,n,s,r){const o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,n,s);const a=r?this.grid3D:this.grid;for(let t=0;t=0&&n[3]>=0&&a.insert(o,n[0],n[1],n[2],n[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new ul.VectorTile(new Sc(this.rawTileData)).layers,this.sourceLayerCoder=new Hg(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,i,n){this.loadVTLayers();const s=t.params||{},o=Wo/t.tileSize/t.scale,a=Bn(s.filter),l=t.queryGeometry,c=t.queryPadding*o,g=Yg(l),h=this.grid.query(g.minX-c,g.minY-c,g.maxX+c,g.maxY+c),u=Yg(t.cameraQueryGeometry),d=this.grid3D.query(u.minX-c,u.minY-c,u.maxX+c,u.maxY+c,((e,i,n,s)=>function(t,e,i,n,s){for(const r of t)if(e<=r.x&&i<=r.y&&n>=r.x&&s>=r.y)return!0;const o=[new r(e,i),new r(e,s),new r(n,s),new r(n,i)];if(t.length>2)for(const e of o)if(jo(t,e))return!0;for(let e=0;e(u||(u=Po(e)),i.queryIntersectsFeature(l,e,n,u,this.z,t.transform,o,t.pixelPosMatrix))))}return p}loadMatchingFeature(t,e,i,n,s,r,o,a,l,c,g){const h=this.bucketLayerIDs[e];if(r&&!function(t,e){for(let i=0;i=0)return!0;return!1}(r,h))return;const u=this.sourceLayerCoder.decode(i),d=this.vtLayers[u].feature(n);if(s.needGeometry){const t=Mo(d,!0);if(!s.filter(new Xs(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!s.filter(new Xs(this.tileID.overscaledZ),d))return;const p=this.getId(d,u);for(let e=0;e{const o=e instanceof Ns?e.get(r):null;return o&&o.evaluate?o.evaluate(i,n,s):o}))}function Yg(t){let e=1/0,i=1/0,n=-1/0,s=-1/0;for(const r of t)e=Math.min(e,r.x),i=Math.min(i,r.y),n=Math.max(n,r.x),s=Math.max(s,r.y);return{minX:e,minY:i,maxX:n,maxY:s}}function Ng(t,e){return e-t}function Og(t,e,i,n,s){const o=[];for(let a=0;a=n&&g.x>=n||(a.x>=n?a=new r(n,a.y+(n-a.x)/(g.x-a.x)*(g.y-a.y))._round():g.x>=n&&(g=new r(n,a.y+(n-a.x)/(g.x-a.x)*(g.y-a.y))._round()),a.y>=s&&g.y>=s||(a.y>=s?a=new r(a.x+(s-a.y)/(g.y-a.y)*(g.x-a.x),s)._round():g.y>=s&&(g=new r(a.x+(s-a.y)/(g.y-a.y)*(g.x-a.x),s)._round()),c&&a.equals(c[c.length-1])||(c=[a],o.push(c)),c.push(g)))))}}return o}_s("FeatureIndex",Eg,{omit:["rawTileData","sourceLayerCoder"]});class Ug extends r{constructor(t,e,i,n){super(t,e),this.angle=i,void 0!==n&&(this.segment=n)}clone(){return new Ug(this.x,this.y,this.angle,this.segment)}}function jg(t,e,i,n,s){if(void 0===e.segment||0===i)return!0;let r=e,o=e.segment+1,a=0;for(;a>-i/2;){if(o--,o<0)return!1;a-=t[o].dist(r),r=t[o]}a+=t[o].dist(t[o+1]),o++;const l=[];let c=0;for(;an;)c-=l.shift().angleDelta;if(c>s)return!1;o++,a+=e.dist(i)}return!0}function Qg(t){let e=0;for(let i=0;ic){const g=(c-l)/r,h=Ge.number(n.x,s.x,g),u=Ge.number(n.y,s.y,g),d=new Ug(h,u,s.angleTo(n),i);return d._round(),!o||jg(t,d,a,o,e)?d:void 0}l+=r}}function eh(t,e,i,n,s,r,o,a,l){const c=qg(n,r,o),g=$g(n,s),h=g*o,u=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h=0&&C=0&&f=0&&u+c<=g){const i=new Ug(C,f,m,e);i._round(),n&&!jg(t,i,r,n,s)||d.push(i)}}h+=p}return a||d.length||o||(d=ih(t,h/2,i,n,s,r,o,!0,l)),d}_s("Anchor",Ug);const nh=Tc;function sh(t,e,i,n){const s=[],o=t.image,a=o.pixelRatio,l=o.paddedRect.w-2*nh,c=o.paddedRect.h-2*nh;let g={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom};const h=o.stretchX||[[0,l]],u=o.stretchY||[[0,c]],d=(t,e)=>t+e[1]-e[0],p=h.reduce(d,0),m=u.reduce(d,0),I=l-p,C=c-m;let f=0,A=p,y=0,b=m,_=0,v=I,x=0,w=C;if(o.content&&n){const e=o.content,i=e[2]-e[0],n=e[3]-e[1];(o.textFitWidth||o.textFitHeight)&&(g=$c(t)),f=rh(h,0,e[0]),y=rh(u,0,e[1]),A=rh(h,e[0],e[2]),b=rh(u,e[1],e[3]),_=e[0]-f,x=e[1]-y,v=i-A,w=n-b}const S=g.x1,k=g.y1,Z=g.x2-S,B=g.y2-k,G=(t,n,s,l)=>{const c=ah(t.stretch-f,A,Z,S),g=lh(t.fixed-_,v,t.stretch,p),h=ah(n.stretch-y,b,B,k),u=lh(n.fixed-x,w,n.stretch,m),d=ah(s.stretch-f,A,Z,S),I=lh(s.fixed-_,v,s.stretch,p),C=ah(l.stretch-y,b,B,k),G=lh(l.fixed-x,w,l.stretch,m),R=new r(c,h),V=new r(d,h),T=new r(d,C),W=new r(c,C),J=new r(g/a,u/a),z=new r(I/a,G/a),P=e*Math.PI/180;if(P){const t=Math.sin(P),e=Math.cos(P),i=[e,-t,t,e];R._matMult(i),V._matMult(i),W._matMult(i),T._matMult(i)}const M=t.stretch+t.fixed,X=n.stretch+n.fixed;return{tl:R,tr:V,bl:W,br:T,tex:{x:o.paddedRect.x+nh+M,y:o.paddedRect.y+nh+X,w:s.stretch+s.fixed-M,h:l.stretch+l.fixed-X},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:J,pixelOffsetBR:z,minFontScaleX:v/a/Z,minFontScaleY:w/a/B,isSDF:i}};if(n&&(o.stretchX||o.stretchY)){const t=oh(h,I,p),e=oh(u,C,m);for(let i=0;i0&&(n=Math.max(10,n),this.circleDiameter=n)}else{const c=(null===(h=o.image)||void 0===h?void 0:h.content)&&(o.image.textFitWidth||o.image.textFitHeight)?$c(o):{x1:o.left,y1:o.top,x2:o.right,y2:o.bottom};c.y1=c.y1*a-l[0],c.y2=c.y2*a+l[2],c.x1=c.x1*a-l[3],c.x2=c.x2*a+l[1];const u=o.collisionPadding;if(u&&(c.x1-=u[0]*a,c.y1-=u[1]*a,c.x2+=u[2]*a,c.y2+=u[3]*a),g){const t=new r(c.x1,c.y1),e=new r(c.x2,c.y1),i=new r(c.x1,c.y2),n=new r(c.x2,c.y2),s=g*Math.PI/180;t._rotate(s),e._rotate(s),i._rotate(s),n._rotate(s),c.x1=Math.min(t.x,e.x,i.x,n.x),c.x2=Math.max(t.x,e.x,i.x,n.x),c.y1=Math.min(t.y,e.y,i.y,n.y),c.y2=Math.max(t.y,e.y,i.y,n.y)}t.emplaceBack(e.x,e.y,c.x1,c.y1,c.x2,c.y2,i,n,s)}this.boxEndIndex=t.length}}class gh{constructor(t=[],e=hh){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.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,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 s=t-1>>1,r=e[s];if(i(n,r)>=0)break;e[t]=r,t=s}e[t]=n}_down(t){const{data:e,compare:i}=this,n=this.length>>1,s=e[t];for(;t=0)break;e[t]=r,t=n}e[t]=s}}function hh(t,e){return te?1:0}function uh(t,e=1,i=!1){let n=1/0,s=1/0,o=-1/0,a=-1/0;const l=t[0];for(let t=0;to)&&(o=e.x),(!t||e.y>a)&&(a=e.y)}const c=Math.min(o-n,a-s);let g=c/2;const h=new gh([],dh);if(0===c)return new r(n,s);for(let e=n;eu.d||!u.d)&&(u=i),i.max-u.d<=e||(g=i.h/2,h.push(new ph(i.p.x-g,i.p.y-g,g,t)),h.push(new ph(i.p.x+g,i.p.y-g,g,t)),h.push(new ph(i.p.x-g,i.p.y+g,g,t)),h.push(new ph(i.p.x+g,i.p.y+g,g,t)),d+=4)}return u.p}function dh(t,e){return e.max-t.max}function ph(t,e,i,n){this.p=new r(t,e),this.h=i,this.d=function(t,e){let i=!1,n=1/0;for(let s=0;st.y!=a.y>t.y&&t.x<(a.x-s.x)*(t.y-s.y)/(a.y-s.y)+s.x&&(i=!i),n=Math.min(n,Oo(t,s,a))}}return(i?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}var mh;t.ar=void 0,(mh=t.ar||(t.ar={}))[mh.center=1]="center",mh[mh.left=2]="left",mh[mh.right=3]="right",mh[mh.top=4]="top",mh[mh.bottom=5]="bottom",mh[mh["top-left"]=6]="top-left",mh[mh["top-right"]=7]="top-right",mh[mh["bottom-left"]=8]="bottom-left",mh[mh["bottom-right"]=9]="bottom-right";const Ih=7,Ch=Number.POSITIVE_INFINITY;function fh(t,e){return e[1]!==Ch?function(t,e,i){let n=0,s=0;switch(e=Math.abs(e),i=Math.abs(i),t){case"top-right":case"top-left":case"top":s=i-Ih;break;case"bottom-right":case"bottom-left":case"bottom":s=-i+Ih}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}return[n,s]}(t,e[0],e[1]):function(t,e){let i=0,n=0;e<0&&(e=0);const s=e/Math.SQRT2;switch(t){case"top-right":case"top-left":n=s-Ih;break;case"bottom-right":case"bottom-left":n=-s+Ih;break;case"bottom":n=-e+Ih;break;case"top":n=e-Ih}switch(t){case"top-right":case"bottom-right":i=-s;break;case"top-left":case"bottom-left":i=s;break;case"left":i=e;break;case"right":i=-e}return[i,n]}(t,e[0])}function Ah(t,e,i){var n;const s=t.layout,r=null===(n=s.get("text-variable-anchor-offset"))||void 0===n?void 0:n.evaluate(e,{},i);if(r){const t=r.values,e=[];for(let i=0;it*nc));n.startsWith("top")?s[1]-=Ih:n.startsWith("bottom")&&(s[1]+=Ih),e[i+1]=s}return new $t(e)}const o=s.get("text-variable-anchor");if(o){let n;n=void 0!==t._unevaluatedLayout.getValue("text-radial-offset")?[s.get("text-radial-offset").evaluate(e,{},i)*nc,Ch]:s.get("text-offset").evaluate(e,{},i).map((t=>t*nc));const r=[];for(const t of o)r.push(t,fh(t,n));return new $t(r)}return null}function yh(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function bh(e,i,n,s,r,o,a,l,c,g,h){let u=o.textMaxSize.evaluate(i,{});void 0===u&&(u=a);const d=e.layers[0].layout,p=d.get("icon-offset").evaluate(i,{},h),m=vh(n.horizontal),I=a/24,C=e.tilePixelRatio*I,f=e.tilePixelRatio*u/24,A=e.tilePixelRatio*l,y=e.tilePixelRatio*d.get("symbol-spacing"),b=d.get("text-padding")*e.tilePixelRatio,_=function(t,e,i,n=1){const s=t.get("icon-padding").evaluate(e,{},i),r=s&&s.values;return[r[0]*n,r[1]*n,r[2]*n,r[3]*n]}(d,i,h,e.tilePixelRatio),x=d.get("text-max-angle")/180*Math.PI,w="viewport"!==d.get("text-rotation-alignment")&&"point"!==d.get("symbol-placement"),S="map"===d.get("icon-rotation-alignment")&&"point"!==d.get("symbol-placement"),k=d.get("symbol-placement"),Z=y/2,B=d.get("icon-text-fit");let G;s&&"none"!==B&&(e.allowVerticalPlacement&&n.vertical&&(G=tg(s,n.vertical,B,d.get("icon-text-fit-padding"),p,I)),m&&(s=tg(s,m,B,d.get("icon-text-fit-padding"),p,I)));const R=(l,u)=>{u.x<0||u.x>=Wo||u.y<0||u.y>=Wo||function(e,i,n,s,r,o,a,l,c,g,h,u,d,p,m,I,C,f,A,y,b,_,x,w,S){const k=e.addToLineVertexArray(i,n);let Z,B,G,R,V=0,T=0,W=0,J=0,z=-1,P=-1;const M={};let X=po("");if(e.allowVerticalPlacement&&s.vertical){const t=l.layout.get("text-rotate").evaluate(b,{},w)+90;G=new ch(c,i,g,h,u,s.vertical,d,p,m,t),a&&(R=new ch(c,i,g,h,u,a,C,f,m,t))}if(r){const n=l.layout.get("icon-rotate").evaluate(b,{}),s="none"!==l.layout.get("icon-text-fit"),o=sh(r,n,x,s),d=a?sh(a,n,x,s):void 0;B=new ch(c,i,g,h,u,r,C,f,!1,n),V=4*o.length;const p=e.iconSizeData;let m=null;"source"===p.kind?(m=[ig*l.layout.get("icon-size").evaluate(b,{})],m[0]>ng&&v(`${e.layerIds[0]}: Value for "icon-size" is >= ${eg}. Reduce your "icon-size".`)):"composite"===p.kind&&(m=[ig*_.compositeIconSizes[0].evaluate(b,{},w),ig*_.compositeIconSizes[1].evaluate(b,{},w)],(m[0]>ng||m[1]>ng)&&v(`${e.layerIds[0]}: Value for "icon-size" is >= ${eg}. Reduce your "icon-size".`)),e.addSymbols(e.icon,o,m,y,A,b,t.ai.none,i,k.lineStartIndex,k.lineLength,-1,w),z=e.icon.placedSymbolArray.length-1,d&&(T=4*d.length,e.addSymbols(e.icon,d,m,y,A,b,t.ai.vertical,i,k.lineStartIndex,k.lineLength,-1,w),P=e.icon.placedSymbolArray.length-1)}const F=Object.keys(s.horizontal);for(const n of F){const r=s.horizontal[n];if(!Z){X=po(r.text);const t=l.layout.get("text-rotate").evaluate(b,{},w);Z=new ch(c,i,g,h,u,r,d,p,m,t)}const a=1===r.positionedLines.length;if(W+=_h(e,i,r,o,l,m,b,I,k,s.vertical?t.ai.horizontal:t.ai.horizontalOnly,a?F:[n],M,z,_,w),a)break}s.vertical&&(J+=_h(e,i,s.vertical,o,l,m,b,I,k,t.ai.vertical,["vertical"],M,P,_,w));const K=Z?Z.boxStartIndex:e.collisionBoxArray.length,H=Z?Z.boxEndIndex:e.collisionBoxArray.length,L=G?G.boxStartIndex:e.collisionBoxArray.length,E=G?G.boxEndIndex:e.collisionBoxArray.length,D=B?B.boxStartIndex:e.collisionBoxArray.length,Y=B?B.boxEndIndex:e.collisionBoxArray.length,N=R?R.boxStartIndex:e.collisionBoxArray.length,O=R?R.boxEndIndex:e.collisionBoxArray.length;let U=-1;const j=(t,e)=>t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;U=j(Z,U),U=j(G,U),U=j(B,U),U=j(R,U);const Q=U>-1?1:0;Q&&(U*=S/nc),e.glyphOffsetArray.length>=dg.MAX_GLYPHS&&v("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,b.sortKey);const q=Ah(l,b,w),[$,tt]=function(e,i){const n=e.length,s=null==i?void 0:i.values;if((null==s?void 0:s.length)>0)for(let i=0;i=0?M.right:-1,M.center>=0?M.center:-1,M.left>=0?M.left:-1,M.vertical||-1,z,P,X,K,H,L,E,D,Y,N,O,g,W,J,V,T,Q,0,d,U,$,tt)}(e,u,l,n,s,r,G,e.layers[0],e.collisionBoxArray,i.index,i.sourceLayerIndex,e.index,C,[b,b,b,b],w,c,A,_,S,p,i,o,g,h,a)};if("line"===k)for(const t of Og(i.geometry,0,0,Wo,Wo)){const i=eh(t,y,x,n.vertical||m,s,24,f,e.overscaling,Wo);for(const n of i)m&&xh(e,m.text,Z,n)||R(t,n)}else if("line-center"===k){for(const t of i.geometry)if(t.length>1){const e=th(t,x,n.vertical||m,s,24,f);e&&R(t,e)}}else if("Polygon"===i.type)for(const t of Ai(i.geometry,0)){const e=uh(t,16);R(t[0],new Ug(e.x,e.y,0))}else if("LineString"===i.type)for(const t of i.geometry)R(t,new Ug(t[0].x,t[0].y,0));else if("Point"===i.type)for(const t of i.geometry)for(const e of t)R([e],new Ug(e.x,e.y,0))}function _h(t,e,i,n,s,o,a,l,c,g,h,u,d,p,m){const I=function(t,e,i,n,s,o,a,l){const c=n.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,g=[];for(const t of e.positionedLines)for(const n of t.positionedGlyphs){if(!n.rect)continue;const o=n.rect||{};let h=Rc+1,u=!0,d=1,p=0;const m=(s||l)&&n.vertical,I=n.metrics.advance*n.scale/2;if(l&&e.verticalizable&&(p=t.lineOffset/2-(n.imageName?-(nc-n.metrics.width*n.scale)/2:(n.scale-1)*nc)),n.imageName){const t=a[n.imageName];u=t.sdf,d=t.pixelRatio,h=Tc/d}const C=s?[n.x+I,n.y]:[0,0];let f=s?[0,0]:[n.x+I+i[0],n.y+i[1]-p],A=[0,0];m&&(A=f,f=[0,0]);const y=n.metrics.isDoubleResolution?2:1,b=(n.metrics.left-h)*n.scale-I+f[0],_=(-n.metrics.top-h)*n.scale+f[1],v=b+o.w/y*n.scale/d,x=_+o.h/y*n.scale/d,w=new r(b,_),S=new r(v,_),k=new r(b,x),Z=new r(v,x);if(m){const t=new r(-I,I-Pc),e=-Math.PI/2,i=nc/2-I,s=new r(5-Pc-i,-(n.imageName?i:0)),o=new r(...A);w._rotateAround(e,t)._add(s)._add(o),S._rotateAround(e,t)._add(s)._add(o),k._rotateAround(e,t)._add(s)._add(o),Z._rotateAround(e,t)._add(s)._add(o)}if(c){const t=Math.sin(c),e=Math.cos(c),i=[e,-t,t,e];w._matMult(i),S._matMult(i),k._matMult(i),Z._matMult(i)}const B=new r(0,0),G=new r(0,0);g.push({tl:w,tr:S,bl:k,br:Z,tex:o,writingMode:e.writingMode,glyphOffset:C,sectionIndex:n.sectionIndex,isSDF:u,pixelOffsetTL:B,pixelOffsetBR:G,minFontScaleX:0,minFontScaleY:0})}return g}(0,i,l,s,o,a,n,t.allowVerticalPlacement),C=t.textSizeData;let f=null;"source"===C.kind?(f=[ig*s.layout.get("text-size").evaluate(a,{})],f[0]>ng&&v(`${t.layerIds[0]}: Value for "text-size" is >= ${eg}. Reduce your "text-size".`)):"composite"===C.kind&&(f=[ig*p.compositeTextSizes[0].evaluate(a,{},m),ig*p.compositeTextSizes[1].evaluate(a,{},m)],(f[0]>ng||f[1]>ng)&&v(`${t.layerIds[0]}: Value for "text-size" is >= ${eg}. Reduce your "text-size".`)),t.addSymbols(t.text,I,f,l,o,a,g,e,c.lineStartIndex,c.lineLength,d,m);for(const e of h)u[e]=t.text.placedSymbolArray.length-1;return 4*I.length}function vh(t){for(const e in t)return t[e];return null}function xh(t,e,i,n){const s=t.compareText;if(e in s){const t=s[e];for(let e=t.length-1;e>=0;e--)if(n.dist(t[e])>4;if(1!==n)throw new Error(`Got v${n} data when expected v1.`);const s=wh[15&i];if(!s)throw new Error("Unrecognized array type.");const[r]=new Uint16Array(t,2,1),[o]=new Uint32Array(t,4,1);return new Sh(o,r,s,t)}constructor(t,e=64,i=Float64Array,n){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=i,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const s=wh.indexOf(this.ArrayType),r=2*t*this.ArrayType.BYTES_PER_ELEMENT,o=t*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-o%8)%8;if(s<0)throw new Error(`Unexpected typed array class: ${i}.`);n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+o+a,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+r+o+a),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+o+a,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+s]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=t,this.coords[this._pos++]=e,i}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return kh(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,i,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:r,nodeSize:o}=this,a=[0,s.length-1,0],l=[];for(;a.length;){const c=a.pop()||0,g=a.pop()||0,h=a.pop()||0;if(g-h<=o){for(let o=h;o<=g;o++){const a=r[2*o],c=r[2*o+1];a>=t&&a<=i&&c>=e&&c<=n&&l.push(s[o])}continue}const u=h+g>>1,d=r[2*u],p=r[2*u+1];d>=t&&d<=i&&p>=e&&p<=n&&l.push(s[u]),(0===c?t<=d:e<=p)&&(a.push(h),a.push(u-1),a.push(1-c)),(0===c?i>=d:n>=p)&&(a.push(u+1),a.push(g),a.push(1-c))}return l}within(t,e,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:s,nodeSize:r}=this,o=[0,n.length-1,0],a=[],l=i*i;for(;o.length;){const c=o.pop()||0,g=o.pop()||0,h=o.pop()||0;if(g-h<=r){for(let i=h;i<=g;i++)Rh(s[2*i],s[2*i+1],t,e)<=l&&a.push(n[i]);continue}const u=h+g>>1,d=s[2*u],p=s[2*u+1];Rh(d,p,t,e)<=l&&a.push(n[u]),(0===c?t-i<=d:e-i<=p)&&(o.push(h),o.push(u-1),o.push(1-c)),(0===c?t+i>=d:e+i>=p)&&(o.push(u+1),o.push(g),o.push(1-c))}return a}}function kh(t,e,i,n,s,r){if(s-n<=i)return;const o=n+s>>1;Zh(t,e,o,n,s,r),kh(t,e,i,n,o-1,1-r),kh(t,e,i,o+1,s,1-r)}function Zh(t,e,i,n,s,r){for(;s>n;){if(s-n>600){const o=s-n+1,a=i-n+1,l=Math.log(o),c=.5*Math.exp(2*l/3),g=.5*Math.sqrt(l*c*(o-c)/o)*(a-o/2<0?-1:1);Zh(t,e,i,Math.max(n,Math.floor(i-a*c/o+g)),Math.min(s,Math.floor(i+(o-a)*c/o+g)),r)}const o=e[2*i+r];let a=n,l=s;for(Bh(t,e,n,i),e[2*s+r]>o&&Bh(t,e,n,s);ao;)l--}e[2*n+r]===o?Bh(t,e,n,l):(l++,Bh(t,e,l,s)),l<=i&&(n=l+1),i<=l&&(s=l-1)}}function Bh(t,e,i,n){Gh(t,i,n),Gh(e,2*i,2*n),Gh(e,2*i+1,2*n+1)}function Gh(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function Rh(t,e,i,n){const s=t-i,r=e-n;return s*s+r*r}var Vh;t.bf=void 0,(Vh=t.bf||(t.bf={})).create="create",Vh.load="load",Vh.fullLoad="fullLoad";let Th=null,Wh=[];const Jh=1e3/60,zh="loadTime",Ph="fullLoadTime",Mh={mark(t){performance.mark(t)},frame(t){const e=t;null!=Th&&Wh.push(e-Th),Th=e},clearMetrics(){Th=null,Wh=[],performance.clearMeasures(zh),performance.clearMeasures(Ph);for(const e in t.bf)performance.clearMarks(t.bf[e])},getPerformanceMetrics(){performance.measure(zh,t.bf.create,t.bf.load),performance.measure(Ph,t.bf.create,t.bf.fullLoad);const e=performance.getEntriesByName(zh)[0].duration,i=performance.getEntriesByName(Ph)[0].duration,n=Wh.length,s=1/(Wh.reduce(((t,e)=>t+e),0)/n/1e3),r=Wh.filter((t=>t>Jh)).reduce(((t,e)=>t+(e-Jh)/Jh),0);return{loadTime:e,fullLoadTime:i,fps:s,percentDroppedFrames:r/(n+r)*100,totalFrames:n}}};t.$=class extends cr{},t.A=ra,t.B=Is,t.C=function(t){if(null==S){const e=t.navigator?t.navigator.userAgent:null;S=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return S},t.D=Os,t.E=D,t.F=class{constructor(t,e){this.target=t,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Sg((()=>this.process())),this.subscription=function(t,e,i,n){return t.addEventListener(e,i,!1),{unsubscribe:()=>{t.removeEventListener(e,i,!1)}}}(this.target,"message",(t=>this.receive(t))),this.globalScope=w(self)?t:window}registerMessageHandler(t,e){this.messageHandlers[t]=e}sendAsync(t,e){return new Promise(((i,n)=>{const s=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[s]={resolve:i,reject:n},e&&e.signal.addEventListener("abort",(()=>{delete this.resolveRejects[s];const e={id:s,type:"",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(e)}),{once:!0});const r=[],o=Object.assign(Object.assign({},t),{id:s,sourceMapId:this.mapId,origin:location.origin,data:Ss(t.data,r)});this.target.postMessage(o,{transfer:r})}))}receive(t){const e=t.data,i=e.id;if(!("file://"!==e.origin&&"file://"!==location.origin&&e.origin!==location.origin||e.targetMapId&&this.mapId!==e.targetMapId)){if(""===e.type){delete this.tasks[i];const t=this.abortControllers[i];return delete this.abortControllers[i],void(t&&t.abort())}if(w(self)||e.mustQueue)return this.tasks[i]=e,this.taskQueue.push(i),void this.invoker.trigger();this.processTask(i,e)}}process(){if(0===this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(t,e)}processTask(t,i){return e(this,void 0,void 0,(function*(){if(""===i.type){const e=this.resolveRejects[t];if(delete this.resolveRejects[t],!e)return;return void(i.error?e.reject(ks(i.error)):e.resolve(ks(i.data)))}if(!this.messageHandlers[i.type])return void this.completeTask(t,new Error(`Could not find a registered handler for ${i.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const e=ks(i.data),n=new AbortController;this.abortControllers[t]=n;try{const s=yield this.messageHandlers[i.type](i.sourceMapId,e,n);this.completeTask(t,null,s)}catch(e){this.completeTask(t,e)}}))}completeTask(t,e,i){const n=[];delete this.abortControllers[t];const s={id:t,type:"",sourceMapId:this.mapId,origin:location.origin,error:e?Ss(e):null,data:Ss(i,n)};this.target.postMessage(s,{transfer:n})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},t.G=z,t.H=function(){var t=new ra(16);return ra!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.I=Wc,t.J=function(t,e,i){var n,s,r,o,a,l,c,g,h,u,d,p,m=i[0],I=i[1],C=i[2];return e===t?(t[12]=e[0]*m+e[4]*I+e[8]*C+e[12],t[13]=e[1]*m+e[5]*I+e[9]*C+e[13],t[14]=e[2]*m+e[6]*I+e[10]*C+e[14],t[15]=e[3]*m+e[7]*I+e[11]*C+e[15]):(s=e[1],r=e[2],o=e[3],a=e[4],l=e[5],c=e[6],g=e[7],h=e[8],u=e[9],d=e[10],p=e[11],t[0]=n=e[0],t[1]=s,t[2]=r,t[3]=o,t[4]=a,t[5]=l,t[6]=c,t[7]=g,t[8]=h,t[9]=u,t[10]=d,t[11]=p,t[12]=n*m+a*I+h*C+e[12],t[13]=s*m+l*I+u*C+e[13],t[14]=r*m+c*I+d*C+e[14],t[15]=o*m+g*I+p*C+e[15]),t},t.K=function(t,e,i){var n=i[0],s=i[1],r=i[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.L=aa,t.M=function(t,e){const i={};for(let n=0;n{const e=window.document.createElement("video");return e.muted=!0,new Promise((i=>{e.onloadstart=()=>{i(e)};for(const i of t){const t=window.document.createElement("source");F(i)||(e.crossOrigin="Anonymous"),t.src=i,e.appendChild(t)}}))},t.a4=function(){return f++},t.a5=Rr,t.a6=dg,t.a7=Bn,t.a8=Mo,t.a9=Xs,t.aA=function(t){t=t.slice();const e=Object.create(null);for(let i=0;i{"source"in t&&n[t.source]?i.push({command:"removeLayer",args:[t.id]}):r.push(t)})),i=i.concat(s),function(t,e,i){e=e||[];const n=(t=t||[]).map(it),s=e.map(it),r=t.reduce(nt,{}),o=e.reduce(nt,{}),a=n.slice(),l=Object.create(null);let c,g,h,u,d;for(let t=0,e=0;t@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((t,i,n,s)=>{const r=n||s;return e[i]=!r||r.toLowerCase(),""})),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e},t.ac=function(t,e){const i=[];for(const n in t)n in e||i.push(n);return i},t.ad=m,t.ae=function(t,e,i){var n=Math.sin(i),s=Math.cos(i),r=e[0],o=e[1],a=e[2],l=e[3],c=e[4],g=e[5],h=e[6],u=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s+c*n,t[1]=o*s+g*n,t[2]=a*s+h*n,t[3]=l*s+u*n,t[4]=c*s-r*n,t[5]=g*s-o*n,t[6]=h*s-a*n,t[7]=u*s-l*n,t},t.af=function(t){var e=new ra(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.ag=ga,t.ah=function(t,e){let i=0,n=0;if("constant"===t.kind)n=t.layoutSize;else if("source"!==t.kind){const{interpolationType:s,minZoom:r,maxZoom:o}=t,a=s?m(Re.interpolationFactor(s,e,r,o),0,1):0;"camera"===t.kind?n=Ge.number(t.minSize,t.maxSize,a):i=a}return{uSizeT:i,uSize:n}},t.aj=function(t,{uSize:e,uSizeT:i},{lowerSize:n,upperSize:s}){return"source"===t.kind?n/ig:"composite"===t.kind?Ge.number(n/ig,s/ig,i):e},t.ak=cg,t.al=function(t,e,i,n){const s=e.y-t.y,o=e.x-t.x,a=n.y-i.y,l=n.x-i.x,c=a*o-l*s;if(0===c)return null;const g=(l*(t.y-i.y)-a*(t.x-i.x))/c;return new r(t.x+g*o,t.y+g*s)},t.am=Og,t.an=Ko,t.ao=oa,t.ap=function(t){let e=1/0,i=1/0,n=-1/0,s=-1/0;for(const r of t)e=Math.min(e,r.x),i=Math.min(i,r.y),n=Math.max(n,r.x),s=Math.max(s,r.y);return[e,i,n,s]},t.aq=nc,t.as=rg,t.at=function(t,e){var i=e[0],n=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],g=e[8],h=e[9],u=e[10],d=e[11],p=e[12],m=e[13],I=e[14],C=e[15],f=i*a-n*o,A=i*l-s*o,y=i*c-r*o,b=n*l-s*a,_=n*c-r*a,v=s*c-r*l,x=g*m-h*p,w=g*I-u*p,S=g*C-d*p,k=h*I-u*m,Z=h*C-d*m,B=u*C-d*I,G=f*B-A*Z+y*k+b*S-_*w+v*x;return G?(t[0]=(a*B-l*Z+c*k)*(G=1/G),t[1]=(s*Z-n*B-r*k)*G,t[2]=(m*v-I*_+C*b)*G,t[3]=(u*_-h*v-d*b)*G,t[4]=(l*S-o*B-c*w)*G,t[5]=(i*B-s*S+r*w)*G,t[6]=(I*y-p*v-C*A)*G,t[7]=(g*v-u*y+d*A)*G,t[8]=(o*Z-a*S+c*x)*G,t[9]=(n*S-i*Z-r*x)*G,t[10]=(p*_-m*y+C*f)*G,t[11]=(h*y-g*_-d*f)*G,t[12]=(a*w-o*k-l*x)*G,t[13]=(i*k-n*w+s*x)*G,t[14]=(m*A-p*b-I*f)*G,t[15]=(g*b-h*A+u*f)*G,t):null},t.au=yh,t.av=jc,t.aw=Sh,t.ax=function(){const t={},e=Y.$version;for(const i in Y.$root){const n=Y.$root[i];if(n.required){let s=null;s="version"===i?e:"array"===n.type?[]:{},null!=s&&(t[i]=s)}}return t},t.ay=Zs,t.az=M,t.b=k,t.b0=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.b1=function(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t[3]=e[3]*i[3],t},t.b2=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},t.b3=I,t.b4=Mg,t.b5=Tg,t.b6=function(t,e,i,n,s){var r,o=1/Math.tan(e/2);return t[0]=o/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=s&&s!==1/0?(t[10]=(s+n)*(r=1/(n-s)),t[14]=2*s*n*r):(t[10]=-1,t[14]=-2*n),t},t.b7=function(t,e,i){var n=Math.sin(i),s=Math.cos(i),r=e[4],o=e[5],a=e[6],l=e[7],c=e[8],g=e[9],h=e[10],u=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*s+c*n,t[5]=o*s+g*n,t[6]=a*s+h*n,t[7]=l*s+u*n,t[8]=c*s-r*n,t[9]=g*s-o*n,t[10]=h*s-a*n,t[11]=u*s-l*n,t},t.b8=d,t.b9=p,t.bA=function(t){return t.message===V},t.bB=bn,t.bC=Ms,t.ba=function(t){return t*Math.PI/180},t.bb=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},t.bc=class extends lr{},t.bd=kg,t.be=Mh,t.bg=P,t.bh=function(t,e){W.REGISTERED_PROTOCOLS[t]=e},t.bi=function(t){delete W.REGISTERED_PROTOCOLS[t]},t.bj=function(t,e){const i={};for(let n=0;nt*nc))}let A=a?"center":n.get("text-justify").evaluate(s,{},e.canonical);const y="point"===n.get("symbol-placement")?n.get("text-max-width").evaluate(s,{},e.canonical)*nc:1/0,b=()=>{e.bucket.allowVerticalPlacement&&Gs(r)&&(p.vertical=Fc(m,e.glyphMap,e.glyphPositions,e.imagePositions,g,y,o,I,"left",d,C,t.ai.vertical,!0,u,h))};if(!a&&f){const i=new Set;if("auto"===A)for(let t=0;te(void 0,void 0,void 0,(function*(){if(0===t.byteLength)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(t)],{type:"image/png"});try{return createImageBitmap(e)}catch(t){throw new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),t.e=C,t.f=t=>new Promise(((e,i)=>{const n=new Image;n.onload=()=>{e(n),URL.revokeObjectURL(n.src),n.onload=null,window.requestAnimationFrame((()=>{n.src=Z}))},n.onerror=()=>i(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const s=new Blob([new Uint8Array(t)],{type:"image/png"});n.src=t.byteLength?URL.createObjectURL(s):Z})),t.g=J,t.h=(t,e)=>X(C(t,{type:"json"}),e),t.i=w,t.j=E,t.k=L,t.l=(t,e)=>X(C(t,{type:"arrayBuffer"}),e),t.m=X,t.n=function(t){return new Sc(t).readFields(Zc,[])},t.o=Aa,t.p=Vc,t.q=$s,t.r=ms,t.s=F,t.t=As,t.u=Bs,t.v=Y,t.w=v,t.x=ps,t.y=function([t,e,i]){return e+=90,e*=Math.PI/180,i*=Math.PI/180,{x:t*Math.cos(e)*Math.sin(i),y:t*Math.sin(e)*Math.sin(i),z:t*Math.cos(i)}},t.z=Ge})),i("worker",["./shared"],(function(t){class e{constructor(t){this.keyCache={},t&&this.replace(t)}replace(t){this._layerConfigs={},this._layers={},this.update(t,[])}update(e,i){for(const i of e){this._layerConfigs[i.id]=i;const e=this._layers[i.id]=t.aB(i);e._featureFilter=t.a7(e.filter),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(const t of i)delete this.keyCache[t],delete this._layerConfigs[t],delete this._layers[t];this.familiesBySource={};const n=t.bj(Object.values(this._layerConfigs),this.keyCache);for(const t of n){const e=t.map((t=>this._layers[t.id])),i=e[0];if("none"===i.visibility)continue;const n=i.source||"";let s=this.familiesBySource[n];s||(s=this.familiesBySource[n]={});const r=i.sourceLayer||"_geojsonTileLayer";let o=s[r];o||(o=s[r]=[]),o.push(e)}}}class i{constructor(e){const i={},n=[];for(const t in e){const s=e[t],r=i[t]={};for(const t in s){const e=s[+t];if(!e||0===e.bitmap.width||0===e.bitmap.height)continue;const i={x:0,y:0,w:e.bitmap.width+2,h:e.bitmap.height+2};n.push(i),r[t]={rect:i,metrics:e.metrics}}}const{w:s,h:r}=t.p(n),o=new t.o({width:s||1,height:r||1});for(const n in e){const s=e[n];for(const e in s){const r=s[+e];if(!r||0===r.bitmap.width||0===r.bitmap.height)continue;const a=i[n][e].rect;t.o.copy(r.bitmap,o,{x:0,y:0},{x:a.x+1,y:a.y+1},r.bitmap)}}this.image=o,this.positions=i}}t.bk("GlyphAtlas",i);class n{constructor(e){this.tileID=new t.S(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId,this.inFlightDependencies=[]}parse(e,n,r,o){return t._(this,void 0,void 0,(function*(){this.status="parsing",this.data=e,this.collisionBoxArray=new t.a5;const a=new t.bl(Object.keys(e.layers).sort()),l=new t.bm(this.tileID,this.promoteId);l.bucketLayerIDs=[];const c={},g={featureIndex:l,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:r},h=n.familiesBySource[this.source];for(const i in h){const n=e.layers[i];if(!n)continue;1===n.version&&t.w(`Vector tile source "${this.source}" layer "${i}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const o=a.encode(i),u=[];for(let t=0;t=i.maxzoom||"none"!==i.visibility&&(s(e,this.zoom,r),(c[i.id]=i.createBucket({index:l.bucketLayerIDs.length,layers:e,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:o,sourceID:this.source})).populate(u,g,this.tileID.canonical),l.bucketLayerIDs.push(e.map((t=>t.id))))}}const u=t.aG(g.glyphDependencies,(t=>Object.keys(t).map(Number)));this.inFlightDependencies.forEach((t=>null==t?void 0:t.abort())),this.inFlightDependencies=[];let d=Promise.resolve({});if(Object.keys(u).length){const t=new AbortController;this.inFlightDependencies.push(t),d=o.sendAsync({type:"GG",data:{stacks:u,source:this.source,tileID:this.tileID,type:"glyphs"}},t)}const p=Object.keys(g.iconDependencies);let m=Promise.resolve({});if(p.length){const t=new AbortController;this.inFlightDependencies.push(t),m=o.sendAsync({type:"GI",data:{icons:p,source:this.source,tileID:this.tileID,type:"icons"}},t)}const I=Object.keys(g.patternDependencies);let C=Promise.resolve({});if(I.length){const t=new AbortController;this.inFlightDependencies.push(t),C=o.sendAsync({type:"GI",data:{icons:I,source:this.source,tileID:this.tileID,type:"patterns"}},t)}const[f,A,y]=yield Promise.all([d,m,C]),b=new i(f),_=new t.bn(A,y);for(const e in c){const i=c[e];i instanceof t.a6?(s(i.layers,this.zoom,r),t.bo({bucket:i,glyphMap:f,glyphPositions:b.positions,imageMap:A,imagePositions:_.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):i.hasPattern&&(i instanceof t.bp||i instanceof t.bq||i instanceof t.br)&&(s(i.layers,this.zoom,r),i.addFeatures(g,this.tileID.canonical,_.patternPositions))}return this.status="done",{buckets:Object.values(c).filter((t=>!t.isEmpty())),featureIndex:l,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:b.image,imageAtlas:_,glyphMap:this.returnDependencies?f:null,iconMap:this.returnDependencies?A:null,glyphPositions:this.returnDependencies?b.positions:null}}))}}function s(e,i,n){const s=new t.a9(i);for(const t of e)t.recalculate(s,n)}class r{constructor(t,e,i){this.actor=t,this.layerIndex=e,this.availableImages=i,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(e,i){return t._(this,void 0,void 0,(function*(){const n=yield t.l(e.request,i);try{return{vectorTile:new t.bs.VectorTile(new t.bt(n.data)),rawData:n.data,cacheControl:n.cacheControl,expires:n.expires}}catch(t){const i=new Uint8Array(n.data);let s=`Unable to parse the tile at ${e.request.url}, `;throw s+=31===i[0]&&139===i[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${t.message}`,new Error(s)}}))}loadTile(e){return t._(this,void 0,void 0,(function*(){const i=e.uid,s=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.bu(e.request),r=new n(e);this.loading[i]=r;const o=new AbortController;r.abort=o;try{const n=yield this.loadVectorTile(e,o);if(delete this.loading[i],!n)return null;const a=n.rawData,l={};n.expires&&(l.expires=n.expires),n.cacheControl&&(l.cacheControl=n.cacheControl);const c={};if(s){const t=s.finish();t&&(c.resourceTiming=JSON.parse(JSON.stringify(t)))}r.vectorTile=n.vectorTile;const g=r.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[i]=r,this.fetching[i]={rawTileData:a,cacheControl:l,resourceTiming:c};try{const e=yield g;return t.e({rawTileData:a.slice(0)},e,l,c)}finally{delete this.fetching[i]}}catch(t){throw delete this.loading[i],r.status="done",this.loaded[i]=r,t}}))}reloadTile(e){return t._(this,void 0,void 0,(function*(){const i=e.uid;if(!this.loaded||!this.loaded[i])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const n=this.loaded[i];if(n.showCollisionBoxes=e.showCollisionBoxes,"parsing"===n.status){const e=yield n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor);let s;if(this.fetching[i]){const{rawTileData:n,cacheControl:r,resourceTiming:o}=this.fetching[i];delete this.fetching[i],s=t.e({rawTileData:n.slice(0)},e,r,o)}else s=e;return s}if("done"===n.status&&n.vectorTile)return n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor)}))}abortTile(e){return t._(this,void 0,void 0,(function*(){const t=this.loading,i=e.uid;t&&t[i]&&t[i].abort&&(t[i].abort.abort(),delete t[i])}))}removeTile(e){return t._(this,void 0,void 0,(function*(){this.loaded&&this.loaded[e.uid]&&delete this.loaded[e.uid]}))}}class o{constructor(){this.loaded={}}loadTile(e){return t._(this,void 0,void 0,(function*(){const{uid:i,encoding:n,rawImageData:s,redFactor:r,greenFactor:o,blueFactor:a,baseShift:l}=e,c=s.width+2,g=s.height+2,h=t.b(s)?new t.R({width:c,height:g},yield t.bv(s,-1,-1,c,g)):s,u=new t.bw(i,h,n,r,o,a,l);return this.loaded=this.loaded||{},this.loaded[i]=u,u}))}removeTile(t){const e=this.loaded,i=t.uid;e&&e[i]&&delete e[i]}}function a(t,e){if(0!==t.length){l(t[0],e);for(var i=1;i=Math.abs(a)?i-l+a:a-l+i,i=l}i+n>=0!=!!e&&t.reverse()}var c=t.bx((function t(e,i){var n,s=e&&e.type;if("FeatureCollection"===s)for(n=0;n>31}function w(t,e){for(var i=t.loadGeometry(),n=t.type,s=0,r=0,o=i.length,a=0;at},B=Math.fround||(G=new Float32Array(1),t=>(G[0]=+t,G[0]));var G;const R=3,V=5,T=6;class W{constructor(t){this.options=Object.assign(Object.create(Z),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){const{log:e,minZoom:i,maxZoom:n}=this.options;e&&console.time("total time");const s=`prepare ${t.length} points`;e&&console.time(s),this.points=t;const r=[];for(let e=0;e=i;t--)o=this.trees[t]=this._createTree(this._cluster(o,t));return e&&console.timeEnd("total time"),this}getClusters(t,e){let i=((t[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,t[1]));let s=180===t[2]?180:((t[2]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)i=-180,s=180;else if(i>s){const t=this.getClusters([i,n,180,r],e),o=this.getClusters([-180,n,s,r],e);return t.concat(o)}const o=this.trees[this._limitZoom(e)],a=o.range(P(i),M(r),P(s),M(n)),l=o.data,c=[];for(const t of a){const e=this.stride*t;c.push(l[e+V]>1?J(l,e,this.clusterProps):this.points[l[e+R]])}return c}getChildren(t){const e=this._getOriginId(t),i=this._getOriginZoom(t),n="No cluster with the specified id.",s=this.trees[i];if(!s)throw new Error(n);const r=s.data;if(e*this.stride>=r.length)throw new Error(n);const o=this.options.radius/(this.options.extent*Math.pow(2,i-1)),a=s.within(r[e*this.stride],r[e*this.stride+1],o),l=[];for(const e of a){const i=e*this.stride;r[i+4]===t&&l.push(r[i+V]>1?J(r,i,this.clusterProps):this.points[r[i+R]])}if(0===l.length)throw new Error(n);return l}getLeaves(t,e,i){const n=[];return this._appendLeaves(n,t,e=e||10,i=i||0,0),n}getTile(t,e,i){const n=this.trees[this._limitZoom(t)],s=Math.pow(2,t),{extent:r,radius:o}=this.options,a=o/r,l=(i-a)/s,c=(i+1+a)/s,g={features:[]};return this._addTileFeatures(n.range((e-a)/s,l,(e+1+a)/s,c),n.data,e,i,s,g),0===e&&this._addTileFeatures(n.range(1-a/s,l,1,c),n.data,s,i,s,g),e===s-1&&this._addTileFeatures(n.range(0,l,a/s,c),n.data,-1,i,s,g),g.features.length?g:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const i=this.getChildren(t);if(e++,1!==i.length)break;t=i[0].properties.cluster_id}return e}_appendLeaves(t,e,i,n,s){const r=this.getChildren(e);for(const e of r){const r=e.properties;if(r&&r.cluster?s+r.point_count<=n?s+=r.point_count:s=this._appendLeaves(t,r.cluster_id,i,n,s):s1;let l,c,g;if(a)l=z(e,t,this.clusterProps),c=e[t],g=e[t+1];else{const i=this.points[e[t+R]];l=i.properties;const[n,s]=i.geometry.coordinates;c=P(n),g=M(s)}const h={type:1,geometry:[[Math.round(this.options.extent*(c*s-i)),Math.round(this.options.extent*(g*s-n))]],tags:l};let u;u=a||this.options.generateId?e[t+R]:this.points[e[t+R]].id,void 0!==u&&(h.id=u),r.features.push(h)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,e){const{radius:i,extent:n,reduce:s,minPoints:r}=this.options,o=i/(n*Math.pow(2,e)),a=t.data,l=[],c=this.stride;for(let i=0;ie&&(d+=a[i+V])}if(d>u&&d>=r){let t,r=n*u,o=g*u,p=-1;const m=(i/c<<5)+(e+1)+this.points.length;for(const n of h){const l=n*c;if(a[l+2]<=e)continue;a[l+2]=e;const g=a[l+V];r+=a[l]*g,o+=a[l+1]*g,a[l+4]=m,s&&(t||(t=this._map(a,i,!0),p=this.clusterProps.length,this.clusterProps.push(t)),s(t,this._map(a,l)))}a[i+4]=m,l.push(r/d,o/d,1/0,m,-1,d),s&&l.push(p)}else{for(let t=0;t1)for(const t of h){const i=t*c;if(!(a[i+2]<=e)){a[i+2]=e;for(let t=0;t>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e,i){if(t[e+V]>1){const n=this.clusterProps[t[e+T]];return i?Object.assign({},n):n}const n=this.points[t[e+R]].properties,s=this.options.map(n);return i&&s===n?Object.assign({},s):s}}function J(t,e,i){return{type:"Feature",id:t[e+R],properties:z(t,e,i),geometry:{type:"Point",coordinates:[(n=t[e],360*(n-.5)),X(t[e+1])]}};var n}function z(t,e,i){const n=t[e+V],s=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?Math.round(n/100)/10+"k":n,r=t[e+T],o=-1===r?{}:Object.assign({},i[r]);return Object.assign(o,{cluster:!0,cluster_id:t[e+R],point_count:n,point_count_abbreviated:s})}function P(t){return t/360+.5}function M(t){const e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function X(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function F(t,e,i,n){let s=n;const r=e+(i-e>>1);let o,a=i-e;const l=t[e],c=t[e+1],g=t[i],h=t[i+1];for(let n=e+3;ns)o=n,s=e;else if(e===s){const t=Math.abs(n-r);tn&&(o-e>3&&F(t,e,o,n),t[o+2]=s,i-o>3&&F(t,o,i,n))}function K(t,e,i,n,s,r){let o=s-i,a=r-n;if(0!==o||0!==a){const l=((t-i)*o+(e-n)*a)/(o*o+a*a);l>1?(i=s,n=r):l>0&&(i+=o*l,n+=a*l)}return o=t-i,a=e-n,o*o+a*a}function H(t,e,i,n){const s={id:null==t?null:t,type:e,geometry:i,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===e||"MultiPoint"===e||"LineString"===e)L(s,i);else if("Polygon"===e)L(s,i[0]);else if("MultiLineString"===e)for(const t of i)L(s,t);else if("MultiPolygon"===e)for(const t of i)L(s,t[0]);return s}function L(t,e){for(let i=0;i0&&(o+=n?(s*l-a*r)/2:Math.sqrt(Math.pow(a-s,2)+Math.pow(l-r,2))),s=a,r=l}const a=e.length-3;e[2]=1,F(e,0,a,i),e[a+2]=1,e.size=Math.abs(o),e.start=0,e.end=e.size}function N(t,e,i,n){for(let s=0;s1?1:i}function j(t,e,i,n,s,r,o,a){if(n/=e,r>=(i/=e)&&o=n)return null;const l=[];for(const e of t){const t=e.geometry;let r=e.type;const o=0===s?e.minX:e.minY,c=0===s?e.maxX:e.maxY;if(o>=i&&c=n)continue;let g=[];if("Point"===r||"MultiPoint"===r)Q(t,g,i,n,s);else if("LineString"===r)q(t,g,i,n,s,!1,a.lineMetrics);else if("MultiLineString"===r)tt(t,g,i,n,s,!1);else if("Polygon"===r)tt(t,g,i,n,s,!0);else if("MultiPolygon"===r)for(const e of t){const t=[];tt(e,t,i,n,s,!0),t.length&&g.push(t)}if(g.length){if(a.lineMetrics&&"LineString"===r){for(const t of g)l.push(H(e.id,r,t,e.tags));continue}"LineString"!==r&&"MultiLineString"!==r||(1===g.length?(r="LineString",g=g[0]):r="MultiLineString"),"Point"!==r&&"MultiPoint"!==r||(r=3===g.length?"Point":"MultiPoint"),l.push(H(e.id,r,g,e.tags))}}return l.length?l:null}function Q(t,e,i,n,s){for(let r=0;r=i&&o<=n&&et(e,t[r],t[r+1],t[r+2])}}function q(t,e,i,n,s,r,o){let a=$(t);const l=0===s?it:nt;let c,g,h=t.start;for(let u=0;ui&&(g=l(a,d,p,I,C,i),o&&(a.start=h+c*g)):f>n?A=i&&(g=l(a,d,p,I,C,i),y=!0),A>n&&f<=n&&(g=l(a,d,p,I,C,n),y=!0),!r&&y&&(o&&(a.end=h+c*g),e.push(a),a=$(t)),o&&(h+=c)}let u=t.length-3;const d=t[u],p=t[u+1],m=0===s?d:p;m>=i&&m<=n&&et(a,d,p,t[u+2]),u=a.length-3,r&&u>=3&&(a[u]!==a[0]||a[u+1]!==a[1])&&et(a,a[0],a[1],a[2]),a.length&&e.push(a)}function $(t){const e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function tt(t,e,i,n,s,r){for(const o of t)q(o,e,i,n,s,r,!1)}function et(t,e,i,n){t.push(e,i,n)}function it(t,e,i,n,s,r){const o=(r-e)/(n-e);return et(t,r,i+(s-i)*o,1),o}function nt(t,e,i,n,s,r){const o=(r-i)/(s-i);return et(t,e+(n-e)*o,r,1),o}function st(t,e){const i=[];for(let n=0;n0&&e.size<(s?o:n))return void(i.numPoints+=e.length/3);const a=[];for(let t=0;to)&&(i.numSimplified++,a.push(e[t],e[t+1])),i.numPoints++;s&&function(t,e){let i=0;for(let e=0,n=t.length,s=n-2;e0===e)for(let e=0,i=t.length;e24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");let n=function(t,e){const i=[];if("FeatureCollection"===t.type)for(let n=0;n1&&console.time("creation"),u=this.tiles[h]=lt(t,e,i,n,l),this.tileCoords.push({z:e,x:i,y:n}),c)){c>1&&console.timeEnd("creation");const t=`z${e}`;this.stats[t]=(this.stats[t]||0)+1,this.total++}if(u.source=t,null==s){if(e===l.indexMaxZoom||u.numPoints<=l.indexMaxPoints)continue}else{if(e===l.maxZoom||e===s)continue;if(null!=s){const t=s-e;if(i!==r>>t||n!==o>>t)continue}}if(u.source=null,0===t.length)continue;c>1&&console.time("clipping");const d=.5*l.buffer/l.extent,p=.5-d,m=.5+d,I=1+d;let C=null,f=null,A=null,y=null,b=j(t,g,i-d,i+m,0,u.minX,u.maxX,l),_=j(t,g,i+p,i+I,0,u.minX,u.maxX,l);t=null,b&&(C=j(b,g,n-d,n+m,1,u.minY,u.maxY,l),f=j(b,g,n+p,n+I,1,u.minY,u.maxY,l),b=null),_&&(A=j(_,g,n-d,n+m,1,u.minY,u.maxY,l),y=j(_,g,n+p,n+I,1,u.minY,u.maxY,l),_=null),c>1&&console.timeEnd("clipping"),a.push(C||[],e+1,2*i,2*n),a.push(f||[],e+1,2*i,2*n+1),a.push(A||[],e+1,2*i+1,2*n),a.push(y||[],e+1,2*i+1,2*n+1)}}getTile(t,e,i){t=+t,e=+e,i=+i;const n=this.options,{extent:s,debug:r}=n;if(t<0||t>24)return null;const o=1<0;)c--,g>>=1,h>>=1,l=this.tiles[dt(c,g,h)];return l&&l.source?(r>1&&console.time("drilling down"),this.splitTile(l.source,c,g,h,t,e,i),r>1&&console.timeEnd("drilling down"),this.tiles[a]?ot(this.tiles[a],s):null):null}}function dt(t,e,i){return 32*((1<{o.properties=t;const e={};for(const t of a)e[t]=n[t].evaluate(r,o);return e},e.reduce=(t,e)=>{o.properties=e;for(const e of a)r.accumulated=t[e],t[e]=s[e].evaluate(r,o)},e}(e)).load((yield this._pendingData).features):(s=yield this._pendingData,new ut(s,e.geojsonVtOptions)),this.loaded={};const i={};if(n){const t=n.finish();t&&(i.resourceTiming={},i.resourceTiming[e.source]=JSON.parse(JSON.stringify(t)))}return i}catch(e){if(delete this._pendingRequest,t.bA(e))return{abandoned:!0};throw e}var s}))}getData(){return t._(this,void 0,void 0,(function*(){return this._pendingData}))}reloadTile(t){const e=this.loaded;return e&&e[t.uid]?super.reloadTile(t):this.loadTile(t)}loadAndProcessGeoJSON(e,i){return t._(this,void 0,void 0,(function*(){let n=yield this.loadGeoJSON(e,i);if(delete this._pendingRequest,"object"!=typeof n)throw new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`);if(c(n,!0),e.filter){const i=t.bB(e.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===i.result)throw new Error(i.value.map((t=>`${t.key}: ${t.message}`)).join(", "));const s=n.features.filter((t=>i.value.evaluate({zoom:0},t)));n={type:"FeatureCollection",features:s}}return n}))}loadGeoJSON(e,i){return t._(this,void 0,void 0,(function*(){const{promoteId:n}=e;if(e.request){const s=yield t.h(e.request,i);return this._dataUpdateable=mt(s.data,n)?It(s.data,n):void 0,s.data}if("string"==typeof e.data)try{const t=JSON.parse(e.data);return this._dataUpdateable=mt(t,n)?It(t,n):void 0,t}catch(t){throw new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`)}if(!e.dataDiff)throw new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${e.source}`);return function(t,e,i){var n,s,r,o;if(e.removeAll&&t.clear(),e.remove)for(const i of e.remove)t.delete(i);if(e.add)for(const n of e.add){const e=pt(n,i);null!=e&&t.set(e,n)}if(e.update)for(const i of e.update){let e=t.get(i.id);if(null==e)continue;const a=!i.removeAllProperties&&((null===(n=i.removeProperties)||void 0===n?void 0:n.length)>0||(null===(s=i.addOrUpdateProperties)||void 0===s?void 0:s.length)>0);if((i.newGeometry||i.removeAllProperties||a)&&(e=Object.assign({},e),t.set(i.id,e),a&&(e.properties=Object.assign({},e.properties))),i.newGeometry&&(e.geometry=i.newGeometry),i.removeAllProperties)e.properties={};else if((null===(r=i.removeProperties)||void 0===r?void 0:r.length)>0)for(const t of i.removeProperties)Object.prototype.hasOwnProperty.call(e.properties,t)&&delete e.properties[t];if((null===(o=i.addOrUpdateProperties)||void 0===o?void 0:o.length)>0)for(const{key:t,value:n}of i.addOrUpdateProperties)e.properties[t]=n}}(this._dataUpdateable,e.dataDiff,n),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}}))}removeSource(e){return t._(this,void 0,void 0,(function*(){this._pendingRequest&&this._pendingRequest.abort()}))}getClusterExpansionZoom(t){return this._geoJSONIndex.getClusterExpansionZoom(t.clusterId)}getClusterChildren(t){return this._geoJSONIndex.getChildren(t.clusterId)}getClusterLeaves(t){return this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset)}}class ft{constructor(e){this.self=e,this.actor=new t.F(e),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(t,e)=>{if(this.externalWorkerSourceTypes[t])throw new Error(`Worker source with name "${t}" already registered.`);this.externalWorkerSourceTypes[t]=e},this.self.addProtocol=t.bh,this.self.removeProtocol=t.bi,this.self.registerRTLTextPlugin=e=>{if(t.bC.isParsed())throw new Error("RTL text plugin already registered.");t.bC.setMethods(e)},this.actor.registerMessageHandler("LDT",((t,e)=>this._getDEMWorkerSource(t,e.source).loadTile(e))),this.actor.registerMessageHandler("RDT",((e,i)=>t._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(e,i.source).removeTile(i)})))),this.actor.registerMessageHandler("GCEZ",((e,i)=>t._(this,void 0,void 0,(function*(){return this._getWorkerSource(e,i.type,i.source).getClusterExpansionZoom(i)})))),this.actor.registerMessageHandler("GCC",((e,i)=>t._(this,void 0,void 0,(function*(){return this._getWorkerSource(e,i.type,i.source).getClusterChildren(i)})))),this.actor.registerMessageHandler("GCL",((e,i)=>t._(this,void 0,void 0,(function*(){return this._getWorkerSource(e,i.type,i.source).getClusterLeaves(i)})))),this.actor.registerMessageHandler("LD",((t,e)=>this._getWorkerSource(t,e.type,e.source).loadData(e))),this.actor.registerMessageHandler("GD",((t,e)=>this._getWorkerSource(t,e.type,e.source).getData())),this.actor.registerMessageHandler("LT",((t,e)=>this._getWorkerSource(t,e.type,e.source).loadTile(e))),this.actor.registerMessageHandler("RT",((t,e)=>this._getWorkerSource(t,e.type,e.source).reloadTile(e))),this.actor.registerMessageHandler("AT",((t,e)=>this._getWorkerSource(t,e.type,e.source).abortTile(e))),this.actor.registerMessageHandler("RMT",((t,e)=>this._getWorkerSource(t,e.type,e.source).removeTile(e))),this.actor.registerMessageHandler("RS",((e,i)=>t._(this,void 0,void 0,(function*(){if(!this.workerSources[e]||!this.workerSources[e][i.type]||!this.workerSources[e][i.type][i.source])return;const t=this.workerSources[e][i.type][i.source];delete this.workerSources[e][i.type][i.source],void 0!==t.removeSource&&t.removeSource(i)})))),this.actor.registerMessageHandler("RM",(e=>t._(this,void 0,void 0,(function*(){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e]})))),this.actor.registerMessageHandler("SR",((e,i)=>t._(this,void 0,void 0,(function*(){this.referrer=i})))),this.actor.registerMessageHandler("SRPS",((t,e)=>this._syncRTLPluginState(t,e))),this.actor.registerMessageHandler("IS",((e,i)=>t._(this,void 0,void 0,(function*(){this.self.importScripts(i)})))),this.actor.registerMessageHandler("SI",((t,e)=>this._setImages(t,e))),this.actor.registerMessageHandler("UL",((e,i)=>t._(this,void 0,void 0,(function*(){this._getLayerIndex(e).update(i.layers,i.removedIds)})))),this.actor.registerMessageHandler("SL",((e,i)=>t._(this,void 0,void 0,(function*(){this._getLayerIndex(e).replace(i)}))))}_setImages(e,i){return t._(this,void 0,void 0,(function*(){this.availableImages[e]=i;for(const t in this.workerSources[e]){const n=this.workerSources[e][t];for(const t in n)n[t].availableImages=i}}))}_syncRTLPluginState(e,i){return t._(this,void 0,void 0,(function*(){if(t.bC.isParsed())return t.bC.getState();if("loading"!==i.pluginStatus)return t.bC.setState(i),i;const e=i.pluginURL;if(this.self.importScripts(e),t.bC.isParsed()){const i={pluginStatus:"loaded",pluginURL:e};return t.bC.setState(i),i}throw t.bC.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${e}`)}))}_getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}_getLayerIndex(t){let i=this.layerIndexes[t];return i||(i=this.layerIndexes[t]=new e),i}_getWorkerSource(t,e,i){if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),!this.workerSources[t][e][i]){const n={sendAsync:(e,i)=>(e.targetMapId=t,this.actor.sendAsync(e,i))};switch(e){case"vector":this.workerSources[t][e][i]=new r(n,this._getLayerIndex(t),this._getAvailableImages(t));break;case"geojson":this.workerSources[t][e][i]=new Ct(n,this._getLayerIndex(t),this._getAvailableImages(t));break;default:this.workerSources[t][e][i]=new this.externalWorkerSourceTypes[e](n,this._getLayerIndex(t),this._getAvailableImages(t))}}return this.workerSources[t][e][i]}_getDEMWorkerSource(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new o),this.demWorkerSources[t][e]}}return t.i(self)&&(self.worker=new ft(self)),ft})),i("index",["exports","./shared"],(function(t,e){var i="4.5.0";let n,s;const r={now:"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:t=>new Promise(((i,n)=>{const s=requestAnimationFrame(i);t.signal.addEventListener("abort",(()=>{cancelAnimationFrame(s),n(e.c())}))})),getImageData(t,e=0){return this.getImageCanvasContext(t).getImageData(-e,-e,t.width+2*e,t.height+2*e)},getImageCanvasContext(t){const e=window.document.createElement("canvas"),i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return e.width=t.width,e.height=t.height,i.drawImage(t,0,0,t.width,t.height),i},resolveURL:t=>(n||(n=document.createElement("a")),n.href=t,n.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(null==s&&(s=matchMedia("(prefers-reduced-motion: reduce)")),s.matches)}};class o{static testProp(t){if(!o.docStyle)return t[0];for(let e=0;e{window.removeEventListener("click",o.suppressClickInternal,!0)}),0)}static getScale(t){const e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}static getPoint(t,i,n){const s=i.boundingClientRect;return new e.P((n.clientX-s.left)/i.x-t.clientLeft,(n.clientY-s.top)/i.y-t.clientTop)}static mousePos(t,e){const i=o.getScale(t);return o.getPoint(t,i,e)}static touchPos(t,e){const i=[],n=o.getScale(t);for(let s=0;s{l&&u(l),l=null,h=!0},c.onerror=()=>{g=!0,l=null},c.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(t){let i,n,s,r;t.resetRequestQueue=()=>{i=[],n=0,s=0,r={}},t.addThrottleControl=t=>{const e=s++;return r[e]=t,e},t.removeThrottleControl=t=>{delete r[t],l()},t.getImage=(t,n,s=!0)=>new Promise(((r,o)=>{a.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),e.e(t,{type:"image"}),i.push({abortController:n,requestParameters:t,supportImageRefresh:s,state:"queued",onError:t=>{o(t)},onSuccess:t=>{r(t)}}),l()}));const o=t=>e._(this,void 0,void 0,(function*(){t.state="running";const{requestParameters:i,supportImageRefresh:s,onError:r,onSuccess:o,abortController:a}=t,g=!1===s&&!e.i(self)&&!e.g(i.url)&&(!i.headers||Object.keys(i.headers).reduce(((t,e)=>t&&"accept"===e),!0));n++;const h=g?c(i,a):e.m(i,a);try{const i=yield h;delete t.abortController,t.state="completed",i.data instanceof HTMLImageElement||e.b(i.data)?o(i):i.data&&o({data:yield(u=i.data,"function"==typeof createImageBitmap?e.d(u):e.f(u)),cacheControl:i.cacheControl,expires:i.expires})}catch(e){delete t.abortController,r(e)}finally{n--,l()}var u})),l=()=>{const t=(()=>{for(const t of Object.keys(r))if(r[t]())return!0;return!1})()?e.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:e.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let e=n;e0;e++){const t=i.shift();t.abortController.signal.aborted?e--:o(t)}},c=(t,i)=>new Promise(((n,s)=>{const r=new Image,o=t.url,a=t.credentials;a&&"include"===a?r.crossOrigin="use-credentials":(a&&"same-origin"===a||!e.s(o))&&(r.crossOrigin="anonymous"),i.signal.addEventListener("abort",(()=>{r.src="",s(e.c())})),r.fetchPriority="high",r.onload=()=>{r.onerror=r.onload=null,n({data:r})},r.onerror=()=>{r.onerror=r.onload=null,i.signal.aborted||s(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},r.src=o}))}(d||(d={})),d.resetRequestQueue();class p{constructor(t){this._transformRequestFn=t}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function m(t){var i=new e.A(3);return i[0]=t[0],i[1]=t[1],i[2]=t[2],i}var I,C=function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t};I=new e.A(3),e.A!=Float32Array&&(I[0]=0,I[1]=0,I[2]=0);var f=function(t){var e=t[0],i=t[1];return e*e+i*i};function A(t){const e=[];if("string"==typeof t)e.push({id:"default",url:t});else if(t&&t.length>0){const i=[];for(const{id:n,url:s}of t){const t=`${n}${s}`;-1===i.indexOf(t)&&(i.push(t),e.push({id:n,url:s}))}}return e}function y(t,e,i){const n=t.split("?");return n[0]+=`${e}${i}`,n.join("?")}!function(){var t=new e.A(2);e.A!=Float32Array&&(t[0]=0,t[1]=0)}();class b{constructor(t,e,i,n){this.context=t,this.format=i,this.texture=t.gl.createTexture(),this.update(e,n)}update(t,i,n){const{width:s,height:r}=t,o=!(this.size&&this.size[0]===s&&this.size[1]===r||n),{context:a}=this,{gl:l}=a;if(this.useMipmap=Boolean(i&&i.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!i||!1!==i.premultiply)),o)this.size=[s,r],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||e.b(t)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,t):l.texImage2D(l.TEXTURE_2D,0,this.format,s,r,0,this.format,l.UNSIGNED_BYTE,t.data);else{const{x:i,y:o}=n||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||e.b(t)?l.texSubImage2D(l.TEXTURE_2D,0,i,o,l.RGBA,l.UNSIGNED_BYTE,t):l.texSubImage2D(l.TEXTURE_2D,0,i,o,s,r,l.RGBA,l.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D)}bind(t,e,i){const{context:n}=this,{gl:s}=n;s.bindTexture(s.TEXTURE_2D,this.texture),i!==s.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=s.LINEAR),t!==this.filter&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,t),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,i||t),this.filter=t),e!==this.wrap&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,e),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,e),this.wrap=e)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function _(t){const{userImage:e}=t;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}class v extends e.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new e.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:t,promiseResolve:e}of this.requestors)e(this._getImagesForIds(t));this.requestors=[]}}getImage(t){const i=this.images[t];if(i&&!i.data&&i.spriteData){const t=i.spriteData;i.data=new e.R({width:t.width,height:t.height},t.context.getImageData(t.x,t.y,t.width,t.height).data),i.spriteData=null}return i}addImage(t,e){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,e)&&(this.images[t]=e)}_validate(t,i){let n=!0;const s=i.data||i.spriteData;return this._validateStretch(i.stretchX,s&&s.width)||(this.fire(new e.j(new Error(`Image "${t}" has invalid "stretchX" value`))),n=!1),this._validateStretch(i.stretchY,s&&s.height)||(this.fire(new e.j(new Error(`Image "${t}" has invalid "stretchY" value`))),n=!1),this._validateContent(i.content,i)||(this.fire(new e.j(new Error(`Image "${t}" has invalid "content" value`))),n=!1),n}_validateStretch(t,e){if(!t)return!0;let i=0;for(const n of t){if(n[0]{let n=!0;if(!this.isLoaded())for(const e of t)this.images[e]||(n=!1);this.isLoaded()||n?e(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:e})}))}_getImagesForIds(t){const i={};for(const n of t){let t=this.getImage(n);t||(this.fire(new e.k("styleimagemissing",{id:n})),t=this.getImage(n)),t?i[n]={data:t.data.clone(),pixelRatio:t.pixelRatio,sdf:t.sdf,version:t.version,stretchX:t.stretchX,stretchY:t.stretchY,content:t.content,textFitWidth:t.textFitWidth,textFitHeight:t.textFitHeight,hasRenderCallback:Boolean(t.userImage&&t.userImage.render)}:e.w(`Image "${n}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return i}getPixelSize(){const{width:t,height:e}=this.atlasImage;return{width:t,height:e}}getPattern(t){const i=this.patterns[t],n=this.getImage(t);if(!n)return null;if(i&&i.position.version===n.version)return i.position;if(i)i.position.version=n.version;else{const i={w:n.data.width+2,h:n.data.height+2,x:0,y:0},s=new e.I(i,n);this.patterns[t]={bin:i,position:s}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const e=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new b(t,this.atlasImage,e.RGBA),this.atlasTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const e in this.patterns)t.push(this.patterns[e].bin);const{w:i,h:n}=e.p(t),s=this.atlasImage;s.resize({width:i||1,height:n||1});for(const t in this.patterns){const{bin:i}=this.patterns[t],n=i.x+1,r=i.y+1,o=this.getImage(t).data,a=o.width,l=o.height;e.R.copy(o,s,{x:0,y:0},{x:n,y:r},{width:a,height:l}),e.R.copy(o,s,{x:0,y:l-1},{x:n,y:r-1},{width:a,height:1}),e.R.copy(o,s,{x:0,y:0},{x:n,y:r+l},{width:a,height:1}),e.R.copy(o,s,{x:a-1,y:0},{x:n-1,y:r},{width:1,height:l}),e.R.copy(o,s,{x:0,y:0},{x:n+a,y:r},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const i of t){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const t=this.getImage(i);t||e.w(`Image with ID: "${i}" was not found`),_(t)&&this.updateImage(i,t)}}}const x=1e20;function w(t,e,i,n,s,r,o,a,l){for(let c=e;c-1);l++,r[l]=a,o[l]=c,o[l+1]=x}for(let a=0,l=0;a65535)throw new Error("glyphs > 65535 not supported");if(e.ranges[s])return{stack:t,id:i,glyph:n};if(!this.url)throw new Error("glyphsUrl is not set");if(!e.requests[s]){const i=k.loadGlyphRange(t,s,this.url,this.requestManager);e.requests[s]=i}const r=yield e.requests[s];for(const t in r)this._doesCharSupportLocalGlyph(+t)||(e.glyphs[+t]=r[+t]);return e.ranges[s]=!0,{stack:t,id:i,glyph:r[i]||null}}))}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(e.u["CJK Unified Ideographs"](t)||e.u["Hangul Syllables"](t)||e.u.Hiragana(t)||e.u.Katakana(t))}_tinySDF(t,i,n){const s=this.localIdeographFontFamily;if(!s)return;if(!this._doesCharSupportLocalGlyph(n))return;let r=t.tinySDF;if(!r){let e="400";/bold/i.test(i)?e="900":/medium/i.test(i)?e="500":/light/i.test(i)&&(e="200"),r=t.tinySDF=new k.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:s,fontWeight:e})}const o=r.draw(String.fromCharCode(n));return{id:n,bitmap:new e.o({width:o.width||60,height:o.height||60},o.data),metrics:{width:o.glyphWidth/2||24,height:o.glyphHeight/2||24,left:o.glyphLeft/2+.5||0,top:o.glyphTop/2-27.5||-8,advance:o.glyphAdvance/2||24,isDoubleResolution:!0}}}}k.loadGlyphRange=function(t,i,n,s){return e._(this,void 0,void 0,(function*(){const r=256*i,o=r+255,a=s.transformRequest(n.replace("{fontstack}",t).replace("{range}",`${r}-${o}`),"Glyphs"),l=yield e.l(a,new AbortController);if(!l||!l.data)throw new Error(`Could not load glyph range. range: ${i}, ${r}-${o}`);const c={};for(const t of e.n(l.data))c[t.id]=t;return c}))},k.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:n=.25,fontFamily:s="sans-serif",fontWeight:r="normal",fontStyle:o="normal"}={}){this.buffer=e,this.cutoff=n,this.radius=i;const a=this.size=t+4*e,l=this._createCanvas(a),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${o} ${r} ${t}px ${s}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a)}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:s,actualBoundingBoxRight:r}=this.ctx.measureText(t),o=Math.ceil(i),a=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(r-s))),l=Math.min(this.size-this.buffer,o+Math.ceil(n)),c=a+2*this.buffer,g=l+2*this.buffer,h=Math.max(c*g,0),u=new Uint8ClampedArray(h),d={data:u,width:c,height:g,glyphWidth:a,glyphHeight:l,glyphTop:o,glyphLeft:0,glyphAdvance:e};if(0===a||0===l)return d;const{ctx:p,buffer:m,gridInner:I,gridOuter:C}=this;p.clearRect(m,m,a,l),p.fillText(t,m,m+o);const f=p.getImageData(m,m,a,l);C.fill(x,0,h),I.fill(0,0,h);for(let t=0;t0?t*t:0,I[n]=t<0?t*t:0}}w(C,0,0,c,g,c,this.f,this.v,this.z),w(I,m,m,a,l,c,this.f,this.v,this.z);for(let t=0;t1&&(o=t[++r]);const l=Math.abs(a-o.left),c=Math.abs(a-o.right),g=Math.min(l,c);let h;const u=e/i*(n+1);if(o.isDash){const t=n-Math.abs(u);h=Math.sqrt(g*g+t*t)}else h=n-Math.sqrt(g*g+u*u);this.data[s+a]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(t){for(let e=t.length-1;e>=0;--e){const i=t[e],n=t[e+1];i.zeroLength?t.splice(e,1):n&&n.isDash===i.isDash&&(n.left=i.left,t.splice(e,1))}const e=t[0],i=t[t.length-1];e.isDash===i.isDash&&(e.left=i.left-this.width,i.right=e.right+this.width);const n=this.width*this.nextRow;let s=0,r=t[s];for(let e=0;e1&&(r=t[++s]);const i=Math.abs(e-r.left),o=Math.abs(e-r.right),a=Math.min(i,o);this.data[n+e]=Math.max(0,Math.min(255,(r.isDash?a:-a)+128))}}addDash(t,i){const n=i?7:0,s=2*n+1;if(this.nextRow+s>this.height)return e.w("LineAtlas out of space"),null;let r=0;for(let e=0;e{t.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[W]}numActive(){return Object.keys(this.active).length}}const z=Math.floor(r.hardwareConcurrency/2);let P,M;function X(){return P||(P=new J),P}J.workerCount=e.C(globalThis)?Math.max(Math.min(z,3),1):1;class F{constructor(t,i){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=i;const n=this.workerPool.acquire(i);for(let t=0;t{t.remove()})),this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,e){for(const i of this.actors)i.registerMessageHandler(t,e)}}function K(){return M||(M=new F(X(),e.G),M.registerMessageHandler("GR",((t,i,n)=>e.m(i,n)))),M}function H(t,i){const n=e.H();return e.J(n,n,[1,1,0]),e.K(n,n,[.5*t.width,.5*t.height,1]),e.L(n,n,t.calculatePosMatrix(i.toUnwrapped()))}function L(t,e,i,n,s,r){const o=function(t,e,i){if(t)for(const n of t){const t=e[n];if(t&&t.source===i&&"fill-extrusion"===t.type)return!0}else for(const t in e){const n=e[t];if(n.source===i&&"fill-extrusion"===n.type)return!0}return!1}(s&&s.layers,e,t.id),a=r.maxPitchScaleFactor(),l=t.tilesIn(n,a,o);l.sort(E);const c=[];for(const n of l)c.push({wrappedTileID:n.tileID.wrapped().key,queryResults:n.tile.queryRenderedFeatures(e,i,t._state,n.queryGeometry,n.cameraQueryGeometry,n.scale,s,r,a,H(t.transform,n.tileID))});const g=function(t){const e={},i={};for(const n of t){const t=n.queryResults,s=n.wrappedTileID,r=i[s]=i[s]||{};for(const i in t){const n=t[i],s=r[i]=r[i]||{},o=e[i]=e[i]||[];for(const t of n)s[t.featureIndex]||(s[t.featureIndex]=!0,o.push(t))}}return e}(c);for(const e in g)g[e].forEach((e=>{const i=e.feature,n=t.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=n}));return g}function E(t,e){const i=t.tileID,n=e.tileID;return i.overscaledZ-n.overscaledZ||i.canonical.y-n.canonical.y||i.wrap-n.wrap||i.canonical.x-n.canonical.x}function D(t,i,n){return e._(this,void 0,void 0,(function*(){let s=t;if(t.url?s=(yield e.h(i.transformRequest(t.url,"Source"),n)).data:yield r.frameAsync(n),!s)return null;const o=e.M(e.e(s,t),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in s&&s.vector_layers&&(o.vectorLayerIds=s.vector_layers.map((t=>t.id))),o}))}class Y{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):Array.isArray(t)&&(4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof e.N?new e.N(t.lng,t.lat):e.N.convert(t),this}setSouthWest(t){return this._sw=t instanceof e.N?new e.N(t.lng,t.lat):e.N.convert(t),this}extend(t){const i=this._sw,n=this._ne;let s,r;if(t instanceof e.N)s=t,r=t;else{if(!(t instanceof Y))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(Y.convert(t)):this.extend(e.N.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(e.N.convert(t)):this;if(s=t._sw,r=t._ne,!s||!r)return this}return i||n?(i.lng=Math.min(s.lng,i.lng),i.lat=Math.min(s.lat,i.lat),n.lng=Math.max(r.lng,n.lng),n.lat=Math.max(r.lat,n.lat)):(this._sw=new e.N(s.lng,s.lat),this._ne=new e.N(r.lng,r.lat)),this}getCenter(){return new e.N((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new e.N(this.getWest(),this.getNorth())}getSouthEast(){return new e.N(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:i,lat:n}=e.N.convert(t);let s=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(s=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&s}static convert(t){return t instanceof Y?t:t?new Y(t):t}static fromLngLat(t,i=0){const n=360*i/40075017,s=n/Math.cos(Math.PI/180*t.lat);return new Y(new e.N(t.lng-s,t.lat-n),new e.N(t.lng+s,t.lat+n))}}class N{constructor(t,e,i){this.bounds=Y.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=i||24}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const i=Math.pow(2,t.z),n=Math.floor(e.O(this.bounds.getWest())*i),s=Math.floor(e.Q(this.bounds.getNorth())*i),r=Math.ceil(e.O(this.bounds.getEast())*i),o=Math.ceil(e.Q(this.bounds.getSouth())*i);return t.x>=n&&t.x=s&&t.y{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return e.e({},this._options)}loadTile(t){return e._(this,void 0,void 0,(function*(){const e=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:this.map._requestManager.transformRequest(e,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};i.request.collectResourceTiming=this._collectResourceTiming;let n="RT";if(t.actor&&"expired"!==t.state){if("loading"===t.state)return new Promise(((e,i)=>{t.reloadPromise={resolve:e,reject:i}}))}else t.actor=this.dispatcher.getActor(),n="LT";t.abortController=new AbortController;try{const e=yield t.actor.sendAsync({type:n,data:i},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,e)}catch(e){if(delete t.abortController,t.aborted)return;if(e&&404!==e.status)throw e;this._afterTileLoadWorkerResponse(t,null)}}))}_afterTileLoadWorkerResponse(t,e){if(e&&e.resourceTiming&&(t.resourceTiming=e.resourceTiming),e&&this.map._refreshExpiredTiles&&t.setExpiryData(e),t.loadVectorData(e,this.map.painter),t.reloadPromise){const e=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(e.resolve).catch(e.reject)}}abortTile(t){return e._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.type,source:this.id}}))}))}unloadTile(t){return e._(this,void 0,void 0,(function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class U extends e.E{constructor(t,i,n,s){super(),this.id=t,this.dispatcher=n,this.setEventedParent(s),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=e.e({type:"raster"},i),e.e(this,e.M(i,["url","scheme","tileSize"]))}load(){return e._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new e.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield D(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,t&&(e.e(this,t),t.bounds&&(this.tileBounds=new N(t.bounds,this.minzoom,this.maxzoom)),this.fire(new e.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.k("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this.fire(new e.j(t))}}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load()}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}serialize(){return e.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return e._(this,void 0,void 0,(function*(){const e=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const i=yield d.getImage(this.map._requestManager.transformRequest(e,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(i&&i.data){this.map._refreshExpiredTiles&&i.cacheControl&&i.expires&&t.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});const e=this.map.painter.context,n=e.gl,s=i.data;t.texture=this.map.painter.getTileTexture(s.width),t.texture?t.texture.update(s,{useMipmap:!0}):(t.texture=new b(e,s,n.RGBA,{useMipmap:!0}),t.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST),e.extTextureFilterAnisotropic&&n.texParameterf(n.TEXTURE_2D,e.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.extTextureFilterAnisotropicMax)),t.state="loaded"}}catch(e){if(delete t.abortController,t.aborted)t.state="unloaded";else if(e)throw t.state="errored",e}}))}abortTile(t){return e._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)}))}unloadTile(t){return e._(this,void 0,void 0,(function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)}))}hasTransition(){return!1}}class j extends U{constructor(t,i,n,s){super(t,i,n,s),this.type="raster-dem",this.maxzoom=22,this._options=e.e({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift}loadTile(t){return e._(this,void 0,void 0,(function*(){const i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),n=this.map._requestManager.transformRequest(i,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const i=yield d.getImage(n,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(i&&i.data){const n=i.data;this.map._refreshExpiredTiles&&i.cacheControl&&i.expires&&t.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});const s=e.b(n)&&e.U()?n:yield this.readImageNow(n),r={type:this.type,uid:t.uid,source:this.id,rawImageData:s,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!t.actor||"expired"===t.state){t.actor=this.dispatcher.getActor();const e=yield t.actor.sendAsync({type:"LDT",data:r});t.dem=e,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}}catch(e){if(delete t.abortController,t.aborted)t.state="unloaded";else if(e)throw t.state="errored",e}}))}readImageNow(t){return e._(this,void 0,void 0,(function*(){if("undefined"!=typeof VideoFrame&&e.V()){const i=t.width+2,n=t.height+2;try{return new e.R({width:i,height:n},yield e.W(t,-1,-1,i,n))}catch(t){}}return r.getImageData(t,1)}))}_getNeighboringTiles(t){const i=t.canonical,n=Math.pow(2,i.z),s=(i.x-1+n)%n,r=0===i.x?t.wrap-1:t.wrap,o=(i.x+1+n)%n,a=i.x+1===n?t.wrap+1:t.wrap,l={};return l[new e.S(t.overscaledZ,r,i.z,s,i.y).key]={backfilled:!1},l[new e.S(t.overscaledZ,a,i.z,o,i.y).key]={backfilled:!1},i.y>0&&(l[new e.S(t.overscaledZ,r,i.z,s,i.y-1).key]={backfilled:!1},l[new e.S(t.overscaledZ,t.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new e.S(t.overscaledZ,a,i.z,o,i.y-1).key]={backfilled:!1}),i.y+10&&e.e(s,{resourceTiming:n}),this.fire(new e.k("data",Object.assign(Object.assign({},s),{sourceDataType:"metadata"}))),this.fire(new e.k("data",Object.assign(Object.assign({},s),{sourceDataType:"content"})))}catch(t){if(this._pendingLoads--,this._removed)return void this.fire(new e.k("dataabort",{dataType:"source"}));this.fire(new e.j(t))}}))}loaded(){return 0===this._pendingLoads}loadTile(t){return e._(this,void 0,void 0,(function*(){const e=t.actor?"RT":"LT";t.actor=this.actor;const i={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.abortController=new AbortController;const n=yield this.actor.sendAsync({type:e,data:i},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(n,this.map.painter,"RT"===e)}))}abortTile(t){return e._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0}))}unloadTile(t){return e._(this,void 0,void 0,(function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}})}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return e.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var q=e.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class $ extends e.E{constructor(t,e,i,n){super(),this.id=t,this.dispatcher=i,this.coordinates=e.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(n),this.options=e}load(t){return e._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new e.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const e=yield d.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,e&&e.data&&(this.image=e.data,t&&(this.coordinates=t),this._finishLoading())}catch(t){this._request=null,this._loaded=!0,this.fire(new e.j(t))}}))}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally((()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new e.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;const i=t.map(e.Z.fromLngLat);this.tileID=function(t){let i=1/0,n=1/0,s=-1/0,r=-1/0;for(const e of t)i=Math.min(i,e.x),n=Math.min(n,e.y),s=Math.max(s,e.x),r=Math.max(r,e.y);const o=Math.max(s-i,r-n),a=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),l=Math.pow(2,a);return new e.a1(a,Math.floor((i+s)/2*l),Math.floor((n+r)/2*l))}(i),this.minzoom=this.maxzoom=this.tileID.z;const n=i.map((t=>this.tileID.getTilePoint(t)._round()));return this._boundsArray=new e.$,this._boundsArray.emplaceBack(n[0].x,n[0].y,0,0),this._boundsArray.emplaceBack(n[1].x,n[1].y,e.X,0),this._boundsArray.emplaceBack(n[3].x,n[3].y,0,e.X),this._boundsArray.emplaceBack(n[2].x,n[2].y,e.X,e.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new e.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const t=this.map.painter.context,i=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,q.members)),this.boundsSegments||(this.boundsSegments=e.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new b(t,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let n=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,n=!0)}n&&this.fire(new e.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return e._(this,void 0,void 0,(function*(){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"}))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class tt extends ${constructor(t,e,i,n){super(t,e,i,n),this.roundZoom=!0,this.type="video",this.options=e}load(){return e._(this,void 0,void 0,(function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const e of t.urls)this.urls.push(this.map._requestManager.transformRequest(e,"Source").url);try{const t=yield e.a3(this.urls);if(this._loaded=!0,!t)return;this.video=t,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading()}catch(t){this.fire(new e.j(t))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const i=this.video.seekable;ti.end(0)?this.fire(new e.j(new e.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const t=this.map.painter.context,i=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,q.members)),this.boundsSegments||(this.boundsSegments=e.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new b(t,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let n=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,n=!0)}n&&this.fire(new e.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class et extends ${constructor(t,i,n,s){super(t,i,n,s),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some((t=>!Array.isArray(t)||2!==t.length||t.some((t=>"number"!=typeof t))))||this.fire(new e.j(new e.a2(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.j(new e.a2(`sources.${t}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new e.j(new e.a2(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new e.j(new e.a2(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new e.j(new e.a2(`sources.${t}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}load(){return e._(this,void 0,void 0,(function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new e.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}))}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context,n=i.gl;this.boundsBuffer||(this.boundsBuffer=i.createVertexBuffer(this._boundsArray,q.members)),this.boundsSegments||(this.boundsSegments=e.a0.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new b(i,this.canvas,n.RGBA,{premultiply:!0});let s=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,s=!0)}s&&this.fire(new e.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const it={},nt=t=>{switch(t){case"geojson":return Q;case"image":return $;case"raster":return U;case"raster-dem":return j;case"vector":return O;case"video":return tt;case"canvas":return et}return it[t]},st="RTLPluginLoaded";class rt extends e.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=K()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch((t=>{throw this.status="error",t}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return e._(this,arguments,void 0,(function*(t,e=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=r.resolveURL(t),!this.url)throw new Error(`requested url ${t} is invalid`);if("unavailable"===this.status){if(!e)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if("requested"===this.status)return this._requestImport()}))}_requestImport(){return e._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new e.k(st))}))}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}}let ot=null;function at(){return ot||(ot=new rt),ot}class lt{constructor(t,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=e.a4(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const e=t+this.timeAdded;ee.getLayer(t))).filter(Boolean);if(0!==t.length){n.layers=t,n.stateDependentLayerIds&&(n.stateDependentLayers=n.stateDependentLayerIds.map((e=>t.filter((t=>t.id===e))[0])));for(const e of t)i[e.id]=n}}return i}(t.buckets,i.style),this.hasSymbolBuckets=!1;for(const t in this.buckets){const i=this.buckets[t];if(i instanceof e.a6){if(this.hasSymbolBuckets=!0,!n)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const t in this.buckets){const i=this.buckets[t];if(i instanceof e.a6&&i.hasRTLText){this.hasRTLText=!0,at().lazyLoad();break}}this.queryPadding=0;for(const t in this.buckets){const e=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(t).queryRadius(e))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new e.a5}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const e in this.buckets){const i=this.buckets[e];i.uploadPending()&&i.upload(t)}const e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new b(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new b(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,i,n,s,r,o,a,l,c){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:n,cameraQueryGeometry:s,scale:r,tileSize:this.tileSize,pixelPosMatrix:c,transform:a,params:o,queryPadding:this.queryPadding*l},t,e,i):{}}querySourceFeatures(t,i){const n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;const s=n.loadVTLayers(),r=i&&i.sourceLayer?i.sourceLayer:"",o=s._geojsonTileLayer||s[r];if(!o)return;const a=e.a7(i&&i.filter),{z:l,x:c,y:g}=this.tileID.canonical,h={z:l,x:c,y:g};for(let i=0;it)e=!1;else if(i)if(this.expirationTime{this.remove(t,s)}),i)),this.data[n].push(s),this.order.push(n),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const i=t.wrapped().key,n=void 0===e?0:this.data[i].indexOf(e),s=this.data[i][n];return this.data[i].splice(n,1),s.timeout&&clearTimeout(s.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(s.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(t){const e=[];for(const i in this.data)for(const n of this.data[i])t(n.value)||e.push(n);for(const t of e)this.remove(t.value.tileID,t)}}class gt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,i,n){const s=String(i);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][s]=this.stateChanges[t][s]||{},e.e(this.stateChanges[t][s],n),null===this.deletedStates[t]){this.deletedStates[t]={};for(const e in this.state[t])e!==s&&(this.deletedStates[t][e]=null)}else if(this.deletedStates[t]&&null===this.deletedStates[t][s]){this.deletedStates[t][s]={};for(const e in this.state[t][s])n[e]||(this.deletedStates[t][s][e]=null)}else for(const e in n)this.deletedStates[t]&&this.deletedStates[t][s]&&null===this.deletedStates[t][s][e]&&delete this.deletedStates[t][s][e]}removeFeatureState(t,e,i){if(null===this.deletedStates[t])return;const n=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},i&&void 0!==e)null!==this.deletedStates[t][n]&&(this.deletedStates[t][n]=this.deletedStates[t][n]||{},this.deletedStates[t][n][i]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][n])for(i in this.deletedStates[t][n]={},this.stateChanges[t][n])this.deletedStates[t][n][i]=null;else this.deletedStates[t][n]=null;else this.deletedStates[t]=null}getState(t,i){const n=String(i),s=e.e({},(this.state[t]||{})[n],(this.stateChanges[t]||{})[n]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){const e=this.deletedStates[t][i];if(null===e)return{};for(const t in e)delete s[t]}return s}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(t,i){const n={};for(const t in this.stateChanges){this.state[t]=this.state[t]||{};const i={};for(const n in this.stateChanges[t])this.state[t][n]||(this.state[t][n]={}),e.e(this.state[t][n],this.stateChanges[t][n]),i[n]=this.state[t][n];n[t]=i}for(const t in this.deletedStates){this.state[t]=this.state[t]||{};const i={};if(null===this.deletedStates[t])for(const e in this.state[t])i[e]={},this.state[t][e]={};else for(const e in this.deletedStates[t]){if(null===this.deletedStates[t][e])this.state[t][e]={};else for(const i of Object.keys(this.deletedStates[t][e]))delete this.state[t][e][i];i[e]=this.state[t][e]}n[t]=n[t]||{},e.e(n[t],i)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(n).length)for(const e in t)t[e].setFeatureState(n,i)}}class ht extends e.E{constructor(t,e,i){super(),this.id=t,this.dispatcher=i,this.on("data",(t=>this._dataHandler(t))),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((t,e,i,n)=>{const s=new(nt(e.type))(t,e,i,n);if(s.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${s.id}`);return s})(t,e,i,this),this._tiles={},this._cache=new ct(0,(t=>this._unloadTile(t))),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new gt,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const t in this._tiles){const e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,i,n){return e._(this,void 0,void 0,(function*(){try{yield this._source.loadTile(t),this._tileLoaded(t,i,n)}catch(i){t.state="errored",404!==i.status?this._source.fire(new e.j(i,{tile:t})):this.update(this.transform,this.terrain)}}))}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new e.k("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const e in this._tiles){const i=this._tiles[e];i.upload(t),i.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map((t=>t.tileID)).sort(ut).map((t=>t.key))}getRenderableIds(t){const i=[];for(const e in this._tiles)this._isIdRenderable(e,t)&&i.push(this._tiles[e]);return t?i.sort(((t,i)=>{const n=t.tileID,s=i.tileID,r=new e.P(n.canonical.x,n.canonical.y)._rotate(this.transform.angle),o=new e.P(s.canonical.x,s.canonical.y)._rotate(this.transform.angle);return n.overscaledZ-s.overscaledZ||o.y-r.y||o.x-r.x})).map((t=>t.tileID.key)):i.map((t=>t.tileID)).sort(ut).map((t=>t.key))}hasRenderableParent(t){const e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)}_isIdRenderable(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)"errored"!==this._tiles[t].state&&this._reloadTile(t,"reloading")}}_reloadTile(t,i){return e._(this,void 0,void 0,(function*(){const e=this._tiles[t];e&&("loading"!==e.state&&(e.state=i),yield this._loadTile(e,t,i))}))}_tileLoaded(t,i,n){t.timeAdded=r.now(),"expired"===n&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(i,t),"raster-dem"===this.getSource().type&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new e.k("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const e=this.getRenderableIds();for(let n=0;n1||(Math.abs(i)>1&&(1===Math.abs(i+s)?i+=s:1===Math.abs(i-s)&&(i-=s)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,n),t.neighboringTiles&&t.neighboringTiles[r]&&(t.neighboringTiles[r].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,i,n){for(const s in this._tiles){let r=this._tiles[s];if(n[s]||!r.hasData()||r.tileID.overscaledZ<=e||r.tileID.overscaledZ>i)continue;let o=r.tileID;for(;r&&r.tileID.overscaledZ>e+1;){const t=r.tileID.scaledTo(r.tileID.overscaledZ-1);r=this._tiles[t.key],r&&r.hasData()&&(o=t)}let a=o;for(;a.overscaledZ>e;)if(a=a.scaledTo(a.overscaledZ-1),t[a.key]){n[o.key]=o;break}}}findLoadedParent(t,e){if(t.key in this._loadedParentTiles){const i=this._loadedParentTiles[t.key];return i&&i.tileID.overscaledZ>=e?i:null}for(let i=t.overscaledZ-1;i>=e;i--){const e=t.scaledTo(i),n=this._getLoadedTile(e);if(n)return n}}findLoadedSibling(t){return this._getLoadedTile(t)}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const i=Math.ceil(t.width/this._source.tileSize)+1,n=Math.ceil(t.height/this._source.tileSize)+1,s=Math.floor(i*n*(null===this._maxTileCacheZoomLevels?e.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),r="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,s):s;this._cache.setMaxSize(r)}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){const t={};for(const i in this._tiles){const n=this._tiles[i];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+e),t[n.tileID.key]=n}this._tiles=t;for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t in this._tiles)this._setTileReloadTimer(t,this._tiles[t])}}_updateCoveredAndRetainedTiles(t,e,i,n,s,o){const a={},l={},c=Object.keys(t),g=r.now();for(const i of c){const n=t[i],s=this._tiles[i];if(!s||0!==s.fadeEndTime&&s.fadeEndTime<=g)continue;const r=this.findLoadedParent(n,e),o=this.findLoadedSibling(n),c=r||o||null;c&&(this._addTile(c.tileID),a[c.tileID.key]=c.tileID),l[i]=n}this._retainLoadedChildren(l,n,i,t);for(const e in a)t[e]||(this._coveredTiles[e]=!0,t[e]=a[e]);if(o){const e={},i={};for(const t of s)this._tiles[t.key].hasData()?e[t.key]=t:i[t.key]=t;for(const n in i){const s=i[n].children(this._source.maxzoom);this._tiles[s[0].key]&&this._tiles[s[1].key]&&this._tiles[s[2].key]&&this._tiles[s[3].key]&&(e[s[0].key]=t[s[0].key]=s[0],e[s[1].key]=t[s[1].key]=s[1],e[s[2].key]=t[s[2].key]=s[2],e[s[3].key]=t[s[3].key]=s[3],delete i[n])}for(const n in i){const s=i[n],r=this.findLoadedParent(s,this._source.minzoom),o=this.findLoadedSibling(s),a=r||o||null;if(a){e[a.tileID.key]=t[a.tileID.key]=a.tileID;for(const t in e)e[t].isChildOf(a.tileID)&&delete e[t]}}for(const t in this._tiles)e[t]||(this._coveredTiles[t]=!0)}}update(t,i){if(!this._sourceLoaded||this._paused)return;let n;this.transform=t,this.terrain=i,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?n=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((t=>new e.S(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y))):(n=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i}),this._source.hasTile&&(n=n.filter((t=>this._source.hasTile(t))))):n=[];const s=t.coveringZoomLevel(this._source),r=Math.max(s-ht.maxOverzooming,this._source.minzoom),o=Math.max(s+ht.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const t={};for(const e of n)if(e.canonical.z>this._source.minzoom){const i=e.scaledTo(e.canonical.z-1);t[i.key]=i;const n=e.scaledTo(Math.max(this._source.minzoom,Math.min(e.canonical.z,5)));t[n.key]=n}n=n.concat(Object.values(t))}const a=0===n.length&&!this._updated&&this._didEmitContent;this._updated=!0,a&&this.fire(new e.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const l=this._updateRetainedTiles(n,s);dt(this._source.type)&&this._updateCoveredAndRetainedTiles(l,r,o,s,n,i);for(const t in l)this._tiles[t].clearFadeHold();const c=e.ac(this._tiles,l);for(const t of c){const e=this._tiles[t];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(t)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,e){var i;const n={},s={},r=Math.max(e-ht.maxOverzooming,this._source.minzoom),o=Math.max(e+ht.maxUnderzooming,this._source.minzoom),a={};for(const i of t){const t=this._addTile(i);n[i.key]=i,t.hasData()||ethis._source.maxzoom){const t=o.children(this._source.maxzoom)[0],e=this.getTile(t);if(e&&e.hasData()){n[t.key]=t;continue}}else{const t=o.children(this._source.maxzoom);if(n[t[0].key]&&n[t[1].key]&&n[t[2].key]&&n[t[3].key])continue}let a=t.wasRequested();for(let e=o.overscaledZ-1;e>=r;--e){const r=o.scaledTo(e);if(s[r.key])break;if(s[r.key]=!0,t=this.getTile(r),!t&&a&&(t=this._addTile(r)),t){const e=t.hasData();if((e||!(null===(i=this.map)||void 0===i?void 0:i.cancelPendingTileRequestsWhileZooming)||a)&&(n[r.key]=r),a=t.wasRequested(),e)break}}}return n}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let i,n=this._tiles[t].tileID;for(;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){i=this._loadedParentTiles[n.key];break}e.push(n.key);const t=n.scaledTo(n.overscaledZ-1);if(i=this._getLoadedTile(t),i)break;n=t}for(const t of e)this._loadedParentTiles[t]=i}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const t in this._tiles){const e=this._tiles[t].tileID,i=this._getLoadedTile(e);this._loadedSiblingTiles[e.key]=i}}_addTile(t){let i=this._tiles[t.key];if(i)return i;i=this._cache.getAndRemove(t),i&&(this._setTileReloadTimer(t.key,i),i.tileID=t,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,i)));const n=i;return i||(i=new lt(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(i,t.key,i.state)),i.uses++,this._tiles[t.key]=i,n||this._source.fire(new e.k("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(t,e){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const i=e.getExpiryTimeout();i&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),i))}_removeTile(t){const e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))}_dataHandler(t){const e=t.sourceDataType;"source"===t.dataType&&"metadata"===e&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===t.dataType&&"content"===e&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,i,n){const s=[],r=this.transform;if(!r)return s;const o=n?r.getCameraQueryGeometry(t):t,a=t.map((t=>r.pointCoordinate(t,this.terrain))),l=o.map((t=>r.pointCoordinate(t,this.terrain))),c=this.getIds();let g=1/0,h=1/0,u=-1/0,d=-1/0;for(const t of l)g=Math.min(g,t.x),h=Math.min(h,t.y),u=Math.max(u,t.x),d=Math.max(d,t.y);for(let t=0;t=0&&I[1].y+m>=0){const t=a.map((t=>o.getTilePoint(t))),e=l.map((t=>o.getTilePoint(t)));s.push({tile:n,tileID:o,queryGeometry:t,cameraQueryGeometry:e,scale:p})}}return s}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map((t=>this._tiles[t].tileID));for(const t of e)t.posMatrix=this.transform.calculatePosMatrix(t.toUnwrapped());return e}hasTransition(){if(this._source.hasTransition())return!0;if(dt(this._source.type)){const t=r.now();for(const e in this._tiles)if(this._tiles[e].fadeEndTime>=t)return!0}return!1}setFeatureState(t,e,i){this._state.updateState(t=t||"_geojsonTileLayer",e,i)}removeFeatureState(t,e,i){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,i)}getFeatureState(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)}setDependencies(t,e,i){const n=this._tiles[t];n&&n.setDependencies(e,i)}reloadTilesForDependencies(t,e){for(const i in this._tiles)this._tiles[i].hasDependency(t,e)&&this._reloadTile(i,"reloading");this._cache.filter((i=>!i.hasDependency(t,e)))}}function ut(t,e){const i=Math.abs(2*t.wrap)-+(t.wrap<0),n=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||n-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function dt(t){return"raster"===t||"image"===t||"video"===t}ht.maxOverzooming=10,ht.maxUnderzooming=3;class pt{constructor(t,e){this.reset(t,e)}reset(t,e){this.points=t||[],this._distances=[0];for(let t=1;t0?(s-o)/a:0;return this.points[r].mult(1-l).add(this.points[i].mult(l))}}function mt(t,e){let i=!0;return"always"===t||"never"!==t&&"never"!==e||(i=!1),i}class It{constructor(t,e,i){const n=this.boxCells=[],s=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(let t=0;tthis.width||n<0||e>this.height)return[];const a=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=n){if(s)return[{key:null,x1:t,y1:e,x2:i,y2:n}];for(let t=0;t0}hitTestCircle(t,e,i,n,s){const r=t-i,o=t+i,a=e-i,l=e+i;if(o<0||r>this.width||l<0||a>this.height)return!1;const c=[];return this._forEachCell(r,a,o,l,this._queryCellCircle,c,{hitTest:!0,overlapMode:n,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},s),c.length>0}_queryCell(t,e,i,n,s,r,o,a){const{seenUids:l,hitTest:c,overlapMode:g}=o,h=this.boxCells[s];if(null!==h){const s=this.bboxes;for(const o of h)if(!l.box[o]){l.box[o]=!0;const h=4*o,u=this.boxKeys[o];if(t<=s[h+2]&&e<=s[h+3]&&i>=s[h+0]&&n>=s[h+1]&&(!a||a(u))&&(!c||!mt(g,u.overlapMode))&&(r.push({key:u,x1:s[h],y1:s[h+1],x2:s[h+2],y2:s[h+3]}),c))return!0}}const u=this.circleCells[s];if(null!==u){const s=this.circles;for(const o of u)if(!l.circle[o]){l.circle[o]=!0;const h=3*o,u=this.circleKeys[o];if(this._circleAndRectCollide(s[h],s[h+1],s[h+2],t,e,i,n)&&(!a||a(u))&&(!c||!mt(g,u.overlapMode))){const t=s[h],e=s[h+1],i=s[h+2];if(r.push({key:u,x1:t-i,y1:e-i,x2:t+i,y2:e+i}),c)return!0}}}return!1}_queryCellCircle(t,e,i,n,s,r,o,a){const{circle:l,seenUids:c,overlapMode:g}=o,h=this.boxCells[s];if(null!==h){const t=this.bboxes;for(const e of h)if(!c.box[e]){c.box[e]=!0;const i=4*e,n=this.boxKeys[e];if(this._circleAndRectCollide(l.x,l.y,l.radius,t[i+0],t[i+1],t[i+2],t[i+3])&&(!a||a(n))&&!mt(g,n.overlapMode))return r.push(!0),!0}}const u=this.circleCells[s];if(null!==u){const t=this.circles;for(const e of u)if(!c.circle[e]){c.circle[e]=!0;const i=3*e,n=this.circleKeys[e];if(this._circlesCollide(t[i],t[i+1],t[i+2],l.x,l.y,l.radius)&&(!a||a(n))&&!mt(g,n.overlapMode))return r.push(!0),!0}}}_forEachCell(t,e,i,n,s,r,o,a){const l=this._convertToXCellCoord(t),c=this._convertToYCellCoord(e),g=this._convertToXCellCoord(i),h=this._convertToYCellCoord(n);for(let u=l;u<=g;u++)for(let l=c;l<=h;l++)if(s.call(this,t,e,i,n,this.xCellCount*l+u,r,o,a))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,i,n,s,r){const o=n-t,a=s-e,l=i+r;return l*l>o*o+a*a}_circleAndRectCollide(t,e,i,n,s,r,o){const a=(r-n)/2,l=Math.abs(t-(n+a));if(l>a+i)return!1;const c=(o-s)/2,g=Math.abs(e-(s+c));if(g>c+i)return!1;if(l<=a||g<=c)return!0;const h=l-a,u=g-c;return h*h+u*u<=i*i}}function Ct(t,i,n,s,r){const o=e.H();return i?(e.K(o,o,[1/r,1/r,1]),n||e.ae(o,o,s.angle)):e.L(o,s.labelPlaneMatrix,t),o}function ft(t,i,n,s,r){if(i){const i=e.af(t);return e.K(i,i,[r,r,1]),n||e.ae(i,i,-s.angle),i}return s.glCoordMatrix}function At(t,i,n){let s;n?(s=[t.x,t.y,n(t.x,t.y),1],e.ag(s,s,i)):(s=[t.x,t.y,0,1],function(t,e,i){const n=e[0],s=e[1];t[0]=i[0]*n+i[4]*s+i[12],t[1]=i[1]*n+i[5]*s+i[13],t[3]=i[3]*n+i[7]*s+i[15]}(s,s,i));const r=s[3];return{point:new e.P(s[0]/r,s[1]/r),signedDistanceFromCamera:r,isOccluded:!1}}function yt(t,e){return.5+t/e*.5}function bt(t,e){return t.x>=-e[0]&&t.x<=e[0]&&t.y>=-e[1]&&t.y<=e[1]}function _t(t,i,n,s,r,o,a,l,c,g,h,u,d,p,m){const I=s?t.textSizeData:t.iconSizeData,C=e.ah(I,n.transform.zoom),f=[256/n.width*2+1,256/n.height*2+1],A=s?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;A.clear();const y=t.lineVertexArray,b=s?t.text.placedSymbolArray:t.icon.placedSymbolArray,_=n.transform.width/n.transform.height;let v=!1;for(let s=0;sMath.abs(n.x-i.x)*s?{useVertical:!0}:(t===e.ai.vertical?i.yn.x)?{needsFlipping:!0}:null}function wt(t,i,n,s,r,o,a,l,c,g,h){const u=n/24,d=i.lineOffsetX*u,p=i.lineOffsetY*u;let m;if(i.numGlyphs>1){const e=i.glyphStartIndex+i.numGlyphs,n=i.lineStartIndex,o=i.lineStartIndex+i.lineLength,c=vt(u,l,d,p,s,i,h,t);if(!c)return{notEnoughRoom:!0};const I=At(c.first.point,a,t.getElevation).point,C=At(c.last.point,a,t.getElevation).point;if(r&&!s){const t=xt(i.writingMode,I,C,g);if(t)return t}m=[c.first];for(let r=i.glyphStartIndex+1;r0?a.point:function(t,e,i,n,s,r){return St(t,e,i,1,s,r)}(t.tileAnchorPoint,r,n,0,o,t),c=xt(i.writingMode,n,l,g);if(c)return c}const n=Rt(u*l.getoffsetX(i.glyphStartIndex),d,p,s,i.segment,i.lineStartIndex,i.lineStartIndex+i.lineLength,t,h);if(!n||t.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};m=[n]}for(const t of m)e.ak(c,t.point,t.angle);return{}}function St(t,e,i,n,s,r){const o=t.add(t.sub(e)._unit()),a=void 0!==s?At(o,s,r.getElevation).point:Zt(o.x,o.y,r).point,l=i.sub(a);return i.add(l._mult(n/l.mag()))}function kt(t,i,n){const s=i.projectionCache;if(s.projections[t])return s.projections[t];const r=new e.P(i.lineVertexArray.getx(t),i.lineVertexArray.gety(t)),o=Zt(r.x,r.y,i);if(o.signedDistanceFromCamera>0)return s.projections[t]=o.point,s.anyProjectionOccluded=s.anyProjectionOccluded||o.isOccluded,o.point;const a=t-n.direction;return function(t,e,i,n,s){return St(t,e,i,n,void 0,s)}(0===n.distanceFromAnchor?i.tileAnchorPoint:new e.P(i.lineVertexArray.getx(a),i.lineVertexArray.gety(a)),r,n.previousVertex,n.absOffsetX-n.distanceFromAnchor+1,i)}function Zt(t,i,n){const s=t+n.translation[0],r=i+n.translation[1];let o;return!n.pitchWithMap&&n.projection.useSpecialProjectionForSymbols?(o=n.projection.projectTileCoordinates(s,r,n.unwrappedTileID,n.getElevation),o.point.x=(.5*o.point.x+.5)*n.width,o.point.y=(.5*-o.point.y+.5)*n.height):(o=At(new e.P(s,r),n.labelPlaneMatrix,n.getElevation),o.isOccluded=!1),o}function Bt(t,e,i){return t._unit()._perp()._mult(e*i)}function Gt(t,i,n,s,r,o,a,l,c){if(l.projectionCache.offsets[t])return l.projectionCache.offsets[t];const g=n.add(i);if(t+c.direction=r)return l.projectionCache.offsets[t]=g,g;const h=kt(t+c.direction,l,c),u=Bt(h.sub(n),a,c.direction),d=n.add(u),p=h.add(u);return l.projectionCache.offsets[t]=e.al(o,g,d,p)||g,l.projectionCache.offsets[t]}function Rt(t,e,i,n,s,r,o,a,l){const c=n?t-e:t+e;let g=c>0?1:-1,h=0;n&&(g*=-1,h=Math.PI),g<0&&(h+=Math.PI);let u,d=g>0?r+s:r+s+1;a.projectionCache.cachedAnchorPoint?u=a.projectionCache.cachedAnchorPoint:(u=Zt(a.tileAnchorPoint.x,a.tileAnchorPoint.y,a).point,a.projectionCache.cachedAnchorPoint=u);let p,m,I=u,C=u,f=0,A=0;const y=Math.abs(c),b=[];let _;for(;f+A<=y;){if(d+=g,d=o)return null;f+=A,C=I,m=p;const t={absOffsetX:y,direction:g,distanceFromAnchor:f,previousVertex:C};if(I=kt(d,a,t),0===i)b.push(C),_=I.sub(C);else{let e;const n=I.sub(C);e=0===n.mag()?Bt(kt(d+g,a,t).sub(I),i,g):Bt(n,i,g),m||(m=C.add(e)),p=Gt(d,e,I,r,o,m,i,a,t),b.push(m),_=p.sub(m)}A=_.mag()}const v=_._mult((y-f)/A)._add(m||C),x=h+Math.atan2(I.y-C.y,I.x-C.x);return b.push(v),{point:v,angle:l?x:0,path:b}}const Vt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Tt(t,e){for(let i=0;i=1;t--)l.push(o.path[t]);for(let t=1;tt.signedDistanceFromCamera<=0))?[]:t.map((t=>t.point))}let m=[];if(l.length>0){const t=l[0].clone(),i=l[0].clone();for(let e=1;e=n.x&&i.x<=s.x&&t.y>=n.y&&i.y<=s.y?[l]:i.xs.x||i.ys.y?[]:e.am([l],n.x,n.y,s.x,s.y)}for(const e of m){r.reset(e,.25*i);let n=0;n=r.length<=.5*i?1:Math.ceil(r.paddedLength/h)+1;for(let e=0;eAt(t,i,e.getElevation)))}queryRenderedSymbols(t){if(0===t.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const i=[];let n=1/0,s=1/0,r=-1/0,o=-1/0;for(const a of t){const t=new e.P(a.x+Wt,a.y+Wt);n=Math.min(n,t.x),s=Math.min(s,t.y),r=Math.max(r,t.x),o=Math.max(o,t.y),i.push(t)}const a=this.grid.query(n,s,r,o).concat(this.ignoredGrid.query(n,s,r,o)),l={},c={};for(const t of a){const n=t.key;if(void 0===l[n.bucketInstanceId]&&(l[n.bucketInstanceId]={}),l[n.bucketInstanceId][n.featureIndex])continue;const s=[new e.P(t.x1,t.y1),new e.P(t.x2,t.y1),new e.P(t.x2,t.y2),new e.P(t.x1,t.y2)];e.an(i,s)&&(l[n.bucketInstanceId][n.featureIndex]=!0,void 0===c[n.bucketInstanceId]&&(c[n.bucketInstanceId]=[]),c[n.bucketInstanceId].push(n.featureIndex))}return c}insertCollisionBox(t,e,i,n,s,r){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:n,featureIndex:s,collisionGroupID:r,overlapMode:e},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,e,i,n,s,r){const o=i?this.ignoredGrid:this.grid,a={bucketInstanceId:n,featureIndex:s,collisionGroupID:r,overlapMode:e};for(let e=0;e=this.screenRightBoundary||nthis.screenBottomBoundary}isInsideGrid(t,e,i,n){return i>=0&&t=0&&ethis.projectAndGetPerspectiveRatio(n,t.x,t.y,s,c)));w=t.some((t=>!t.isOccluded)),x=t.map((t=>t.point))}else w=!0;return{box:e.ap(x),allPointsOccluded:!w}}}function zt(t,i,n){return i*(e.X/(t.tileSize*Math.pow(2,n-t.tileID.overscaledZ)))}class Pt{constructor(t,e,i,n){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):n&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}}class Mt{constructor(t,e,i,n,s){this.text=new Pt(t?t.text:null,e,i,s),this.icon=new Pt(t?t.icon:null,e,n,s)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Xt{constructor(t,e,i){this.text=t,this.icon=e,this.skipFade=i}}class Ft{constructor(){this.invProjMatrix=e.H(),this.viewportMatrix=e.H(),this.circles=[]}}class Kt{constructor(t,e,i,n,s){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=i,this.bucketIndex=n,this.tileID=s}}class Ht{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:t=>t.collisionGroupID===e}}return this.collisionGroups[t]}}function Lt(t,i,n,s,r){const{horizontalAlign:o,verticalAlign:a}=e.av(t);return new e.P(-(o-.5)*i+s[0]*r,-(a-.5)*n+s[1]*r)}class Et{constructor(t,e,i,n,s,r){this.transform=t.clone(),this.terrain=i,this.collisionIndex=new Jt(this.transform,e),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new Ht(s),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=r,r&&(r.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){const e=this.terrain;return e?(i,n)=>e.getElevation(t,i,n):null}getBucketParts(t,i,n,s){const r=n.getBucket(i),o=n.latestFeatureIndex;if(!r||!o||i.id!==r.layerIds[0])return;const a=n.collisionBoxArray,l=r.layers[0].layout,c=r.layers[0].paint,g=Math.pow(2,this.transform.zoom-n.tileID.overscaledZ),h=n.tileSize/e.X,u=n.tileID.toUnwrapped(),d=this.transform.calculatePosMatrix(u),p="map"===l.get("text-pitch-alignment"),m="map"===l.get("text-rotation-alignment"),I=zt(n,1,this.transform.zoom),C=this.collisionIndex.mapProjection.translatePosition(this.transform,n,c.get("text-translate"),c.get("text-translate-anchor")),f=this.collisionIndex.mapProjection.translatePosition(this.transform,n,c.get("icon-translate"),c.get("icon-translate-anchor")),A=Ct(d,p,m,this.transform,I);let y=null;if(p){const t=ft(d,p,m,this.transform,I);y=e.L([],this.transform.labelPlaneMatrix,t)}this.retainedQueryData[r.bucketInstanceId]=new Kt(r.bucketInstanceId,o,r.sourceLayerIndex,r.index,n.tileID);const b={bucket:r,layout:l,translationText:C,translationIcon:f,posMatrix:d,unwrappedTileID:u,textLabelPlaneMatrix:A,labelToScreenMatrix:y,scale:g,textPixelRatio:h,holdingForFade:n.holdingForFade(),collisionBoxArray:a,partiallyEvaluatedTextSize:e.ah(r.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(r.sourceID)};if(s)for(const e of r.sortKeyRanges){const{sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:s}=e;t.push({sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:s,parameters:b})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:r.symbolInstances.length,parameters:b})}attemptAnchorPlacement(t,i,n,s,r,o,a,l,c,g,h,u,d,p,m,I,C,f,A){const y=e.ar[t.textAnchor],b=[t.textOffset0,t.textOffset1],_=Lt(y,n,s,b,r),v=this.collisionIndex.placeCollisionBox(i,u,l,c,g,a,o,I,h.predicate,A,_);if((!f||this.collisionIndex.placeCollisionBox(f,u,l,c,g,a,o,C,h.predicate,A,_).placeable)&&v.placeable){let t;if(this.prevPlacement&&this.prevPlacement.variableOffsets[d.crossTileID]&&this.prevPlacement.placements[d.crossTileID]&&this.prevPlacement.placements[d.crossTileID].text&&(t=this.prevPlacement.variableOffsets[d.crossTileID].anchor),0===d.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[d.crossTileID]={textOffset:b,width:n,height:s,anchor:y,textBoxScale:r,prevAnchor:t},this.markUsedJustification(p,y,d,m),p.allowVerticalPlacement&&(this.markUsedOrientation(p,m,d),this.placedOrientations[d.crossTileID]=m),{shift:_,placedGlyphBoxes:v}}}placeLayerBucketPart(t,i,n){const{bucket:s,layout:r,translationText:o,translationIcon:a,posMatrix:l,unwrappedTileID:c,textLabelPlaneMatrix:g,labelToScreenMatrix:h,textPixelRatio:u,holdingForFade:d,collisionBoxArray:p,partiallyEvaluatedTextSize:m,collisionGroup:I}=t.parameters,C=r.get("text-optional"),f=r.get("icon-optional"),A=e.as(r,"text-overlap","text-allow-overlap"),y="always"===A,b=e.as(r,"icon-overlap","icon-allow-overlap"),_="always"===b,v="map"===r.get("text-rotation-alignment"),x="map"===r.get("text-pitch-alignment"),w="none"!==r.get("icon-text-fit"),S="viewport-y"===r.get("symbol-z-order"),k=y&&(_||!s.hasIconData()||f),Z=_&&(y||!s.hasTextData()||C);!s.collisionArrays&&p&&s.deserializeCollisionBoxes(p);const B=this._getTerrainElevationFunc(this.retainedQueryData[s.bucketInstanceId].tileID),G=(t,p,_)=>{var S,G;if(i[t.crossTileID])return;if(d)return void(this.placements[t.crossTileID]=new Xt(!1,!1,!1));let R=!1,V=!1,T=!0,W=null,J={box:null,placeable:!1,offscreen:null},z={box:null,placeable:!1,offscreen:null},P=null,M=null,X=null,F=0,K=0,H=0;p.textFeatureIndex?F=p.textFeatureIndex:t.useRuntimeCollisionCircles&&(F=t.featureIndex),p.verticalTextFeatureIndex&&(K=p.verticalTextFeatureIndex);const L=p.textBox;if(L){const i=i=>{let n=e.ai.horizontal;if(s.allowVerticalPlacement&&!i&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[t.crossTileID];e&&(this.placedOrientations[t.crossTileID]=e,n=e,this.markUsedOrientation(s,n,t))}return n},r=(i,n)=>{if(s.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&p.verticalTextBox){for(const t of s.writingModes)if(t===e.ai.vertical?(J=n(),z=J):J=i(),J&&J.placeable)break}else J=i()},g=t.textAnchorOffsetStartIndex,h=t.textAnchorOffsetEndIndex;if(h===g){const n=(e,i)=>{const n=this.collisionIndex.placeCollisionBox(e,A,u,l,c,x,v,o,I.predicate,B);return n&&n.placeable&&(this.markUsedOrientation(s,i,t),this.placedOrientations[t.crossTileID]=i),n};r((()=>n(L,e.ai.horizontal)),(()=>{const i=p.verticalTextBox;return s.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&i?n(i,e.ai.vertical):{box:null,offscreen:null}})),i(J&&J.placeable)}else{let d=e.ar[null===(G=null===(S=this.prevPlacement)||void 0===S?void 0:S.variableOffsets[t.crossTileID])||void 0===G?void 0:G.anchor];const m=(i,r,p)=>{const m=i.x2-i.x1,C=i.y2-i.y1,f=t.textBoxScale,y=w&&"never"===b?r:null;let _=null,S="never"===A?1:2,k="never";d&&S++;for(let e=0;em(L,p.iconBox,e.ai.horizontal)),(()=>{const i=p.verticalTextBox;return s.allowVerticalPlacement&&(!J||!J.placeable)&&t.numVerticalGlyphVertices>0&&i?m(i,p.verticalIconBox,e.ai.vertical):{box:null,occluded:!0,offscreen:null}})),J&&(R=J.placeable,T=J.offscreen);const C=i(J&&J.placeable);if(!R&&this.prevPlacement){const e=this.prevPlacement.variableOffsets[t.crossTileID];e&&(this.variableOffsets[t.crossTileID]=e,this.markUsedJustification(s,e.anchor,t,C))}}}if(P=J,R=P&&P.placeable,T=P&&P.offscreen,t.useRuntimeCollisionCircles){const i=s.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex),a=e.aj(s.textSizeData,m,i),u=r.get("text-padding");M=this.collisionIndex.placeCollisionCircles(A,i,s.lineVertexArray,s.glyphOffsetArray,a,l,c,g,h,n,x,I.predicate,t.collisionCircleDiameter,u,o,B),M.circles.length&&M.collisionDetected&&!n&&e.w("Collisions detected, but collision boxes are not shown"),R=y||M.circles.length>0&&!M.collisionDetected,T=T&&M.offscreen}if(p.iconFeatureIndex&&(H=p.iconFeatureIndex),p.iconBox){const t=t=>this.collisionIndex.placeCollisionBox(t,b,u,l,c,x,v,a,I.predicate,B,w&&W?W:void 0);z&&z.placeable&&p.verticalIconBox?(X=t(p.verticalIconBox),V=X.placeable):(X=t(p.iconBox),V=X.placeable),T=T&&X.offscreen}const E=C||0===t.numHorizontalGlyphVertices&&0===t.numVerticalGlyphVertices,D=f||0===t.numIconVertices;E||D?D?E||(V=V&&R):R=V&&R:V=R=V&&R;const Y=V&&X.placeable;if(R&&P.placeable&&this.collisionIndex.insertCollisionBox(P.box,A,r.get("text-ignore-placement"),s.bucketInstanceId,z&&z.placeable&&K?K:F,I.ID),Y&&this.collisionIndex.insertCollisionBox(X.box,b,r.get("icon-ignore-placement"),s.bucketInstanceId,H,I.ID),M&&R&&this.collisionIndex.insertCollisionCircles(M.circles,A,r.get("text-ignore-placement"),s.bucketInstanceId,F,I.ID),n&&this.storeCollisionData(s.bucketInstanceId,_,p,P,X,M),0===t.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===s.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[t.crossTileID]=new Xt(R||k,V||Z,T||s.justReloaded),i[t.crossTileID]=!0};if(S){if(0!==t.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");const e=s.getSortedSymbolIndexes(this.transform.angle);for(let t=e.length-1;t>=0;--t){const i=e[t];G(s.symbolInstances.get(i),s.collisionArrays[i],i)}}else for(let e=t.symbolInstanceStart;e=0&&(t.text.placedSymbolArray.get(e).crossTileID=r>=0&&e!==r?0:n.crossTileID)}markUsedOrientation(t,i,n){const s=i===e.ai.horizontal||i===e.ai.horizontalOnly?i:0,r=i===e.ai.vertical?i:0,o=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex];for(const e of o)t.text.placedSymbolArray.get(e).placedOrientation=s;n.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).placedOrientation=r)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const e=this.prevPlacement;let i=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;const n=e?e.symbolFadeChange(t):1,s=e?e.opacities:{},r=e?e.variableOffsets:{},o=e?e.placedOrientations:{};for(const t in this.placements){const e=this.placements[t],r=s[t];r?(this.opacities[t]=new Mt(r,n,e.text,e.icon),i=i||e.text!==r.text.placed||e.icon!==r.icon.placed):(this.opacities[t]=new Mt(null,n,e.text,e.icon,e.skipFade),i=i||e.text||e.icon)}for(const t in s){const e=s[t];if(!this.opacities[t]){const s=new Mt(e,n,!1,!1);s.isHidden()||(this.opacities[t]=s,i=i||e.text.placed||e.icon.placed)}}for(const t in r)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=r[t]);for(const t in o)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=o[t]);if(e&&void 0===e.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)}updateLayerOpacities(t,e){const i={};for(const n of e){const e=n.getBucket(t);e&&n.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,n.tileID,i,n.collisionBoxArray)}}updateBucketOpacities(t,i,n,s){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const r=t.layers[0],o=r.layout,a=new Mt(null,0,!1,!1,!0),l=o.get("text-allow-overlap"),c=o.get("icon-allow-overlap"),g=r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"),h="map"===o.get("text-rotation-alignment"),u="map"===o.get("text-pitch-alignment"),d="none"!==o.get("icon-text-fit"),p=new Mt(null,0,l&&(c||!t.hasIconData()||o.get("icon-optional")),c&&(l||!t.hasTextData()||o.get("text-optional")),!0);!t.collisionArrays&&s&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(s);const m=(t,e,i)=>{for(let n=0;n0,f=this.placedOrientations[s.crossTileID],A=f===e.ai.vertical,y=f===e.ai.horizontal||f===e.ai.horizontalOnly;if(r>0||o>0){const e=$t(c.text);m(t.text,r,A?te:e),m(t.text,o,y?te:e);const i=c.text.isHidden();[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach((e=>{e>=0&&(t.text.placedSymbolArray.get(e).hidden=i||A?1:0)})),s.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).hidden=i||y?1:0);const n=this.variableOffsets[s.crossTileID];n&&this.markUsedJustification(t,n.anchor,s,f);const a=this.placedOrientations[s.crossTileID];a&&(this.markUsedJustification(t,"left",s,a),this.markUsedOrientation(t,a,s))}if(C){const e=$t(c.icon),i=!(d&&s.verticalPlacedIconSymbolIndex&&A);s.placedIconSymbolIndex>=0&&(m(t.icon,s.numIconVertices,i?e:te),t.icon.placedSymbolArray.get(s.placedIconSymbolIndex).hidden=c.icon.isHidden()),s.verticalPlacedIconSymbolIndex>=0&&(m(t.icon,s.numVerticalIconVertices,i?te:e),t.icon.placedSymbolArray.get(s.verticalPlacedIconSymbolIndex).hidden=c.icon.isHidden())}const b=I&&I.has(i)?I.get(i):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const n=t.collisionArrays[i];if(n){let i=new e.P(0,0);if(n.textBox||n.verticalTextBox){let e=!0;if(g){const t=this.variableOffsets[l];t?(i=Lt(t.anchor,t.width,t.height,t.textOffset,t.textBoxScale),h&&i._rotate(u?this.transform.angle:-this.transform.angle)):e=!1}if(n.textBox||n.verticalTextBox){let s;n.textBox&&(s=A),n.verticalTextBox&&(s=y),Dt(t.textCollisionBox.collisionVertexArray,c.text.placed,!e||s,b.text,i.x,i.y)}}if(n.iconBox||n.verticalIconBox){const e=Boolean(!y&&n.verticalIconBox);let s;n.iconBox&&(s=e),n.verticalIconBox&&(s=!e),Dt(t.iconCollisionBox.collisionVertexArray,c.icon.placed,s,b.icon,d?i.x:0,d?i.y:0)}}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const e=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=e.invProjMatrix,t.placementViewportMatrix=e.viewportMatrix,t.collisionCircleArray=e.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTimet}setStale(){this.stale=!0}}function Dt(t,e,i,n,s,r){n&&0!==n.length||(n=[0,0,0,0]);const o=n[0]-Wt,a=n[1]-Wt,l=n[2]-Wt,c=n[3]-Wt;t.emplaceBack(e?1:0,i?1:0,s||0,r||0,o,a),t.emplaceBack(e?1:0,i?1:0,s||0,r||0,l,a),t.emplaceBack(e?1:0,i?1:0,s||0,r||0,l,c),t.emplaceBack(e?1:0,i?1:0,s||0,r||0,o,c)}const Yt=Math.pow(2,25),Nt=Math.pow(2,24),Ot=Math.pow(2,17),Ut=Math.pow(2,16),jt=Math.pow(2,9),Qt=Math.pow(2,8),qt=Math.pow(2,1);function $t(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;const e=t.placed?1:0,i=Math.floor(127*t.opacity);return i*Yt+e*Nt+i*Ot+e*Ut+i*jt+e*Qt+i*qt+e}const te=0;function ee(){return{isOccluded:(t,e,i)=>!1,getPitchedTextCorrection:(t,e,i)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(t,e,i,n){throw new Error("Not implemented.")},translatePosition:(t,e,i,n)=>function(t,e,i,n,s=!1){if(!i[0]&&!i[1])return[0,0];const r=s?"map"===n?t.angle:0:"viewport"===n?-t.angle:0;if(r){const t=Math.sin(r),e=Math.cos(r);i=[i[0]*e-i[1]*t,i[0]*t+i[1]*e]}return[s?i[0]:zt(e,i[0],t.zoom),s?i[1]:zt(e,i[1],t.zoom)]}(t,e,i,n),getCircleRadiusCorrection:t=>1}}class ie{constructor(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,e,i,n,s){const r=this._bucketParts;for(;this._currentTileIndext.sortKey-e.sortKey)));this._currentPartIndex!this._forceFullPlacement&&r.now()-n>2;for(;this._currentPlacementIndex>=0;){const n=e[t[this._currentPlacementIndex]],r=this.placement.collisionIndex.transform.zoom;if("symbol"===n.type&&(!n.minzoom||n.minzoom<=r)&&(!n.maxzoom||n.maxzoom>r)){if(this._inProgressLayer||(this._inProgressLayer=new ie(n)),this._inProgressLayer.continuePlacement(i[n.source],this.placement,this._showCollisionBoxes,n,s))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const se=512/e.X/2;class re{constructor(t,i,n){this.tileID=t,this.bucketInstanceId=n,this._symbolsByKey={};const s=new Map;for(let t=0;t({x:Math.floor(t.anchorX*se),y:Math.floor(t.anchorY*se)}))),crossTileIDs:i.map((t=>t.crossTileID))};if(n.positions.length>128){const t=new e.aw(n.positions.length,16,Uint16Array);for(const{x:e,y:i}of n.positions)t.add(e,i);t.finish(),delete n.positions,n.index=t}this._symbolsByKey[t]=n}}getScaledCoordinates(t,i){const{x:n,y:s,z:r}=this.tileID.canonical,{x:o,y:a,z:l}=i.canonical,c=se/Math.pow(2,l-r),g=(a*e.X+t.anchorY)*c,h=s*e.X*se;return{x:Math.floor((o*e.X+t.anchorX)*c-n*e.X*se),y:Math.floor(g-h)}}findMatches(t,e,i){const n=this.tileID.canonical.zt))}}class oe{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class ae{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const e=Math.round((t-this.lng)/360);if(0!==e)for(const t in this.indexes){const i=this.indexes[t],n={};for(const t in i){const s=i[t];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+e),n[s.tileID.key]=s}this.indexes[t]=n}this.lng=t}addBucket(t,e,i){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let t=0;tt.overscaledZ)for(const i in s){const r=s[i];r.tileID.isChildOf(t)&&r.findMatches(e.symbolInstances,t,n)}else{const r=s[t.scaledTo(Number(i)).key];r&&r.findMatches(e.symbolInstances,t,n)}}for(let t=0;t{e[t]=!0}));for(const t in this.layerIndexes)e[t]||delete this.layerIndexes[t]}}const ce=(t,i)=>e.t(t,i&&i.filter((t=>"source.canvas"!==t.identifier))),ge=e.ax();class he extends e.E{constructor(t,i={}){super(),this._rtlPluginLoaded=()=>{for(const t in this.sourceCaches){const e=this.sourceCaches[t].getSource().type;"vector"!==e&&"geojson"!==e||this.sourceCaches[t].reload()}},this.map=t,this.dispatcher=new F(X(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",((t,e)=>this.getGlyphs(t,e))),this.dispatcher.registerMessageHandler("GI",((t,e)=>this.getImages(t,e))),this.imageManager=new v,this.imageManager.setEventedParent(this),this.glyphManager=new k(t._requestManager,i.localIdeographFontFamily),this.lineAtlas=new T(256,512),this.crossTileSymbolIndex=new le,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new e.ay,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",e.az()),at().on(st,this._rtlPluginLoaded),this.on("data",(t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;const e=this.sourceCaches[t.sourceId];if(!e)return;const i=e.getSource();if(i&&i.vectorLayerIds)for(const t in this._layers){const e=this._layers[t];e.source===i.id&&this._validateLayer(e)}}))}loadURL(t,i={},n){this.fire(new e.k("dataloading",{dataType:"style"})),i.validate="boolean"!=typeof i.validate||i.validate;const s=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController,e.h(s,this._loadStyleRequest).then((t=>{this._loadStyleRequest=null,this._load(t.data,i,n)})).catch((t=>{this._loadStyleRequest=null,t&&this.fire(new e.j(t))}))}loadJSON(t,i={},n){this.fire(new e.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,r.frameAsync(this._frameRequest).then((()=>{this._frameRequest=null,i.validate=!1!==i.validate,this._load(t,i,n)})).catch((()=>{}))}loadEmpty(){this.fire(new e.k("dataloading",{dataType:"style"})),this._load(ge,{validate:!1})}_load(t,i,n){var s;const r=i.transformStyle?i.transformStyle(n,t):t;if(!i.validate||!ce(this,e.x(r))){this._loaded=!0,this.stylesheet=r;for(const t in r.sources)this.addSource(t,r.sources[t],{validate:!1});r.sprite?this._loadSprite(r.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(r.glyphs),this._createLayers(),this.light=new G(this.stylesheet.light),this.sky=new V(this.stylesheet.sky),this.map.setTerrain(null!==(s=this.stylesheet.terrain)&&void 0!==s?s:null),this.fire(new e.k("data",{dataType:"style"})),this.fire(new e.k("style.load"))}}_createLayers(){const t=e.aA(this.stylesheet.layers);this.dispatcher.broadcast("SL",t),this._order=t.map((t=>t.id)),this._layers={},this._serializedLayers=null;for(const i of t){const t=e.aB(i);t.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=t}}_loadSprite(t,i=!1,n=void 0){let s;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(t,i,n,s){return e._(this,void 0,void 0,(function*(){const o=A(t),a=n>1?"@2x":"",l={},c={};for(const{id:t,url:n}of o){const r=i.transformRequest(y(n,a,".json"),"SpriteJSON");l[t]=e.h(r,s);const o=i.transformRequest(y(n,a,".png"),"SpriteImage");c[t]=d.getImage(o,s)}return yield Promise.all([...Object.values(l),...Object.values(c)]),function(t,i){return e._(this,void 0,void 0,(function*(){const e={};for(const n in t){e[n]={};const s=r.getImageCanvasContext((yield i[n]).data),o=(yield t[n]).data;for(const t in o){const{width:i,height:r,x:a,y:l,sdf:c,pixelRatio:g,stretchX:h,stretchY:u,content:d,textFitWidth:p,textFitHeight:m}=o[t];e[n][t]={data:null,pixelRatio:g,sdf:c,stretchX:h,stretchY:u,content:d,textFitWidth:p,textFitHeight:m,spriteData:{width:i,height:r,x:a,y:l,context:s}}}}return e}))}(l,c)}))}(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((t=>{if(this._spriteRequest=null,t)for(const e in t){this._spritesImagesIds[e]=[];const n=this._spritesImagesIds[e]?this._spritesImagesIds[e].filter((e=>!(e in t))):[];for(const t of n)this.imageManager.removeImage(t),this._changedImages[t]=!0;for(const n in t[e]){const s="default"===e?n:`${e}:${n}`;this._spritesImagesIds[e].push(s),s in this.imageManager.images?this.imageManager.updateImage(s,t[e][n],!1):this.imageManager.addImage(s,t[e][n]),i&&(this._changedImages[s]=!0)}}})).catch((t=>{this._spriteRequest=null,s=t,this.fire(new e.j(s))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.k("data",{dataType:"style"})),n&&n(s)}))}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.k("data",{dataType:"style"}))}_validateLayer(t){const i=this.sourceCaches[t.source];if(!i)return;const n=t.sourceLayer;if(!n)return;const s=i.getSource();("geojson"===s.type||s.vectorLayerIds&&-1===s.vectorLayerIds.indexOf(n))&&this.fire(new e.j(new Error(`Source layer "${n}" does not exist on source "${s.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t){const e=this._serializedAllLayers();if(!t||0===t.length)return Object.values(e);const i=[];for(const n of t)e[n]&&i.push(e[n]);return i}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const e=Object.keys(this._layers);for(const i of e){const e=this._layers[i];"custom"!==e.type&&(t[i]=e.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;if(this.sky&&this.sky.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const i=this._changed;if(i){const e=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(e.length||i.length)&&this._updateWorkerLayers(e,i);for(const t in this._updatedSources){const e=this._updatedSources[t];if("reload"===e)this._reloadSource(t);else{if("clear"!==e)throw new Error(`Invalid action ${e}`);this._clearSource(t)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const e in this._updatedPaintProps)this._layers[e].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}const n={};for(const t in this.sourceCaches){const e=this.sourceCaches[t];n[t]=e.used,e.used=!1}for(const e of this._order){const i=this._layers[e];i.recalculate(t,this._availableImages),!i.isHidden(t.zoom)&&i.source&&(this.sourceCaches[i.source].used=!0)}for(const t in n){const i=this.sourceCaches[t];!!n[t]!=!!i.used&&i.fire(new e.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:t}))}this.light.recalculate(t),this.sky.recalculate(t),this.z=t.zoom,i&&this.fire(new e.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,e){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t),removedIds:e})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,i={}){var n;this._checkLoaded();const s=this.serialize();if(t=i.transformStyle?i.transformStyle(s,t):t,(null===(n=i.validate)||void 0===n||n)&&ce(this,e.x(t)))return!1;(t=e.aC(t)).layers=e.aA(t.layers);const r=e.aD(s,t),o=this._getOperationsToPerform(r);if(o.unimplemented.length>0)throw new Error(`Unimplemented: ${o.unimplemented.join(", ")}.`);if(0===o.operations.length)return!1;for(const t of o.operations)t();return this.stylesheet=t,this._serializedLayers=null,!0}_getOperationsToPerform(t){const e=[],i=[];for(const n of t)switch(n.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":e.push((()=>this.addLayer.apply(this,n.args)));break;case"removeLayer":e.push((()=>this.removeLayer.apply(this,n.args)));break;case"setPaintProperty":e.push((()=>this.setPaintProperty.apply(this,n.args)));break;case"setLayoutProperty":e.push((()=>this.setLayoutProperty.apply(this,n.args)));break;case"setFilter":e.push((()=>this.setFilter.apply(this,n.args)));break;case"addSource":e.push((()=>this.addSource.apply(this,n.args)));break;case"removeSource":e.push((()=>this.removeSource.apply(this,n.args)));break;case"setLayerZoomRange":e.push((()=>this.setLayerZoomRange.apply(this,n.args)));break;case"setLight":e.push((()=>this.setLight.apply(this,n.args)));break;case"setGeoJSONSourceData":e.push((()=>this.setGeoJSONSourceData.apply(this,n.args)));break;case"setGlyphs":e.push((()=>this.setGlyphs.apply(this,n.args)));break;case"setSprite":e.push((()=>this.setSprite.apply(this,n.args)));break;case"setSky":e.push((()=>this.setSky.apply(this,n.args)));break;case"setTerrain":e.push((()=>this.map.setTerrain.apply(this,n.args)));break;case"setTransition":e.push((()=>{}));break;default:i.push(n.command)}return{operations:e,unimplemented:i}}addImage(t,i){if(this.getImage(t))return this.fire(new e.j(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,i),this._afterImageUpdated(t)}updateImage(t,e){this.imageManager.updateImage(t,e)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new e.j(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,i,n={}){if(this._checkLoaded(),void 0!==this.sourceCaches[t])throw new Error(`Source "${t}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(e.x.source,`sources.${t}`,i,null,n))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const s=this.sourceCaches[t]=new ht(t,i,this.dispatcher);s.style=this,s.setEventedParent(this,(()=>({isSourceLoaded:s.loaded(),source:s.serialize(),sourceId:t}))),s.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error("There is no source with this ID");for(const i in this._layers)if(this._layers[i].source===t)return this.fire(new e.j(new Error(`Source "${t}" cannot be removed while layer "${i}" is using it.`)));const i=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],i.fire(new e.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,e){if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error(`There is no source with this ID=${t}`);const i=this.sourceCaches[t].getSource();if("geojson"!==i.type)throw new Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(e),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,i,n={}){this._checkLoaded();const s=t.id;if(this.getLayer(s))return void this.fire(new e.j(new Error(`Layer "${s}" already exists on this map.`)));let r;if("custom"===t.type){if(ce(this,e.aE(t)))return;r=e.aB(t)}else{if("source"in t&&"object"==typeof t.source&&(this.addSource(s,t.source),t=e.aC(t),t=e.e(t,{source:s})),this._validate(e.x.layer,`layers.${s}`,t,{arrayIndex:-1},n))return;r=e.aB(t),this._validateLayer(r),r.setEventedParent(this,{layer:{id:s}})}const o=i?this._order.indexOf(i):this._order.length;if(i&&-1===o)this.fire(new e.j(new Error(`Cannot add layer "${s}" before non-existing layer "${i}".`)));else{if(this._order.splice(o,0,s),this._layerOrderChanged=!0,this._layers[s]=r,this._removedLayers[s]&&r.source&&"custom"!==r.type){const t=this._removedLayers[s];delete this._removedLayers[s],t.type!==r.type?this._updatedSources[r.source]="clear":(this._updatedSources[r.source]="reload",this.sourceCaches[r.source].pause())}this._updateLayer(r),r.onAdd&&r.onAdd(this.map)}}moveLayer(t,i){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new e.j(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===i)return;const n=this._order.indexOf(t);this._order.splice(n,1);const s=i?this._order.indexOf(i):this._order.length;i&&-1===s?this.fire(new e.j(new Error(`Cannot move layer "${t}" before non-existing layer "${i}".`))):(this._order.splice(s,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const i=this._layers[t];if(!i)return void this.fire(new e.j(new Error(`Cannot remove non-existing layer "${t}".`)));i.setEventedParent(null);const n=this._order.indexOf(t);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=i,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],i.onRemove&&i.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,i,n){this._checkLoaded();const s=this.getLayer(t);s?s.minzoom===i&&s.maxzoom===n||(null!=i&&(s.minzoom=i),null!=n&&(s.maxzoom=n),this._updateLayer(s)):this.fire(new e.j(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,i,n={}){this._checkLoaded();const s=this.getLayer(t);if(s){if(!e.aF(s.filter,i))return null==i?(s.filter=void 0,void this._updateLayer(s)):void(this._validate(e.x.filter,`layers.${s.id}.filter`,i,null,n)||(s.filter=e.aC(i),this._updateLayer(s)))}else this.fire(new e.j(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return e.aC(this.getLayer(t).filter)}setLayoutProperty(t,i,n,s={}){this._checkLoaded();const r=this.getLayer(t);r?e.aF(r.getLayoutProperty(i),n)||(r.setLayoutProperty(i,n,s),this._updateLayer(r)):this.fire(new e.j(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,i){const n=this.getLayer(t);if(n)return n.getLayoutProperty(i);this.fire(new e.j(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,i,n,s={}){this._checkLoaded();const r=this.getLayer(t);r?e.aF(r.getPaintProperty(i),n)||(r.setPaintProperty(i,n,s)&&this._updateLayer(r),this._changed=!0,this._updatedPaintProps[t]=!0,this._serializedLayers=null):this.fire(new e.j(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(t,i){this._checkLoaded();const n=t.source,s=t.sourceLayer,r=this.sourceCaches[n];if(void 0===r)return void this.fire(new e.j(new Error(`The source '${n}' does not exist in the map's style.`)));const o=r.getSource().type;"geojson"===o&&s?this.fire(new e.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==o||s?(void 0===t.id&&this.fire(new e.j(new Error("The feature id parameter must be provided."))),r.setFeatureState(s,t.id,i)):this.fire(new e.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,i){this._checkLoaded();const n=t.source,s=this.sourceCaches[n];if(void 0===s)return void this.fire(new e.j(new Error(`The source '${n}' does not exist in the map's style.`)));const r=s.getSource().type,o="vector"===r?t.sourceLayer:void 0;"vector"!==r||o?i&&"string"!=typeof t.id&&"number"!=typeof t.id?this.fire(new e.j(new Error("A feature id is required to remove its specific state property."))):s.removeFeatureState(o,t.id,i):this.fire(new e.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const i=t.source,n=t.sourceLayer,s=this.sourceCaches[i];if(void 0!==s)return"vector"!==s.getSource().type||n?(void 0===t.id&&this.fire(new e.j(new Error("The feature id parameter must be provided."))),s.getFeatureState(n,t.id)):void this.fire(new e.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new e.j(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return e.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=e.aG(this.sourceCaches,(t=>t.serialize())),i=this._serializeByIds(this._order),n=this.map.getTerrain()||void 0,s=this.stylesheet;return e.aH({version:s.version,name:s.name,metadata:s.metadata,light:s.light,sky:s.sky,center:s.center,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch,sprite:s.sprite,glyphs:s.glyphs,transition:s.transition,sources:t,layers:i,terrain:n},(t=>void 0!==t))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const e=t=>"fill-extrusion"===this._layers[t].type,i={},n=[];for(let s=this._order.length-1;s>=0;s--){const r=this._order[s];if(e(r)){i[r]=s;for(const e of t){const t=e[r];if(t)for(const e of t)n.push(e)}}}n.sort(((t,e)=>e.intersectionZ-t.intersectionZ));const s=[];for(let r=this._order.length-1;r>=0;r--){const o=this._order[r];if(e(o))for(let t=n.length-1;t>=0;t--){const e=n[t].feature;if(i[e.layer.id]{const n=i.featureSortOrder;if(n){const i=n.indexOf(t.featureIndex);return n.indexOf(e.featureIndex)-i}return e.featureIndex-t.featureIndex}));for(const t of s)e.push(t)}}for(const e in a)a[e].forEach((n=>{const s=n.feature,r=i[t[e].source].getFeatureState(s.layer["source-layer"],s.id);s.source=s.layer.source,s.layer["source-layer"]&&(s.sourceLayer=s.layer["source-layer"]),s.state=r}));return a}(this._layers,o,this.sourceCaches,t,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(r)}querySourceFeatures(t,i){i&&i.filter&&this._validate(e.x.filter,"querySourceFeatures.filter",i.filter,null,i);const n=this.sourceCaches[t];return n?function(t,e){const i=t.getRenderableIds().map((e=>t.getTileByID(e))),n=[],s={};for(let t=0;tt.getTileByID(e))).sort(((t,e)=>e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1)))}const n=this.crossTileSymbolIndex.addLayer(i,l[i.source],t.center.lng);o=o||n}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((s=s||this._layerOrderChanged||0===i)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(r.now(),t.zoom))&&(this.pauseablePlacement=new ne(t,this.map.terrain,this._order,s,e,i,n,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(r.now()),a=!0),o&&this.pauseablePlacement.placement.setStale()),a||o)for(const t of this._order){const e=this._layers[t];"symbol"===e.type&&this.placement.updateLayerOpacities(e,l[e.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(r.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,i){return e._(this,void 0,void 0,(function*(){const t=yield this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();const e=this.sourceCaches[i.source];return e&&e.setDependencies(i.tileID.key,i.type,i.icons),t}))}getGlyphs(t,i){return e._(this,void 0,void 0,(function*(){const t=yield this.glyphManager.getGlyphs(i.stacks),e=this.sourceCaches[i.source];return e&&e.setDependencies(i.tileID.key,i.type,[""]),t}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,i={}){this._checkLoaded(),t&&this._validate(e.x.glyphs,"glyphs",t,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,i,n={},s){this._checkLoaded();const r=[{id:t,url:i}],o=[...A(this.stylesheet.sprite),...r];this._validate(e.x.sprite,"sprite",o,null,n)||(this.stylesheet.sprite=o,this._loadSprite(r,!0,s))}removeSprite(t){this._checkLoaded();const i=A(this.stylesheet.sprite);if(i.find((e=>e.id===t))){if(this._spritesImagesIds[t])for(const e of this._spritesImagesIds[t])this.imageManager.removeImage(e),this._changedImages[e]=!0;i.splice(i.findIndex((e=>e.id===t)),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.k("data",{dataType:"style"}))}else this.fire(new e.j(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return A(this.stylesheet.sprite)}setSprite(t,i={},n){this._checkLoaded(),t&&this._validate(e.x.sprite,"sprite",t,null,i)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,n):(this._unloadSprite(),n&&n(null)))}}var ue=e.Y([{name:"a_pos",type:"Int16",components:2}]);const de={prelude:pe("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\n","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}"),background:pe("uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:pe("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:pe("varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:pe("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:pe("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}"),heatmapTexture:pe("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:pe("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_anchor_pos;attribute vec2 a_placed;attribute vec2 a_box_real;uniform mat4 u_matrix;uniform vec2 u_pixel_extrude_scale;varying float v_placed;varying float v_notUsed;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:pe("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:pe("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:pe("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),fillOutline:pe("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillOutlinePattern:pe("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillPattern:pe("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),fillExtrusion:pe("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),fillExtrusionPattern:pe("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),hillshadePrepare:pe("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:pe("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:pe("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:pe("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:pe("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:pe("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),raster:pe("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:pe("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_tex;varying float v_fade_opacity;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}"),symbolSDF:pe("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_data0;varying vec3 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:pe("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec4 v_data0;varying vec4 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),terrain:pe("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;varying vec2 v_texture_pos;varying float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture2D(u_texture,v_texture_pos);if (v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);gl_FragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {gl_FragColor=surface_color;}}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform mat4 u_fog_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:pe("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:pe("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);}"),sky:pe("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform float u_horizon;uniform float u_sky_horizon_blend;void main() {float y=gl_FragCoord.y;if (y > u_horizon) {float blend=y-u_horizon;if (blend < u_sky_horizon_blend) {gl_FragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {gl_FragColor=u_sky_color;}}}","attribute vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function pe(t,e){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n=e.match(/attribute ([\w]+) ([\w]+)/g),s=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),r=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=r?r.concat(s):s,a={};return{fragmentSource:t=t.replace(i,((t,e,i,n,s)=>(a[s]=!0,"define"===e?`\n#ifndef HAS_UNIFORM_u_${s}\nvarying ${i} ${n} ${s};\n#else\nuniform ${i} ${n} u_${s};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${s}\n ${i} ${n} ${s} = u_${s};\n#endif\n`))),vertexSource:e=e.replace(i,((t,e,i,n,s)=>{const r="float"===n?"vec2":"vec4",o=s.match(/color/)?"color":r;return a[s]?"define"===e?`\n#ifndef HAS_UNIFORM_u_${s}\nuniform lowp float u_${s}_t;\nattribute ${i} ${r} a_${s};\nvarying ${i} ${n} ${s};\n#else\nuniform ${i} ${n} u_${s};\n#endif\n`:"vec4"===o?`\n#ifndef HAS_UNIFORM_u_${s}\n ${s} = a_${s};\n#else\n ${i} ${n} ${s} = u_${s};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${s}\n ${s} = unpack_mix_${o}(a_${s}, u_${s}_t);\n#else\n ${i} ${n} ${s} = u_${s};\n#endif\n`:"define"===e?`\n#ifndef HAS_UNIFORM_u_${s}\nuniform lowp float u_${s}_t;\nattribute ${i} ${r} a_${s};\n#else\nuniform ${i} ${n} u_${s};\n#endif\n`:"vec4"===o?`\n#ifndef HAS_UNIFORM_u_${s}\n ${i} ${n} ${s} = a_${s};\n#else\n ${i} ${n} ${s} = u_${s};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${s}\n ${i} ${n} ${s} = unpack_mix_${o}(a_${s}, u_${s}_t);\n#else\n ${i} ${n} ${s} = u_${s};\n#endif\n`})),staticAttributes:n,staticUniforms:o}}class me{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,e,i,n,s,r,o,a,l){this.context=t;let c=this.boundPaintVertexBuffers.length!==n.length;for(let t=0;!c&&t({u_matrix:t,u_texture:0,u_ele_delta:i,u_fog_matrix:n,u_fog_color:s?s.properties.get("fog-color"):e.aN.white,u_fog_ground_blend:s?s.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:s?s.calculateFogBlendOpacity(r):0,u_horizon_color:s?s.properties.get("horizon-color"):e.aN.white,u_horizon_fog_blend:s?s.properties.get("horizon-fog-blend"):1});function Ce(t){const e=[];for(let i=0;i({u_depth:new e.aI(t,i.u_depth),u_terrain:new e.aI(t,i.u_terrain),u_terrain_dim:new e.aJ(t,i.u_terrain_dim),u_terrain_matrix:new e.aK(t,i.u_terrain_matrix),u_terrain_unpack:new e.aL(t,i.u_terrain_unpack),u_terrain_exaggeration:new e.aJ(t,i.u_terrain_exaggeration)}))(t,b),this.binderUniforms=n?n.getUniforms(t,b):[]}draw(t,e,i,n,s,r,o,a,l,c,g,h,u,d,p,m,I,C){const f=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(n),t.setColorMode(s),t.setCullFace(r),a){t.activeTexture.set(f.TEXTURE2),f.bindTexture(f.TEXTURE_2D,a.depthTexture),t.activeTexture.set(f.TEXTURE3),f.bindTexture(f.TEXTURE_2D,a.texture);for(const t in this.terrainUniforms)this.terrainUniforms[t].set(a[t])}for(const t in this.fixedUniforms)this.fixedUniforms[t].set(o[t]);p&&p.setUniforms(t,this.binderUniforms,u,{zoom:d});let A=0;switch(e){case f.LINES:A=2;break;case f.TRIANGLES:A=3;break;case f.LINE_STRIP:A=1}for(const i of h.get()){const n=i.vaos||(i.vaos={});(n[l]||(n[l]=new me)).bind(t,this,c,p?p.getPaintVertexBuffers():[],g,i.vertexOffset,m,I,C),f.drawElements(e,i.primitiveLength*A,f.UNSIGNED_SHORT,i.primitiveOffset*A*2)}}}function Ae(t,e,i){const n=1/zt(i,1,e.transform.tileZoom),s=Math.pow(2,i.tileID.overscaledZ),r=i.tileSize*Math.pow(2,e.transform.tileZoom)/s,o=r*(i.tileID.canonical.x+i.tileID.wrap*s),a=r*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[n,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[o>>16,a>>16],u_pixel_coord_lower:[65535&o,65535&a]}}const ye=(t,i,n,s)=>{const r=i.style.light,o=r.properties.get("position"),a=[o.x,o.y,o.z],l=function(){var t=new e.A(9);return e.A!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}();"viewport"===r.properties.get("anchor")&&function(t,e){var i=Math.sin(e),n=Math.cos(e);t[0]=n,t[1]=i,t[2]=0,t[3]=-i,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1}(l,-i.transform.angle),function(t,e,i){var n=e[0],s=e[1],r=e[2];t[0]=n*i[0]+s*i[3]+r*i[6],t[1]=n*i[1]+s*i[4]+r*i[7],t[2]=n*i[2]+s*i[5]+r*i[8]}(a,a,l);const c=r.properties.get("color");return{u_matrix:t,u_lightpos:a,u_lightintensity:r.properties.get("intensity"),u_lightcolor:[c.r,c.g,c.b],u_vertical_gradient:+n,u_opacity:s}},be=(t,i,n,s,r,o,a)=>e.e(ye(t,i,n,s),Ae(o,i,a),{u_height_factor:-Math.pow(2,r.overscaledZ)/a.tileSize/8}),_e=t=>({u_matrix:t}),ve=(t,i,n,s)=>e.e(_e(t),Ae(n,i,s)),xe=(t,e)=>({u_matrix:t,u_world:e}),we=(t,i,n,s,r)=>e.e(ve(t,i,n,s),{u_world:r}),Se=(t,e,i,n)=>{const s=t.transform;let r,o;if("map"===n.paint.get("circle-pitch-alignment")){const t=zt(i,1,s.zoom);r=!0,o=[t,t]}else r=!1,o=s.pixelsToGLUnits;return{u_camera_to_center_distance:s.cameraToCenterDistance,u_scale_with_map:+("map"===n.paint.get("circle-pitch-scale")),u_matrix:t.translatePosMatrix(e.posMatrix,i,n.paint.get("circle-translate"),n.paint.get("circle-translate-anchor")),u_pitch_with_map:+r,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:o}},ke=(t,e,i)=>({u_matrix:t,u_inv_matrix:e,u_camera_to_center_distance:i.cameraToCenterDistance,u_viewport_size:[i.width,i.height]}),Ze=(t,e,i=1)=>({u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:i}),Be=t=>({u_matrix:t}),Ge=(t,e,i,n)=>({u_matrix:t,u_extrude_scale:zt(e,1,i),u_intensity:n});function Re(t,i){const n=Math.pow(2,i.canonical.z),s=i.canonical.y;return[new e.Z(0,s/n).toLngLat().lat,new e.Z(0,(s+1)/n).toLngLat().lat]}const Ve=(t,e,i,n)=>{const s=t.transform;return{u_matrix:Pe(t,e,i,n),u_ratio:1/zt(e,1,s.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/s.pixelsToGLUnits[0],1/s.pixelsToGLUnits[1]]}},Te=(t,i,n,s,r)=>e.e(Ve(t,i,n,r),{u_image:0,u_image_height:s}),We=(t,e,i,n,s)=>{const r=t.transform,o=ze(e,r);return{u_matrix:Pe(t,e,i,s),u_texsize:e.imageAtlasTexture.size,u_ratio:1/zt(e,1,r.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[o,n.fromScale,n.toScale],u_fade:n.t,u_units_to_pixels:[1/r.pixelsToGLUnits[0],1/r.pixelsToGLUnits[1]]}},Je=(t,i,n,s,r,o)=>{const a=t.lineAtlas,l=ze(i,t.transform),c="round"===n.layout.get("line-cap"),g=a.getDash(s.from,c),h=a.getDash(s.to,c),u=g.width*r.fromScale,d=h.width*r.toScale;return e.e(Ve(t,i,n,o),{u_patternscale_a:[l/u,-g.height/2],u_patternscale_b:[l/d,-h.height/2],u_sdfgamma:a.width/(256*Math.min(u,d)*t.pixelRatio)/2,u_image:0,u_tex_y_a:g.y,u_tex_y_b:h.y,u_mix:r.t})};function ze(t,e){return 1/zt(t,1,e.tileZoom)}function Pe(t,e,i,n){return t.translatePosMatrix(n?n.posMatrix:e.tileID.posMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Me=(t,e,i,n,s)=>{return{u_matrix:t,u_tl_parent:e,u_scale_parent:i,u_buffer_scale:1,u_fade_t:n.mix,u_opacity:n.opacity*s.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:s.paint.get("raster-brightness-min"),u_brightness_high:s.paint.get("raster-brightness-max"),u_saturation_factor:(o=s.paint.get("raster-saturation"),o>0?1-1/(1.001-o):-o),u_contrast_factor:(r=s.paint.get("raster-contrast"),r>0?1/(1-r):1+r),u_spin_weights:Xe(s.paint.get("raster-hue-rotate"))};var r,o};function Xe(t){t*=Math.PI/180;const e=Math.sin(t),i=Math.cos(t);return[(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}const Fe=(t,e,i,n,s,r,o,a,l,c,g,h,u,d)=>{const p=o.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:p.cameraToCenterDistance,u_pitch:p.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:p.width/p.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_matrix:a,u_label_plane_matrix:l,u_coord_matrix:c,u_is_text:+h,u_pitch_with_map:+n,u_is_along_line:s,u_is_variable_anchor:r,u_texsize:u,u_texture:0,u_translation:g,u_pitched_scale:d}},Ke=(t,i,n,s,r,o,a,l,c,g,h,u,d,p,m)=>{const I=a.transform;return e.e(Fe(t,i,n,s,r,o,a,l,c,g,h,u,d,m),{u_gamma_scale:s?Math.cos(I._pitch)*I.cameraToCenterDistance:1,u_device_pixel_ratio:a.pixelRatio,u_is_halo:+p})},He=(t,i,n,s,r,o,a,l,c,g,h,u,d,p)=>e.e(Ke(t,i,n,s,r,o,a,l,c,g,h,!0,u,!0,p),{u_texsize_icon:d,u_texture_icon:1}),Le=(t,e,i)=>({u_matrix:t,u_opacity:e,u_color:i}),Ee=(t,i,n,s,r,o)=>e.e(function(t,e,i,n){const s=i.imageManager.getPattern(t.from.toString()),r=i.imageManager.getPattern(t.to.toString()),{width:o,height:a}=i.imageManager.getPixelSize(),l=Math.pow(2,n.tileID.overscaledZ),c=n.tileSize*Math.pow(2,i.transform.tileZoom)/l,g=c*(n.tileID.canonical.x+n.tileID.wrap*l),h=c*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:s.tl,u_pattern_br_a:s.br,u_pattern_tl_b:r.tl,u_pattern_br_b:r.br,u_texsize:[o,a],u_mix:e.t,u_pattern_size_a:s.displaySize,u_pattern_size_b:r.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/zt(n,1,i.transform.tileZoom),u_pixel_coord_upper:[g>>16,h>>16],u_pixel_coord_lower:[65535&g,65535&h]}}(s,o,n,r),{u_matrix:t,u_opacity:i}),De={fillExtrusion:(t,i)=>({u_matrix:new e.aK(t,i.u_matrix),u_lightpos:new e.aO(t,i.u_lightpos),u_lightintensity:new e.aJ(t,i.u_lightintensity),u_lightcolor:new e.aO(t,i.u_lightcolor),u_vertical_gradient:new e.aJ(t,i.u_vertical_gradient),u_opacity:new e.aJ(t,i.u_opacity)}),fillExtrusionPattern:(t,i)=>({u_matrix:new e.aK(t,i.u_matrix),u_lightpos:new e.aO(t,i.u_lightpos),u_lightintensity:new e.aJ(t,i.u_lightintensity),u_lightcolor:new e.aO(t,i.u_lightcolor),u_vertical_gradient:new e.aJ(t,i.u_vertical_gradient),u_height_factor:new e.aJ(t,i.u_height_factor),u_image:new e.aI(t,i.u_image),u_texsize:new e.aP(t,i.u_texsize),u_pixel_coord_upper:new e.aP(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new e.aP(t,i.u_pixel_coord_lower),u_scale:new e.aO(t,i.u_scale),u_fade:new e.aJ(t,i.u_fade),u_opacity:new e.aJ(t,i.u_opacity)}),fill:(t,i)=>({u_matrix:new e.aK(t,i.u_matrix)}),fillPattern:(t,i)=>({u_matrix:new e.aK(t,i.u_matrix),u_image:new e.aI(t,i.u_image),u_texsize:new e.aP(t,i.u_texsize),u_pixel_coord_upper:new e.aP(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new e.aP(t,i.u_pixel_coord_lower),u_scale:new e.aO(t,i.u_scale),u_fade:new e.aJ(t,i.u_fade)}),fillOutline:(t,i)=>({u_matrix:new e.aK(t,i.u_matrix),u_world:new e.aP(t,i.u_world)}),fillOutlinePattern:(t,i)=>({u_matrix:new e.aK(t,i.u_matrix),u_world:new e.aP(t,i.u_world),u_image:new e.aI(t,i.u_image),u_texsize:new e.aP(t,i.u_texsize),u_pixel_coord_upper:new e.aP(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new e.aP(t,i.u_pixel_coord_lower),u_scale:new e.aO(t,i.u_scale),u_fade:new e.aJ(t,i.u_fade)}),circle:(t,i)=>({u_camera_to_center_distance:new e.aJ(t,i.u_camera_to_center_distance),u_scale_with_map:new e.aI(t,i.u_scale_with_map),u_pitch_with_map:new e.aI(t,i.u_pitch_with_map),u_extrude_scale:new e.aP(t,i.u_extrude_scale),u_device_pixel_ratio:new e.aJ(t,i.u_device_pixel_ratio),u_matrix:new e.aK(t,i.u_matrix)}),collisionBox:(t,i)=>({u_matrix:new e.aK(t,i.u_matrix),u_pixel_extrude_scale:new e.aP(t,i.u_pixel_extrude_scale)}),collisionCircle:(t,i)=>({u_matrix:new e.aK(t,i.u_matrix),u_inv_matrix:new e.aK(t,i.u_inv_matrix),u_camera_to_center_distance:new e.aJ(t,i.u_camera_to_center_distance),u_viewport_size:new e.aP(t,i.u_viewport_size)}),debug:(t,i)=>({u_color:new e.aM(t,i.u_color),u_matrix:new e.aK(t,i.u_matrix),u_overlay:new e.aI(t,i.u_overlay),u_overlay_scale:new e.aJ(t,i.u_overlay_scale)}),clippingMask:(t,i)=>({u_matrix:new e.aK(t,i.u_matrix)}),heatmap:(t,i)=>({u_extrude_scale:new e.aJ(t,i.u_extrude_scale),u_intensity:new e.aJ(t,i.u_intensity),u_matrix:new e.aK(t,i.u_matrix)}),heatmapTexture:(t,i)=>({u_matrix:new e.aK(t,i.u_matrix),u_world:new e.aP(t,i.u_world),u_image:new e.aI(t,i.u_image),u_color_ramp:new e.aI(t,i.u_color_ramp),u_opacity:new e.aJ(t,i.u_opacity)}),hillshade:(t,i)=>({u_matrix:new e.aK(t,i.u_matrix),u_image:new e.aI(t,i.u_image),u_latrange:new e.aP(t,i.u_latrange),u_light:new e.aP(t,i.u_light),u_shadow:new e.aM(t,i.u_shadow),u_highlight:new e.aM(t,i.u_highlight),u_accent:new e.aM(t,i.u_accent)}),hillshadePrepare:(t,i)=>({u_matrix:new e.aK(t,i.u_matrix),u_image:new e.aI(t,i.u_image),u_dimension:new e.aP(t,i.u_dimension),u_zoom:new e.aJ(t,i.u_zoom),u_unpack:new e.aL(t,i.u_unpack)}),line:(t,i)=>({u_matrix:new e.aK(t,i.u_matrix),u_ratio:new e.aJ(t,i.u_ratio),u_device_pixel_ratio:new e.aJ(t,i.u_device_pixel_ratio),u_units_to_pixels:new e.aP(t,i.u_units_to_pixels)}),lineGradient:(t,i)=>({u_matrix:new e.aK(t,i.u_matrix),u_ratio:new e.aJ(t,i.u_ratio),u_device_pixel_ratio:new e.aJ(t,i.u_device_pixel_ratio),u_units_to_pixels:new e.aP(t,i.u_units_to_pixels),u_image:new e.aI(t,i.u_image),u_image_height:new e.aJ(t,i.u_image_height)}),linePattern:(t,i)=>({u_matrix:new e.aK(t,i.u_matrix),u_texsize:new e.aP(t,i.u_texsize),u_ratio:new e.aJ(t,i.u_ratio),u_device_pixel_ratio:new e.aJ(t,i.u_device_pixel_ratio),u_image:new e.aI(t,i.u_image),u_units_to_pixels:new e.aP(t,i.u_units_to_pixels),u_scale:new e.aO(t,i.u_scale),u_fade:new e.aJ(t,i.u_fade)}),lineSDF:(t,i)=>({u_matrix:new e.aK(t,i.u_matrix),u_ratio:new e.aJ(t,i.u_ratio),u_device_pixel_ratio:new e.aJ(t,i.u_device_pixel_ratio),u_units_to_pixels:new e.aP(t,i.u_units_to_pixels),u_patternscale_a:new e.aP(t,i.u_patternscale_a),u_patternscale_b:new e.aP(t,i.u_patternscale_b),u_sdfgamma:new e.aJ(t,i.u_sdfgamma),u_image:new e.aI(t,i.u_image),u_tex_y_a:new e.aJ(t,i.u_tex_y_a),u_tex_y_b:new e.aJ(t,i.u_tex_y_b),u_mix:new e.aJ(t,i.u_mix)}),raster:(t,i)=>({u_matrix:new e.aK(t,i.u_matrix),u_tl_parent:new e.aP(t,i.u_tl_parent),u_scale_parent:new e.aJ(t,i.u_scale_parent),u_buffer_scale:new e.aJ(t,i.u_buffer_scale),u_fade_t:new e.aJ(t,i.u_fade_t),u_opacity:new e.aJ(t,i.u_opacity),u_image0:new e.aI(t,i.u_image0),u_image1:new e.aI(t,i.u_image1),u_brightness_low:new e.aJ(t,i.u_brightness_low),u_brightness_high:new e.aJ(t,i.u_brightness_high),u_saturation_factor:new e.aJ(t,i.u_saturation_factor),u_contrast_factor:new e.aJ(t,i.u_contrast_factor),u_spin_weights:new e.aO(t,i.u_spin_weights)}),symbolIcon:(t,i)=>({u_is_size_zoom_constant:new e.aI(t,i.u_is_size_zoom_constant),u_is_size_feature_constant:new e.aI(t,i.u_is_size_feature_constant),u_size_t:new e.aJ(t,i.u_size_t),u_size:new e.aJ(t,i.u_size),u_camera_to_center_distance:new e.aJ(t,i.u_camera_to_center_distance),u_pitch:new e.aJ(t,i.u_pitch),u_rotate_symbol:new e.aI(t,i.u_rotate_symbol),u_aspect_ratio:new e.aJ(t,i.u_aspect_ratio),u_fade_change:new e.aJ(t,i.u_fade_change),u_matrix:new e.aK(t,i.u_matrix),u_label_plane_matrix:new e.aK(t,i.u_label_plane_matrix),u_coord_matrix:new e.aK(t,i.u_coord_matrix),u_is_text:new e.aI(t,i.u_is_text),u_pitch_with_map:new e.aI(t,i.u_pitch_with_map),u_is_along_line:new e.aI(t,i.u_is_along_line),u_is_variable_anchor:new e.aI(t,i.u_is_variable_anchor),u_texsize:new e.aP(t,i.u_texsize),u_texture:new e.aI(t,i.u_texture),u_translation:new e.aP(t,i.u_translation),u_pitched_scale:new e.aJ(t,i.u_pitched_scale)}),symbolSDF:(t,i)=>({u_is_size_zoom_constant:new e.aI(t,i.u_is_size_zoom_constant),u_is_size_feature_constant:new e.aI(t,i.u_is_size_feature_constant),u_size_t:new e.aJ(t,i.u_size_t),u_size:new e.aJ(t,i.u_size),u_camera_to_center_distance:new e.aJ(t,i.u_camera_to_center_distance),u_pitch:new e.aJ(t,i.u_pitch),u_rotate_symbol:new e.aI(t,i.u_rotate_symbol),u_aspect_ratio:new e.aJ(t,i.u_aspect_ratio),u_fade_change:new e.aJ(t,i.u_fade_change),u_matrix:new e.aK(t,i.u_matrix),u_label_plane_matrix:new e.aK(t,i.u_label_plane_matrix),u_coord_matrix:new e.aK(t,i.u_coord_matrix),u_is_text:new e.aI(t,i.u_is_text),u_pitch_with_map:new e.aI(t,i.u_pitch_with_map),u_is_along_line:new e.aI(t,i.u_is_along_line),u_is_variable_anchor:new e.aI(t,i.u_is_variable_anchor),u_texsize:new e.aP(t,i.u_texsize),u_texture:new e.aI(t,i.u_texture),u_gamma_scale:new e.aJ(t,i.u_gamma_scale),u_device_pixel_ratio:new e.aJ(t,i.u_device_pixel_ratio),u_is_halo:new e.aI(t,i.u_is_halo),u_translation:new e.aP(t,i.u_translation),u_pitched_scale:new e.aJ(t,i.u_pitched_scale)}),symbolTextAndIcon:(t,i)=>({u_is_size_zoom_constant:new e.aI(t,i.u_is_size_zoom_constant),u_is_size_feature_constant:new e.aI(t,i.u_is_size_feature_constant),u_size_t:new e.aJ(t,i.u_size_t),u_size:new e.aJ(t,i.u_size),u_camera_to_center_distance:new e.aJ(t,i.u_camera_to_center_distance),u_pitch:new e.aJ(t,i.u_pitch),u_rotate_symbol:new e.aI(t,i.u_rotate_symbol),u_aspect_ratio:new e.aJ(t,i.u_aspect_ratio),u_fade_change:new e.aJ(t,i.u_fade_change),u_matrix:new e.aK(t,i.u_matrix),u_label_plane_matrix:new e.aK(t,i.u_label_plane_matrix),u_coord_matrix:new e.aK(t,i.u_coord_matrix),u_is_text:new e.aI(t,i.u_is_text),u_pitch_with_map:new e.aI(t,i.u_pitch_with_map),u_is_along_line:new e.aI(t,i.u_is_along_line),u_is_variable_anchor:new e.aI(t,i.u_is_variable_anchor),u_texsize:new e.aP(t,i.u_texsize),u_texsize_icon:new e.aP(t,i.u_texsize_icon),u_texture:new e.aI(t,i.u_texture),u_texture_icon:new e.aI(t,i.u_texture_icon),u_gamma_scale:new e.aJ(t,i.u_gamma_scale),u_device_pixel_ratio:new e.aJ(t,i.u_device_pixel_ratio),u_is_halo:new e.aI(t,i.u_is_halo),u_translation:new e.aP(t,i.u_translation),u_pitched_scale:new e.aJ(t,i.u_pitched_scale)}),background:(t,i)=>({u_matrix:new e.aK(t,i.u_matrix),u_opacity:new e.aJ(t,i.u_opacity),u_color:new e.aM(t,i.u_color)}),backgroundPattern:(t,i)=>({u_matrix:new e.aK(t,i.u_matrix),u_opacity:new e.aJ(t,i.u_opacity),u_image:new e.aI(t,i.u_image),u_pattern_tl_a:new e.aP(t,i.u_pattern_tl_a),u_pattern_br_a:new e.aP(t,i.u_pattern_br_a),u_pattern_tl_b:new e.aP(t,i.u_pattern_tl_b),u_pattern_br_b:new e.aP(t,i.u_pattern_br_b),u_texsize:new e.aP(t,i.u_texsize),u_mix:new e.aJ(t,i.u_mix),u_pattern_size_a:new e.aP(t,i.u_pattern_size_a),u_pattern_size_b:new e.aP(t,i.u_pattern_size_b),u_scale_a:new e.aJ(t,i.u_scale_a),u_scale_b:new e.aJ(t,i.u_scale_b),u_pixel_coord_upper:new e.aP(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new e.aP(t,i.u_pixel_coord_lower),u_tile_units_to_pixels:new e.aJ(t,i.u_tile_units_to_pixels)}),terrain:(t,i)=>({u_matrix:new e.aK(t,i.u_matrix),u_texture:new e.aI(t,i.u_texture),u_ele_delta:new e.aJ(t,i.u_ele_delta),u_fog_matrix:new e.aK(t,i.u_fog_matrix),u_fog_color:new e.aM(t,i.u_fog_color),u_fog_ground_blend:new e.aJ(t,i.u_fog_ground_blend),u_fog_ground_blend_opacity:new e.aJ(t,i.u_fog_ground_blend_opacity),u_horizon_color:new e.aM(t,i.u_horizon_color),u_horizon_fog_blend:new e.aJ(t,i.u_horizon_fog_blend)}),terrainDepth:(t,i)=>({u_matrix:new e.aK(t,i.u_matrix),u_ele_delta:new e.aJ(t,i.u_ele_delta)}),terrainCoords:(t,i)=>({u_matrix:new e.aK(t,i.u_matrix),u_texture:new e.aI(t,i.u_texture),u_terrain_coords_id:new e.aJ(t,i.u_terrain_coords_id),u_ele_delta:new e.aJ(t,i.u_ele_delta)}),sky:(t,i)=>({u_sky_color:new e.aM(t,i.u_sky_color),u_horizon_color:new e.aM(t,i.u_horizon_color),u_horizon:new e.aJ(t,i.u_horizon),u_sky_horizon_blend:new e.aJ(t,i.u_sky_horizon_blend)})};class Ye{constructor(t,e,i){this.context=t;const n=t.gl;this.buffer=n.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const e=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ne={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Oe{constructor(t,e,i,n){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=n,this.context=t;const s=t.gl;this.buffer=s.createBuffer(),t.bindVertexBuffer.set(this.buffer),s.bufferData(s.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?s.DYNAMIC_DRAW:s.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,e){for(let i=0;i0){const i=e.H();e.aR(i,m.placementInvProjMatrix,t.transform.glCoordMatrix),e.aR(i,i,m.placementViewportMatrix),c.push({circleArray:C,circleOffset:h,transform:p.posMatrix,invTransform:i,coord:p}),g+=C.length/4,h=g}I&&l.draw(o,a.LINES,zi.disabled,Mi.disabled,t.colorModeForRenderPass(),Xi.disabled,{u_matrix:p.posMatrix,u_pixel_extrude_scale:[1/(u=t.transform).width,1/u.height]},t.style.map.terrain&&t.style.map.terrain.getTerrainData(p),n.id,I.layoutVertexBuffer,I.indexBuffer,I.segments,null,t.transform.zoom,null,null,I.collisionVertexBuffer)}var u;if(!r||!c.length)return;const d=t.useProgram("collisionCircle"),p=new e.aS;p.resize(4*g),p._trim();let m=0;for(const t of c)for(let e=0;e=0&&(f[A.associatedIconIndex]={shiftedAnchor:G,angle:R})}else Tt(A.numGlyphs,I)}if(g){C.clear();const i=t.icon.placedSymbolArray;for(let t=0;tt.style.map.terrain.getElevation(l,e,i):null,i="map"===n.layout.get("text-rotation-alignment");_t(c,l.posMatrix,t,r,F,H,f,g,i,I,l.toUnwrapped(),m.width,m.height,L,e)}const Y=l.posMatrix,N=r&&w||D,O=A||N?Hi:F,U=K,j=d&&0!==n.paint.get(r?"text-halo-width":"icon-halo-width").constantOr(1);let Q;Q=d?c.iconsInText?He(x.kind,G,y,f,A,N,t,Y,O,U,L,V,z,k):Ke(x.kind,G,y,f,A,N,t,Y,O,U,L,r,V,!0,k):Fe(x.kind,G,y,f,A,N,t,Y,O,U,L,r,V,k);const q={program:B,buffers:h,uniformValues:Q,atlasTexture:T,atlasTextureIcon:P,atlasInterpolation:W,atlasInterpolationIcon:J,isSDF:d,hasHalo:j};if(_&&c.canOverlap){v=!0;const t=h.segments.get();for(const i of t)S.push({segments:new e.a0([i]),sortKey:i.sortKey,state:q,terrainData:R})}else S.push({segments:h.segments,sortKey:0,state:q,terrainData:R})}v&&S.sort(((t,e)=>t.sortKey-e.sortKey));for(const e of S){const i=e.state;if(d.activeTexture.set(p.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,p.CLAMP_TO_EDGE),i.atlasTextureIcon&&(d.activeTexture.set(p.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,p.CLAMP_TO_EDGE)),i.isSDF){const s=i.uniformValues;i.hasHalo&&(s.u_is_halo=1,Oi(i.buffers,e.segments,n,t,i.program,x,h,u,s,e.terrainData)),s.u_is_halo=0}Oi(i.buffers,e.segments,n,t,i.program,x,h,u,i.uniformValues,e.terrainData)}}function Oi(t,e,i,n,s,r,o,a,l,c){const g=n.context;s.draw(g,g.gl.TRIANGLES,r,o,a,Xi.disabled,l,c,i.id,t.layoutVertexBuffer,t.indexBuffer,e,i.paint,n.transform.zoom,t.programConfigurations.get(i.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function Ui(t,e,i,n,s){if(!i||!n||!n.imageAtlas)return;const r=n.imageAtlas.patternPositions;let o=r[i.to.toString()],a=r[i.from.toString()];if(!o&&a&&(o=a),!a&&o&&(a=o),!o||!a){const t=s.getPaintProperty(e);o=r[t],a=r[t]}o&&a&&t.setConstantPatternPositions(o,a)}function ji(t,e,i,n,s,r,o){const a=t.context.gl,l="fill-pattern",c=i.paint.get(l),g=c&&c.constantOr(1),h=i.getCrossfadeParameters();let u,d,p,m,I;o?(d=g&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",u=a.LINES):(d=g?"fillPattern":"fill",u=a.TRIANGLES);const C=c.constantOr(null);for(const c of n){const n=e.getTile(c);if(g&&!n.patternsLoaded())continue;const f=n.getBucket(i);if(!f)continue;const A=f.programConfigurations.get(i.id),y=t.useProgram(d,A),b=t.style.map.terrain&&t.style.map.terrain.getTerrainData(c);g&&(t.context.activeTexture.set(a.TEXTURE0),n.imageAtlasTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE),A.updatePaintBuffers(h)),Ui(A,l,C,n,i);const _=b?c:null,v=t.translatePosMatrix(_?_.posMatrix:c.posMatrix,n,i.paint.get("fill-translate"),i.paint.get("fill-translate-anchor"));if(o){m=f.indexBuffer2,I=f.segments2;const e=[a.drawingBufferWidth,a.drawingBufferHeight];p="fillOutlinePattern"===d&&g?we(v,t,h,n,e):xe(v,e)}else m=f.indexBuffer,I=f.segments,p=g?ve(v,t,h,n):_e(v);y.draw(t.context,u,s,t.stencilModeForClipping(c),r,Xi.disabled,p,b,i.id,f.layoutVertexBuffer,m,I,i.paint,t.transform.zoom,A)}}function Qi(t,e,i,n,s,r,o){const a=t.context,l=a.gl,c="fill-extrusion-pattern",g=i.paint.get(c),h=g.constantOr(1),u=i.getCrossfadeParameters(),d=i.paint.get("fill-extrusion-opacity"),p=g.constantOr(null);for(const g of n){const n=e.getTile(g),m=n.getBucket(i);if(!m)continue;const I=t.style.map.terrain&&t.style.map.terrain.getTerrainData(g),C=m.programConfigurations.get(i.id),f=t.useProgram(h?"fillExtrusionPattern":"fillExtrusion",C);h&&(t.context.activeTexture.set(l.TEXTURE0),n.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),C.updatePaintBuffers(u)),Ui(C,c,p,n,i);const A=t.translatePosMatrix(g.posMatrix,n,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),y=i.paint.get("fill-extrusion-vertical-gradient"),b=h?be(A,t,y,d,g,u,n):ye(A,t,y,d);f.draw(a,a.gl.TRIANGLES,s,r,o,Xi.backCCW,b,I,i.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,i.paint,t.transform.zoom,C,t.style.map.terrain&&m.centroidVertexBuffer)}}function qi(t,e,i,n,s,r,o){const a=t.context,l=a.gl,c=i.fbo;if(!c)return;const g=t.useProgram("hillshade"),h=t.style.map.terrain&&t.style.map.terrain.getTerrainData(e);a.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,c.colorAttachment.get()),g.draw(a,l.TRIANGLES,s,r,o,Xi.disabled,((t,e,i,n)=>{const s=i.paint.get("hillshade-shadow-color"),r=i.paint.get("hillshade-highlight-color"),o=i.paint.get("hillshade-accent-color");let a=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===i.paint.get("hillshade-illumination-anchor")&&(a-=t.transform.angle);const l=!t.options.moving;return{u_matrix:n?n.posMatrix:t.transform.calculatePosMatrix(e.tileID.toUnwrapped(),l),u_image:0,u_latrange:Re(0,e.tileID),u_light:[i.paint.get("hillshade-exaggeration"),a],u_shadow:s,u_highlight:r,u_accent:o}})(t,i,n,h?e:null),h,n.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}function $i(t,i,n,s,r,o){const a=t.context,l=a.gl,c=i.dem;if(c&&c.data){const g=c.dim,h=c.stride,u=c.getPixels();if(a.activeTexture.set(l.TEXTURE1),a.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||t.getTileTexture(h),i.demTexture){const t=i.demTexture;t.update(u,{premultiply:!1}),t.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else i.demTexture=new b(a,u,l.RGBA,{premultiply:!1}),i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);a.activeTexture.set(l.TEXTURE0);let d=i.fbo;if(!d){const t=new b(a,{width:g,height:g,data:null},l.RGBA);t.bind(l.LINEAR,l.CLAMP_TO_EDGE),d=i.fbo=a.createFramebuffer(g,g,!0,!1),d.colorAttachment.set(t.texture)}a.bindFramebuffer.set(d.framebuffer),a.viewport.set([0,0,g,g]),t.useProgram("hillshadePrepare").draw(a,l.TRIANGLES,s,r,o,Xi.disabled,((t,i)=>{const n=i.stride,s=e.H();return e.aQ(s,0,e.X,-e.X,0,0,1),e.J(s,s,[0,-e.X,0]),{u_matrix:s,u_image:1,u_dimension:[n,n],u_zoom:t.overscaledZ,u_unpack:i.getUnpackVector()}})(i.tileID,c),null,n.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments),i.needsHillshadePrepare=!1}}function tn(t,i,n,s,o,a){const l=s.paint.get("raster-fade-duration");if(!a&&l>0){const s=r.now(),a=(s-t.timeAdded)/l,c=i?(s-i.timeAdded)/l:-1,g=n.getSource(),h=o.coveringZoomLevel({tileSize:g.tileSize,roundZoom:g.roundZoom}),u=!i||Math.abs(i.tileID.overscaledZ-h)>Math.abs(t.tileID.overscaledZ-h),d=u&&t.refreshedUponExpiration?1:e.ad(u?a:1-c,0,1);return t.refreshedUponExpiration&&a>=1&&(t.refreshedUponExpiration=!1),i?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return{opacity:1,mix:0}}const en=new e.aN(1,0,0,1),nn=new e.aN(0,1,0,1),sn=new e.aN(0,0,1,1),rn=new e.aN(1,0,1,1),on=new e.aN(0,1,1,1);function an(t,e,i,n){cn(t,0,e+i/2,t.transform.width,i,n)}function ln(t,e,i,n){cn(t,e-i/2,0,i,t.transform.height,n)}function cn(t,e,i,n,s,r){const o=t.context,a=o.gl;a.enable(a.SCISSOR_TEST),a.scissor(e*t.pixelRatio,i*t.pixelRatio,n*t.pixelRatio,s*t.pixelRatio),o.clear({color:r}),a.disable(a.SCISSOR_TEST)}function gn(t,i,n){const s=t.context,r=s.gl,o=n.posMatrix,a=t.useProgram("debug"),l=zi.disabled,c=Mi.disabled,g=t.colorModeForRenderPass(),h="$debug",u=t.style.map.terrain&&t.style.map.terrain.getTerrainData(n);s.activeTexture.set(r.TEXTURE0);const d=i.getTileByID(n.key).latestRawTileData,p=Math.floor((d&&d.byteLength||0)/1024),m=i.getTile(n).tileSize,I=512/Math.min(m,512)*(n.overscaledZ/t.transform.zoom)*.5;let C=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(C+=` => ${n.overscaledZ}`),function(t,e){t.initDebugOverlayCanvas();const i=t.debugOverlayCanvas,n=t.context.gl,s=t.debugOverlayCanvas.getContext("2d");s.clearRect(0,0,i.width,i.height),s.shadowColor="white",s.shadowBlur=2,s.lineWidth=1.5,s.strokeStyle="white",s.textBaseline="top",s.font="bold 36px Open Sans, sans-serif",s.fillText(e,5,5),s.strokeText(e,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}(t,`${C} ${p}kB`),a.draw(s,r.TRIANGLES,l,c,Wi.alphaBlended,Xi.disabled,Ze(o,e.aN.transparent,I),null,h,t.debugBuffer,t.quadTriangleIndexBuffer,t.debugSegments),a.draw(s,r.LINE_STRIP,l,c,g,Xi.disabled,Ze(o,e.aN.red),u,h,t.debugBuffer,t.tileBorderIndexBuffer,t.debugSegments)}function hn(t,e,i){const n=t.context,s=n.gl,r=t.colorModeForRenderPass(),o=new zi(s.LEQUAL,zi.ReadWrite,t.depthRangeFor3D),a=t.useProgram("terrain"),l=e.getTerrainMesh();n.bindFramebuffer.set(null),n.viewport.set([0,0,t.width,t.height]);for(const c of i){const i=t.renderToTexture.getTexture(c),g=e.getTerrainData(c.tileID);n.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,i.texture);const h=t.transform.calculatePosMatrix(c.tileID.toUnwrapped()),u=e.getMeshFrameDelta(t.transform.zoom),d=t.transform.calculateFogMatrix(c.tileID.toUnwrapped()),p=Ie(h,u,d,t.style.sky,t.transform.pitch);a.draw(n,s.TRIANGLES,o,Mi.disabled,r,Xi.backCCW,p,g,"terrain",l.vertexBuffer,l.indexBuffer,l.segments)}}class un{constructor(t,e,i){this.vertexBuffer=t,this.indexBuffer=e,this.segments=i}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class dn{constructor(t,i){this.context=new Ji(t),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:e.ao(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=ht.maxUnderzooming+ht.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new le}resize(t,e,i){if(this.width=Math.floor(t*i),this.height=Math.floor(e*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const t of this.style._order)this.style._layers[t].resize()}setup(){const t=this.context,i=new e.aX;i.emplaceBack(0,0),i.emplaceBack(e.X,0),i.emplaceBack(0,e.X),i.emplaceBack(e.X,e.X),this.tileExtentBuffer=t.createVertexBuffer(i,ue.members),this.tileExtentSegments=e.a0.simpleSegment(0,0,4,2);const n=new e.aX;n.emplaceBack(0,0),n.emplaceBack(e.X,0),n.emplaceBack(0,e.X),n.emplaceBack(e.X,e.X),this.debugBuffer=t.createVertexBuffer(n,ue.members),this.debugSegments=e.a0.simpleSegment(0,0,4,5);const s=new e.$;s.emplaceBack(0,0,0,0),s.emplaceBack(e.X,0,e.X,0),s.emplaceBack(0,e.X,0,e.X),s.emplaceBack(e.X,e.X,e.X,e.X),this.rasterBoundsBuffer=t.createVertexBuffer(s,q.members),this.rasterBoundsSegments=e.a0.simpleSegment(0,0,4,2);const r=new e.aX;r.emplaceBack(0,0),r.emplaceBack(1,0),r.emplaceBack(0,1),r.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(r,ue.members),this.viewportSegments=e.a0.simpleSegment(0,0,4,2);const o=new e.aZ;o.emplaceBack(0),o.emplaceBack(1),o.emplaceBack(3),o.emplaceBack(2),o.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(o);const a=new e.aY;a.emplaceBack(0,1,2),a.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(a);const l=this.context.gl;this.stencilClearMode=new Mi({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO)}clearStencil(){const t=this.context,i=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const n=e.H();e.aQ(n,0,this.width,this.height,0,0,1),e.K(n,n,[i.drawingBufferWidth,i.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,i.TRIANGLES,zi.disabled,this.stencilClearMode,Wi.disabled,Xi.disabled,Be(n),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,e){if(this.currentStencilSource===t.source||!t.isTileClipped()||!e||!e.length)return;this.currentStencilSource=t.source;const i=this.context,n=i.gl;this.nextStencilID+e.length>256&&this.clearStencil(),i.setColorMode(Wi.disabled),i.setDepthMode(zi.disabled);const s=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const t of e){const e=this._tileClippingMaskIDs[t.key]=this.nextStencilID++,r=this.style.map.terrain&&this.style.map.terrain.getTerrainData(t);s.draw(i,n.TRIANGLES,zi.disabled,new Mi({func:n.ALWAYS,mask:0},e,255,n.KEEP,n.KEEP,n.REPLACE),Wi.disabled,Xi.disabled,Be(t.posMatrix),r,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,e=this.context.gl;return new Mi({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){const e=this.context.gl;return new Mi({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}stencilConfigForOverlap(t){const e=this.context.gl,i=t.sort(((t,e)=>e.overscaledZ-t.overscaledZ)),n=i[i.length-1].overscaledZ,s=i[0].overscaledZ-n+1;if(s>1){this.currentStencilSource=void 0,this.nextStencilID+s>256&&this.clearStencil();const t={};for(let i=0;i({u_sky_color:t.properties.get("sky-color"),u_horizon_color:t.properties.get("horizon-color"),u_horizon:(e.height/2+e.getHorizon())*i,u_sky_horizon_blend:t.properties.get("sky-horizon-blend")*e.height/2*i}))(i,t.style.map.transform,t.pixelRatio),o=new zi(s.LEQUAL,zi.ReadWrite,[0,1]),a=Mi.disabled,l=t.colorModeForRenderPass(),c=t.useProgram("sky");if(!i.mesh){const t=new e.aX;t.emplaceBack(-1,-1),t.emplaceBack(1,-1),t.emplaceBack(1,1),t.emplaceBack(-1,1);const s=new e.aY;s.emplaceBack(0,1,2),s.emplaceBack(0,2,3),i.mesh=new un(n.createVertexBuffer(t,ue.members),n.createIndexBuffer(s),e.a0.simpleSegment(0,0,t.length,s.length))}c.draw(n,s.TRIANGLES,o,a,l,Xi.disabled,r,void 0,"sky",i.mesh.vertexBuffer,i.mesh.indexBuffer,i.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=n.length-1;this.currentLayer>=0;this.currentLayer--){const t=this.style._layers[n[this.currentLayer]],e=s[t.source],i=o[t.source];this._renderTileClippingMasks(t,i),this.renderLayer(this,e,t,i)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayeri.source&&!i.isHidden(e)?[t.sourceCaches[i.source]]:[])),s=n.filter((t=>"vector"===t.getSource().type)),r=n.filter((t=>"vector"!==t.getSource().type)),o=t=>{(!i||i.getSource().maxzoomo(t))),i||r.forEach((t=>o(t))),i}(this.style,this.transform.zoom);t&&function(t,e,i){for(let n=0;n0),s&&(e.b0(i,n),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(t,i){const n=t.context,s=n.gl,r=Wi.unblended,o=new zi(s.LEQUAL,zi.ReadWrite,[0,1]),a=i.getTerrainMesh(),l=i.sourceCache.getRenderableTiles(),c=t.useProgram("terrainDepth");n.bindFramebuffer.set(i.getFramebuffer("depth").framebuffer),n.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),n.clear({color:e.aN.transparent,depth:1});for(const e of l){const l=i.getTerrainData(e.tileID),g={u_matrix:t.transform.calculatePosMatrix(e.tileID.toUnwrapped()),u_ele_delta:i.getMeshFrameDelta(t.transform.zoom)};c.draw(n,s.TRIANGLES,o,Mi.disabled,r,Xi.backCCW,g,l,"terrain",a.vertexBuffer,a.indexBuffer,a.segments)}n.bindFramebuffer.set(null),n.viewport.set([0,0,t.width,t.height])}(this,this.style.map.terrain),function(t,i){const n=t.context,s=n.gl,r=Wi.unblended,o=new zi(s.LEQUAL,zi.ReadWrite,[0,1]),a=i.getTerrainMesh(),l=i.getCoordsTexture(),c=i.sourceCache.getRenderableTiles(),g=t.useProgram("terrainCoords");n.bindFramebuffer.set(i.getFramebuffer("coords").framebuffer),n.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),n.clear({color:e.aN.transparent,depth:1}),i.coordsIndex=[];for(const e of c){const c=i.getTerrainData(e.tileID);n.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,l.texture);const h={u_matrix:t.transform.calculatePosMatrix(e.tileID.toUnwrapped()),u_terrain_coords_id:(255-i.coordsIndex.length)/255,u_texture:0,u_ele_delta:i.getMeshFrameDelta(t.transform.zoom)};g.draw(n,s.TRIANGLES,o,Mi.disabled,r,Xi.backCCW,h,c,"terrain",a.vertexBuffer,a.indexBuffer,a.segments),i.coordsIndex.push(e.tileID.key)}n.bindFramebuffer.set(null),n.viewport.set([0,0,t.width,t.height])}(this,this.style.map.terrain))}renderLayer(t,i,n,s){if(!n.isHidden(this.transform.zoom)&&("background"===n.type||"custom"===n.type||(s||[]).length))switch(this.id=n.id,n.type){case"symbol":!function(t,i,n,s,r){if("translucent"!==t.renderPass)return;const o=Mi.disabled,a=t.colorModeForRenderPass();(n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(t,i,n,s,r,o,a,l,c){const g=i.transform,h=ee(),u="map"===r,d="map"===o;for(const r of t){const t=s.getTile(r),o=t.getBucket(n);if(!o||!o.text||!o.text.segments.get().length)continue;const p=e.ah(o.textSizeData,g.zoom),m=zt(t,1,i.transform.zoom),I=Ct(r.posMatrix,d,u,i.transform,m),C="none"!==n.layout.get("icon-text-fit")&&o.hasIconData();if(p){const e=Math.pow(2,g.zoom-t.tileID.overscaledZ),n=i.style.map.terrain?(t,e)=>i.style.map.terrain.getElevation(r,t,e):null,s=h.translatePosition(g,t,a,l);Di(o,u,d,c,g,I,r.posMatrix,e,p,C,h,s,r.toUnwrapped(),n)}}}(s,t,n,i,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),r),0!==n.paint.get("icon-opacity").constantOr(1)&&Ni(t,i,n,s,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),o,a),0!==n.paint.get("text-opacity").constantOr(1)&&Ni(t,i,n,s,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),o,a),i.map.showCollisionBoxes&&(Ki(t,i,n,s,!0),Ki(t,i,n,s,!1))}(t,i,n,s,this.style.placement.variableOffsets);break;case"circle":!function(t,i,n,s){if("translucent"!==t.renderPass)return;const r=n.paint.get("circle-opacity"),o=n.paint.get("circle-stroke-width"),a=n.paint.get("circle-stroke-opacity"),l=!n.layout.get("circle-sort-key").isConstant();if(0===r.constantOr(1)&&(0===o.constantOr(1)||0===a.constantOr(1)))return;const c=t.context,g=c.gl,h=t.depthModeForSublayer(0,zi.ReadOnly),u=Mi.disabled,d=t.colorModeForRenderPass(),p=[];for(let r=0;rt.sortKey-e.sortKey));for(const e of p){const{programConfiguration:i,program:s,layoutVertexBuffer:r,indexBuffer:o,uniformValues:a,terrainData:l}=e.state;s.draw(c,g.TRIANGLES,h,u,d,Xi.disabled,a,l,n.id,r,o,e.segments,n.paint,t.transform.zoom,i)}}(t,i,n,s);break;case"heatmap":!function(t,i,n,s){if(0!==n.paint.get("heatmap-opacity"))if("offscreen"===t.renderPass){const r=t.context,o=r.gl,a=Mi.disabled,l=new Wi([o.ONE,o.ONE],e.aN.transparent,[!0,!0,!0,!0]);!function(t,e,i){const n=t.gl;t.activeTexture.set(n.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);let s=i.heatmapFbo;if(s)n.bindTexture(n.TEXTURE_2D,s.colorAttachment.get()),t.bindFramebuffer.set(s.framebuffer);else{const r=n.createTexture();n.bindTexture(n.TEXTURE_2D,r),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),s=i.heatmapFbo=t.createFramebuffer(e.width/4,e.height/4,!1,!1),function(t,e,i,n){var s,r;const o=t.gl,a=null!==(s=t.HALF_FLOAT)&&void 0!==s?s:o.UNSIGNED_BYTE,l=null!==(r=t.RGBA16F)&&void 0!==r?r:o.RGBA;o.texImage2D(o.TEXTURE_2D,0,l,e.width/4,e.height/4,0,o.RGBA,a,null),n.colorAttachment.set(i)}(t,e,r,s)}}(r,t,n),r.clear({color:e.aN.transparent});for(let e=0;e{const r=e.H();e.aQ(r,0,t.width,t.height,0,0,1);const o=t.context.gl;return{u_matrix:r,u_world:[o.drawingBufferWidth,o.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:i.paint.get("heatmap-opacity")}})(t,i),null,i.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,i.paint,t.transform.zoom)}(t,n))}(t,i,n,s);break;case"line":!function(t,i,n,s){if("translucent"!==t.renderPass)return;const r=n.paint.get("line-opacity"),o=n.paint.get("line-width");if(0===r.constantOr(1)||0===o.constantOr(1))return;const a=t.depthModeForSublayer(0,zi.ReadOnly),l=t.colorModeForRenderPass(),c=n.paint.get("line-dasharray"),g=n.paint.get("line-pattern"),h=g.constantOr(1),u=n.paint.get("line-gradient"),d=n.getCrossfadeParameters(),p=h?"linePattern":c?"lineSDF":u?"lineGradient":"line",m=t.context,I=m.gl;let C=!0;for(const r of s){const s=i.getTile(r);if(h&&!s.patternsLoaded())continue;const o=s.getBucket(n);if(!o)continue;const f=o.programConfigurations.get(n.id),A=t.context.program.get(),y=t.useProgram(p,f),_=C||y.program!==A,v=t.style.map.terrain&&t.style.map.terrain.getTerrainData(r),x=g.constantOr(null);if(x&&s.imageAtlas){const t=s.imageAtlas,e=t.patternPositions[x.to.toString()],i=t.patternPositions[x.from.toString()];e&&i&&f.setConstantPatternPositions(e,i)}const w=v?r:null,S=h?We(t,s,n,d,w):c?Je(t,s,n,c,d,w):u?Te(t,s,n,o.lineClipsArray.length,w):Ve(t,s,n,w);if(h)m.activeTexture.set(I.TEXTURE0),s.imageAtlasTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE),f.updatePaintBuffers(d);else if(c&&(_||t.lineAtlas.dirty))m.activeTexture.set(I.TEXTURE0),t.lineAtlas.bind(m);else if(u){const s=o.gradients[n.id];let a=s.texture;if(n.gradientVersion!==s.version){let l=256;if(n.stepInterpolant){const n=i.getSource().maxzoom,s=r.canonical.z===n?Math.ceil(1<0?e.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const e=this.imageManager.getPattern(t.from.toString()),i=this.imageManager.getPattern(t.to.toString());return!e||!i}useProgram(t,e){this.cache=this.cache||{};const i=t+(e?e.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[i]||(this.cache[i]=new fe(this.context,de[t],e,De[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[i]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new b(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:e}=this.context.gl;return this.width!==t||this.height!==e}}class pn{constructor(t,e){this.points=t,this.planes=e}static fromInvProjectionMatrix(t,i,n){const s=Math.pow(2,n),r=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((n=>{const r=1/(n=e.ag([],n,t))[3]/i*s;return e.b1(n,n,[r,r,1/n[3],r])})),o=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((t=>{const e=function(t,e){var i=e[0],n=e[1],s=e[2],r=i*i+n*n+s*s;return r>0&&(r=1/Math.sqrt(r)),t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}([],function(t,e,i){var n=e[0],s=e[1],r=e[2],o=i[0],a=i[1],l=i[2];return t[0]=s*l-r*a,t[1]=r*o-n*l,t[2]=n*a-s*o,t}([],C([],r[t[0]],r[t[1]]),C([],r[t[2]],r[t[1]]))),i=-((n=e)[0]*(s=r[t[1]])[0]+n[1]*s[1]+n[2]*s[2]);var n,s;return e.concat(i)}));return new pn(r,o)}}class mn{constructor(t,e){this.min=t,this.max=e,this.center=function(t,e,i){return t[0]=.5*e[0],t[1]=.5*e[1],t[2]=.5*e[2],t}([],function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t}([],this.min,this.max))}quadrant(t){const e=[t%2==0,t<2],i=m(this.min),n=m(this.max);for(let t=0;t=0&&o++;if(0===o)return 0;o!==i.length&&(n=!1)}if(n)return 2;for(let e=0;e<3;e++){let i=Number.MAX_VALUE,n=-Number.MAX_VALUE;for(let s=0;sthis.max[e]-this.min[e])return 0}return 1}}class In{constructor(t=0,e=0,i=0,n=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(i)||i<0||isNaN(n)||n<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=i,this.right=n}interpolate(t,i,n){return null!=i.top&&null!=t.top&&(this.top=e.z.number(t.top,i.top,n)),null!=i.bottom&&null!=t.bottom&&(this.bottom=e.z.number(t.bottom,i.bottom,n)),null!=i.left&&null!=t.left&&(this.left=e.z.number(t.left,i.left,n)),null!=i.right&&null!=t.right&&(this.right=e.z.number(t.right,i.right,n)),this}getCenter(t,i){const n=e.ad((this.left+t-this.right)/2,0,t),s=e.ad((this.top+i-this.bottom)/2,0,i);return new e.P(n,s)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new In(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Cn=85.051129;class fn{constructor(t,i,n,s,r){this.tileSize=512,this._renderWorldCopies=void 0===r||!!r,this._minZoom=t||0,this._maxZoom=i||22,this._minPitch=null==n?0:n,this._maxPitch=null==s?60:s,this.setMaxBounds(),this.width=0,this.height=0,this._center=new e.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new In,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const t=new fn(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this.minElevationForCurrentTile=t.minElevationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new e.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const i=-e.b3(t,-180,180)*Math.PI/180;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=function(){var t=new e.A(4);return e.A!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}(),function(t,e,i){var n=e[0],s=e[1],r=e[2],o=e[3],a=Math.sin(i),l=Math.cos(i);t[0]=n*l+r*a,t[1]=s*l+o*a,t[2]=n*-a+r*l,t[3]=s*-a+o*l}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const i=e.ad(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.tileZoom=Math.max(0,Math.floor(e)),this.scale=this.zoomScale(e),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,i){this._unmodified=!1,this._edgeInsets.interpolate(t,e,i),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)}getVisibleUnwrappedCoordinates(t){const i=[new e.b4(0,t)];if(this._renderWorldCopies){const n=this.pointCoordinate(new e.P(0,0)),s=this.pointCoordinate(new e.P(this.width,0)),r=this.pointCoordinate(new e.P(this.width,this.height)),o=this.pointCoordinate(new e.P(0,this.height)),a=Math.floor(Math.min(n.x,s.x,r.x,o.x)),l=Math.floor(Math.max(n.x,s.x,r.x,o.x)),c=1;for(let n=a-c;n<=l+c;n++)0!==n&&i.push(new e.b4(n,t))}return i}coveringTiles(t){var i,n;let s=this.coveringZoomLevel(t);const r=s;if(void 0!==t.minzoom&&st.maxzoom&&(s=t.maxzoom);const o=this.pointCoordinate(this.getCameraPoint()),a=e.Z.fromLngLat(this.center),l=Math.pow(2,s),c=[l*o.x,l*o.y,0],g=[l*a.x,l*a.y,0],h=pn.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,s);let u=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(u=s);const d=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,p=t=>({aabb:new mn([t*l,0,0],[(t+1)*l,l,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),m=[],I=[],C=s,A=t.reparseOverscaled?r:s;if(this._renderWorldCopies)for(let t=1;t<=3;t++)m.push(p(-t)),m.push(p(t));for(m.push(p(0));m.length>0;){const s=m.pop(),r=s.x,o=s.y;let a=s.fullyVisible;if(!a){const t=s.aabb.intersects(h);if(0===t)continue;a=2===t}const l=t.terrain?c:g,p=s.aabb.distanceX(l),y=s.aabb.distanceY(l),b=Math.max(Math.abs(p),Math.abs(y));if(s.zoom===C||b>d+(1<=u){const t=C-s.zoom,i=c[0]-.5-(r<>1),h=s.zoom+1;let u=s.aabb.quadrant(l);if(t.terrain){const r=new e.S(h,s.wrap,h,c,g),o=t.terrain.getMinMaxElevation(r),a=null!==(i=o.minElevation)&&void 0!==i?i:this.elevation,l=null!==(n=o.maxElevation)&&void 0!==n?n:this.elevation;u=new mn([u.min[0],u.min[1],a],[u.max[0],u.max[1],l])}m.push({aabb:u,zoom:h,x:c,y:g,wrap:s.wrap,fullyVisible:a})}}return I.sort(((t,e)=>t.distanceSq-e.distanceSq)).map((t=>t.tileID))}resize(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const i=e.ad(t.lat,-85.051129,Cn);return new e.P(e.O(t.lng)*this.worldSize,e.Q(i)*this.worldSize)}unproject(t){return new e.Z(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const i=this.elevation,n=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,s=this.pointLocation(this.centerPoint,t),r=t.getElevationForLngLatZoom(s,this.tileZoom);if(!(this.elevation-r))return;const o=n+i-r,a=Math.cos(this._pitch)*this.cameraToCenterDistance/o/e.b5(1,s.lat),l=this.scaleZoom(a/this.tileSize);this._elevation=r,this._center=s,this.zoom=l}setLocationAtPoint(t,i){const n=this.pointCoordinate(i),s=this.pointCoordinate(this.centerPoint),r=this.locationCoordinate(t),o=new e.Z(r.x-(n.x-s.x),r.y-(n.y-s.y));this.center=this.coordinateLocation(o),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,e){return e?this.coordinatePoint(this.locationCoordinate(t),e.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,e){return this.coordinateLocation(this.pointCoordinate(t,e))}locationCoordinate(t){return e.Z.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,i){if(i){const e=i.pointCoordinate(t);if(null!=e)return e}const n=[t.x,t.y,0,1],s=[t.x,t.y,1,1];e.ag(n,n,this.pixelMatrixInverse),e.ag(s,s,this.pixelMatrixInverse);const r=n[3],o=s[3],a=n[1]/r,l=s[1]/o,c=n[2]/r,g=s[2]/o,h=c===g?0:(0-c)/(g-c);return new e.Z(e.z.number(n[0]/r,s[0]/o,h)/this.worldSize,e.z.number(a,l,h)/this.worldSize)}coordinatePoint(t,i=0,n=this.pixelMatrix){const s=[t.x*this.worldSize,t.y*this.worldSize,i,1];return e.ag(s,s,n),new e.P(s[0]/s[3],s[1]/s[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return(new Y).extend(this.pointLocation(new e.P(0,t))).extend(this.pointLocation(new e.P(this.width,t))).extend(this.pointLocation(new e.P(this.width,this.height))).extend(this.pointLocation(new e.P(0,this.height)))}getMaxBounds(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new Y([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,Cn])}calculateTileMatrix(t){const i=t.canonical,n=this.worldSize/this.zoomScale(i.z),s=i.x+Math.pow(2,i.z)*t.wrap,r=e.ao(new Float64Array(16));return e.J(r,r,[s*n,i.y*n,0]),e.K(r,r,[n/e.X,n/e.X,1]),r}calculatePosMatrix(t,i=!1){const n=t.key,s=i?this._alignedPosMatrixCache:this._posMatrixCache;if(s[n])return s[n];const r=this.calculateTileMatrix(t);return e.L(r,i?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,r),s[n]=new Float32Array(r),s[n]}calculateFogMatrix(t){const i=t.key,n=this._fogMatrixCache;if(n[i])return n[i];const s=this.calculateTileMatrix(t);return e.L(s,this.fogMatrix,s),n[i]=new Float32Array(s),n[i]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(t,i){i=e.ad(+i,this.minZoom,this.maxZoom);const n={center:new e.N(t.lng,t.lat),zoom:i};let s=this.lngRange;if(!this._renderWorldCopies&&null===s){const t=180-1e-10;s=[-t,t]}const r=this.tileSize*this.zoomScale(n.zoom);let o=0,a=r,l=0,c=r,g=0,h=0;const{x:u,y:d}=this.size;if(this.latRange){const t=this.latRange;o=e.Q(t[1])*r,a=e.Q(t[0])*r,a-oa&&(C=a-t)}if(s){const t=(l+c)/2;let i=p;this._renderWorldCopies&&(i=e.b3(p,t-r/2,t+r/2));const n=u/2;i-nc&&(I=c-n)}if(void 0!==I||void 0!==C){const t=new e.P(null!=I?I:p,null!=C?C:m);n.center=this.unproject.call({worldSize:r},t).wrap()}return n}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:e,zoom:i}=this.getConstrained(this.center,this.zoom);this.center=e,this.zoom=i,this._unmodified=t,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,i=this.point.x,n=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=e.b5(1,this.center.lat)*this.worldSize;let s=e.ao(new Float64Array(16));e.K(s,s,[this.width/2,-this.height/2,1]),e.J(s,s,[1,-1,0]),this.labelPlaneMatrix=s,s=e.ao(new Float64Array(16)),e.K(s,s,[1,-1,1]),e.J(s,s,[-1,-1,0]),e.K(s,s,[2/this.width,2/this.height,1]),this.glCoordMatrix=s;const r=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),o=Math.min(this.elevation,this.minElevationForCurrentTile),a=r-o*this._pixelPerMeter/Math.cos(this._pitch),l=o<0?a:r,c=Math.PI/2+this._pitch,g=this._fov*(.5+t.y/this.height),h=Math.sin(g)*l/Math.sin(e.ad(Math.PI-c-g,.01,Math.PI-.01)),u=this.getHorizon(),d=2*Math.atan(u/this.cameraToCenterDistance)*(.5+t.y/(2*u)),p=Math.sin(d)*l/Math.sin(e.ad(Math.PI-c-d,.01,Math.PI-.01)),m=Math.min(h,p),I=1.01*(Math.cos(Math.PI/2-this._pitch)*m+l),C=this.height/50;s=new Float64Array(16),e.b6(s,this._fov,this.width/this.height,C,I),s[8]=2*-t.x/this.width,s[9]=2*t.y/this.height,e.K(s,s,[1,-1,1]),e.J(s,s,[0,0,-this.cameraToCenterDistance]),e.b7(s,s,this._pitch),e.ae(s,s,this.angle),e.J(s,s,[-i,-n,0]),this.mercatorMatrix=e.K([],s,[this.worldSize,this.worldSize,this.worldSize]),e.K(s,s,[1,1,this._pixelPerMeter]),this.pixelMatrix=e.L(new Float64Array(16),this.labelPlaneMatrix,s),e.J(s,s,[0,0,-this.elevation]),this.modelViewProjectionMatrix=s,this.invModelViewProjectionMatrix=e.at([],s),this.fogMatrix=new Float64Array(16),e.b6(this.fogMatrix,this._fov,this.width/this.height,r,I),this.fogMatrix[8]=2*-t.x/this.width,this.fogMatrix[9]=2*t.y/this.height,e.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),e.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),e.b7(this.fogMatrix,this.fogMatrix,this._pitch),e.ae(this.fogMatrix,this.fogMatrix,this.angle),e.J(this.fogMatrix,this.fogMatrix,[-i,-n,0]),e.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),e.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=e.L(new Float64Array(16),this.labelPlaneMatrix,s);const f=this.width%2/2,A=this.height%2/2,y=Math.cos(this.angle),b=Math.sin(this.angle),_=i-Math.round(i)+y*f+b*A,v=n-Math.round(n)+y*A+b*f,x=new Float64Array(s);if(e.J(x,x,[_>.5?_-1:_,v>.5?v-1:v,0]),this.alignedModelViewProjectionMatrix=x,s=e.at(new Float64Array(16),this.pixelMatrix),!s)throw new Error("failed to invert matrix");this.pixelMatrixInverse=s,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new e.P(0,0)),i=[t.x*this.worldSize,t.y*this.worldSize,0,1];return e.ag(i,i,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.P(0,t))}getCameraQueryGeometry(t){const i=this.getCameraPoint();if(1===t.length)return[t[0],i];{let n=i.x,s=i.y,r=i.x,o=i.y;for(const e of t)n=Math.min(n,e.x),s=Math.min(s,e.y),r=Math.max(r,e.x),o=Math.max(o,e.y);return[new e.P(n,s),new e.P(r,s),new e.P(r,o),new e.P(n,o),new e.P(n,s)]}}lngLatToCameraDepth(t,i){const n=this.locationCoordinate(t),s=[n.x*this.worldSize,n.y*this.worldSize,i,1];return e.ag(s,s,this.modelViewProjectionMatrix),s[2]/s[3]}}function An(t,e){let i,n=!1,s=null,r=null;const o=()=>{s=null,n&&(t.apply(r,i),s=setTimeout(o,e),n=!1)};return(...t)=>(n=!0,r=this,i=t,s||o(),s)}class yn{constructor(t){this._getCurrentHash=()=>{const t=window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map((t=>t.split("="))).forEach((t=>{t[0]===this._hashName&&(e=t)})),(e&&e[1]||"").split("/")}return t.split("/")},this._onHashChange=()=>{const t=this._getCurrentHash();if(t.length>=3&&!t.some((t=>isNaN(t)))){const e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch(t){}},this._updateHash=An(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const e=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,n=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),s=Math.pow(10,n),r=Math.round(e.lng*s)/s,o=Math.round(e.lat*s)/s,a=this._map.getBearing(),l=this._map.getPitch();let c="";if(c+=t?`/${r}/${o}/${i}`:`${i}/${o}/${r}`,(a||l)&&(c+="/"+Math.round(10*a)/10),l&&(c+=`/${Math.round(l)}`),this._hashName){const t=this._hashName;let e=!1;const i=window.location.hash.slice(1).split("&").map((i=>{const n=i.split("=")[0];return n===t?(e=!0,`${n}=${c}`):i})).filter((t=>t));return e||i.push(`${t}=${c}`),`#${i.join("&")}`}return`#${c}`}}const bn={linearity:.3,easing:e.b8(0,0,.3,1)},_n=e.e({deceleration:2500,maxSpeed:1400},bn),vn=e.e({deceleration:20,maxSpeed:1400},bn),xn=e.e({deceleration:1e3,maxSpeed:360},bn),wn=e.e({deceleration:1e3,maxSpeed:90},bn);class Sn{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:r.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,e=r.now();for(;t.length>0&&e-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,pan:new e.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:t}of this._inertiaBuffer)i.zoom+=t.zoomDelta||0,i.bearing+=t.bearingDelta||0,i.pitch+=t.pitchDelta||0,t.panDelta&&i.pan._add(t.panDelta),t.around&&(i.around=t.around),t.pinchAround&&(i.pinchAround=t.pinchAround);const n=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,s={};if(i.pan.mag()){const r=Zn(i.pan.mag(),n,e.e({},_n,t||{}));s.offset=i.pan.mult(r.amount/i.pan.mag()),s.center=this._map.transform.center,kn(s,r)}if(i.zoom){const t=Zn(i.zoom,n,vn);s.zoom=this._map.transform.zoom+t.amount,kn(s,t)}if(i.bearing){const t=Zn(i.bearing,n,xn);s.bearing=this._map.transform.bearing+e.ad(t.amount,-179,179),kn(s,t)}if(i.pitch){const t=Zn(i.pitch,n,wn);s.pitch=this._map.transform.pitch+t.amount,kn(s,t)}if(s.zoom||s.bearing){const t=void 0===i.pinchAround?i.around:i.pinchAround;s.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),e.e(s,{noMoveStart:!0})}}function kn(t,e){(!t.duration||t.durationi.unproject(t))),l=r.reduce(((t,e,i,n)=>t.add(e.div(n.length))),new e.P(0,0));super(t,{points:r,point:l,lngLats:a,lngLat:i.unproject(l),originalEvent:n}),this._defaultPrevented=!1}}class Rn extends e.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,i){super(t,{originalEvent:i}),this._defaultPrevented=!1}}class Vn{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Rn(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new Bn(t.type,this._map,t))}mouseup(t){this._map.fire(new Bn(t.type,this._map,t))}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new Bn(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Bn(t.type,this._map,t))}mouseover(t){this._map.fire(new Bn(t.type,this._map,t))}mouseout(t){this._map.fire(new Bn(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Gn(t.type,this._map,t))}touchmove(t){this._map.fire(new Gn(t.type,this._map,t))}touchend(t){this._map.fire(new Gn(t.type,this._map,t))}touchcancel(t){this._map.fire(new Gn(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Tn{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Bn(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Bn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Bn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Wn{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.pointLocation(e.P.convert(t),this._map.terrain)}}class Jn{constructor(t,e){this._map=t,this._tr=new Wn(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(o.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)}mousemoveWindow(t,e){if(!this._active)return;const i=e;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)t.fitScreenCoordinates(n,s,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(o.remove(this._box),this._box=null),o.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,i){return this._map.fire(new e.k(t,{originalEvent:i}))}}function zn(t,e){if(t.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${t.length}, points ${e.length}`);const i={};for(let n=0;nthis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=t.timeStamp),n.length===this.numTouches&&(this.centroid=function(t){const i=new e.P(0,0);for(const e of t)i._add(e);return i.div(t.length)}(i),this.touches=zn(n,i)))}touchmove(t,e,i){if(this.aborted||!this.centroid)return;const n=zn(i,e);for(const t in this.touches){const e=n[t];(!e||e.dist(this.touches[t])>30)&&(this.aborted=!0)}}touchend(t,e,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class Mn{constructor(t){this.singleTap=new Pn(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,e,i){this.singleTap.touchstart(t,e,i)}touchmove(t,e,i){this.singleTap.touchmove(t,e,i)}touchend(t,e,i){const n=this.singleTap.touchend(t,e,i);if(n){const e=t.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(n)<30;if(e&&i||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}}}class Xn{constructor(t){this._tr=new Wn(t),this._zoomIn=new Mn({numTouches:1,numTaps:2}),this._zoomOut=new Mn({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,e,i){this._zoomIn.touchstart(t,e,i),this._zoomOut.touchstart(t,e,i)}touchmove(t,e,i){this._zoomIn.touchmove(t,e,i),this._zoomOut.touchmove(t,e,i)}touchend(t,e,i){const n=this._zoomIn.touchend(t,e,i),s=this._zoomOut.touchend(t,e,i),r=this._tr;return n?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:r.zoom+1,around:r.unproject(n)},{originalEvent:t})}):s?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:r.zoom-1,around:r.unproject(s)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Fn{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const e=this._moveFunction(...t);if(e.bearingDelta||e.pitchDelta||e.around||e.panDelta)return this._active=!0,e}dragStart(t,e){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=e.length?e[0]:e,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,e){if(!this.isEnabled())return;const i=this._lastPoint;if(!i)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const n=e.length?e[0]:e;return!this._moved&&n.dist(i){t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=t=>{t.preventDefault()}},Dn=({enable:t,clickTolerance:e,bearingDegreesPerPixelMoved:i=.8})=>{const n=new Hn({checkCorrectEvent:t=>0===o.mouseButton(t)&&t.ctrlKey||2===o.mouseButton(t)});return new Fn({clickTolerance:e,move:(t,e)=>({bearingDelta:(e.x-t.x)*i}),moveStateManager:n,enable:t,assignEvents:En})},Yn=({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:i=-.5})=>{const n=new Hn({checkCorrectEvent:t=>0===o.mouseButton(t)&&t.ctrlKey||2===o.mouseButton(t)});return new Fn({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*i}),moveStateManager:n,enable:t,assignEvents:En})};class Nn{constructor(t,e){this._clickTolerance=t.clickTolerance||1,this._map=e,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new e.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(t,e,i){return this._calculateTransform(t,e,i)}touchmove(t,e,i){if(this._active&&!(i.length0&&(this._active=!0);const s=zn(n,i),r=new e.P(0,0),o=new e.P(0,0);let a=0;for(const t in s){const e=s[t],i=this._touches[t];i&&(r._add(e),o._add(e.sub(i)),a++,s[t]=e)}if(this._touches=s,aMath.abs(t.x)}class es extends On{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,e,i){super.touchstart(t,e,i),this._currentTouchCount=i.length}_start(t){this._lastPoints=t,ts(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,e,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const n=t[0].sub(this._lastPoints[0]),s=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(n,s,i.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(n.y+s.y)/2*-.5}):void 0}gestureBeginsVertically(t,e,i){if(void 0!==this._valid)return this._valid;const n=t.mag()>=2,s=e.mag()>=2;if(!n&&!s)return;if(!n||!s)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const r=t.y>0==e.y>0;return ts(t)&&ts(e)&&r}}const is={panStep:100,bearingStep:15,pitchStep:10};class ns{constructor(t){this._tr=new Wn(t);const e=is;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let e=0,i=0,n=0,s=0,r=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?i=-1:(t.preventDefault(),s=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),s=1);break;case 38:t.shiftKey?n=1:(t.preventDefault(),r=-1);break;case 40:t.shiftKey?n=-1:(t.preventDefault(),r=1);break;default:return}return this._rotationDisabled&&(i=0,n=0),{cameraAnimation:o=>{const a=this._tr;o.easeTo({duration:300,easeId:"keyboardHandler",easing:ss,zoom:e?Math.round(a.zoom)+e*(t.shiftKey?2:1):a.zoom,bearing:a.bearing+i*this._bearingStep,pitch:a.pitch+n*this._pitchStep,offset:[-s*this._panStep,-r*this._panStep],center:a.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function ss(t){return t*(2-t)}const rs=4.000244140625;class os{constructor(t,e){this._onTimeout=t=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},this._map=t,this._tr=new Wn(t),this._triggerRenderFrame=e,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around)}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;if(this._map.cooperativeGestures.isEnabled()&&!t[this._map.cooperativeGestures._bypassKey])return;let e=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const i=r.now(),n=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==e&&e%rs==0?this._type="wheel":0!==e&&Math.abs(e)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(n*e)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e/=4),this._type&&(this._lastWheelEvent=t,this._delta-=e,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const i=o.mousePos(this._map.getCanvas(),t),n=this._tr;this._around=i.y>n.transform.height/2-n.transform.getHorizon()?e.N.convert(this._aroundCenter?n.center:n.unproject(i)):e.N.convert(n.center),this._aroundPoint=n.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const t=this._tr.transform;if(0!==this._delta){const e="wheel"===this._type&&Math.abs(this._delta)>rs?this._wheelZoomRate:this._defaultZoomRate;let i=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==i&&(i=1/i);const n="number"==typeof this._targetZoom?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(n*i))),"wheel"===this._type&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i="number"==typeof this._targetZoom?this._targetZoom:t.zoom,n=this._startZoom,s=this._easing;let o,a=!1;if("wheel"===this._type&&n&&s){const t=Math.min((r.now()-this._lastWheelEventTime)/200,1),l=s(t);o=e.z.number(n,i,l),t<1?this._frameId||(this._frameId=!0):a=!0}else o=i,a=!0;return this._active=!0,a&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!a,zoomDelta:o-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let i=e.b9;if(this._prevEase){const t=this._prevEase,n=(r.now()-t.start)/t.duration,s=t.easing(n+.01)-t.easing(n),o=.27/Math.sqrt(s*s+1e-4)*.01,a=Math.sqrt(.0729-o*o);i=e.b8(o,a,.25,1)}return this._prevEase={start:r.now(),duration:t,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class as{constructor(t,e){this._clickZoom=t,this._tapZoom=e}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class ls{constructor(t){this._tr=new Wn(t),this.reset()}reset(){this._active=!1}dblclick(t,e){return t.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(e)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class cs{constructor(){this._tap=new Mn({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,e,i){if(!this._swipePoint)if(this._tapTime){const n=e[0],s=t.timeStamp-this._tapTime<500,r=this._tapPoint.dist(n)<30;s&&r?i.length>0&&(this._swipePoint=n,this._swipeTouch=i[0].identifier):this.reset()}else this._tap.touchstart(t,e,i)}touchmove(t,e,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const n=e[0],s=n.y-this._swipePoint.y;return this._swipePoint=n,t.preventDefault(),this._active=!0,{zoomDelta:s/128}}}else this._tap.touchmove(t,e,i)}touchend(t,e,i){if(this._tapTime)this._swipePoint&&0===i.length&&this.reset();else{const n=this._tap.touchend(t,e,i);n&&(this._tapTime=t.timeStamp,this._tapPoint=n)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class gs{constructor(t,e,i){this._el=t,this._mousePan=e,this._touchPan=i}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class hs{constructor(t,e,i){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=i}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class us{constructor(t,e,i,n){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class ds{constructor(t,e){this._bypassKey=-1!==navigator.userAgent.indexOf("Mac")?"metaKey":"ctrlKey",this._map=t,this._options=e,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=o.create("div","maplibregl-cooperative-gesture-screen",t);let e=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(e=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),n=document.createElement("div");n.className="maplibregl-desktop-message",n.textContent=e,this._container.appendChild(n);const s=document.createElement("div");s.className="maplibregl-mobile-message",s.textContent=i,this._container.appendChild(s),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(o.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destoryUI()}isEnabled(){return this._enabled}touchmove(t){this._onCooperativeGesture(1===t.touches.length)}wheel(t){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!t[this._bypassKey])}_onCooperativeGesture(t){this._enabled&&t&&(this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}const ps=t=>t.zoom||t.drag||t.pitch||t.rotate;class ms extends e.k{}function Is(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}class Cs{constructor(t,e){this.handleWindowEvent=t=>{this.handleEvent(t,`${t.type}Window`)},this.handleEvent=(t,e)=>{if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;const i="renderFrame"===t.type?void 0:t,n={needsRenderFrame:!1},s={},r={},a=t.touches,l=a?this._getMapTouches(a):void 0,c=l?o.touchPos(this._map.getCanvas(),l):o.mousePos(this._map.getCanvas(),t);for(const{handlerName:o,handler:a,allowed:g}of this._handlers){if(!a.isEnabled())continue;let h;this._blockedByActive(r,g,o)?a.reset():a[e||t.type]&&(h=a[e||t.type](t,c,l),this.mergeHandlerResult(n,s,h,o,i),h&&h.needsRenderFrame&&this._triggerRenderFrame()),(h||a.isActive())&&(r[o]=a)}const g={};for(const t in this._previousActiveHandlers)r[t]||(g[t]=i);this._previousActiveHandlers=r,(Object.keys(g).length||Is(n))&&(this._changes.push([n,s,g]),this._triggerRenderFrame()),(Object.keys(r).length||Is(n))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:h}=n;h&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],h(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Sn(t),this._bearingSnap=e.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(e);const i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[window,"blur",void 0]];for(const[t,e,i]of this._listeners)o.addEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,i)}destroy(){for(const[t,e,i]of this._listeners)o.removeEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(t){const e=this._map,i=e.getCanvasContainer();this._add("mapEvent",new Vn(e,t));const n=e.boxZoom=new Jn(e,t);this._add("boxZoom",n),t.interactive&&t.boxZoom&&n.enable();const s=e.cooperativeGestures=new ds(e,t.cooperativeGestures);this._add("cooperativeGestures",s),t.cooperativeGestures&&s.enable();const r=new Xn(e),a=new ls(e);e.doubleClickZoom=new as(a,r),this._add("tapZoom",r),this._add("clickZoom",a),t.interactive&&t.doubleClickZoom&&e.doubleClickZoom.enable();const l=new cs;this._add("tapDragZoom",l);const c=e.touchPitch=new es(e);this._add("touchPitch",c),t.interactive&&t.touchPitch&&e.touchPitch.enable(t.touchPitch);const g=Dn(t),h=Yn(t);e.dragRotate=new hs(t,g,h),this._add("mouseRotate",g,["mousePitch"]),this._add("mousePitch",h,["mouseRotate"]),t.interactive&&t.dragRotate&&e.dragRotate.enable();const u=(({enable:t,clickTolerance:e})=>{const i=new Hn({checkCorrectEvent:t=>0===o.mouseButton(t)&&!t.ctrlKey});return new Fn({clickTolerance:e,move:(t,e)=>({around:e,panDelta:e.sub(t)}),activateOnStart:!0,moveStateManager:i,enable:t,assignEvents:En})})(t),d=new Nn(t,e);e.dragPan=new gs(i,u,d),this._add("mousePan",u),this._add("touchPan",d,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&e.dragPan.enable(t.dragPan);const p=new $n,m=new Qn;e.touchZoomRotate=new us(i,m,p,l),this._add("touchRotate",p,["touchPan","touchZoom"]),this._add("touchZoom",m,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&e.touchZoomRotate.enable(t.touchZoomRotate);const I=e.scrollZoom=new os(e,(()=>this._triggerRenderFrame()));this._add("scrollZoom",I,["mousePan"]),t.interactive&&t.scrollZoom&&e.scrollZoom.enable(t.scrollZoom);const C=e.keyboard=new ns(e);this._add("keyboard",C),t.interactive&&t.keyboard&&e.keyboard.enable(),this._add("blockableMapEvent",new Tn(e))}_add(t,e,i){this._handlers.push({handlerName:t,handler:e,allowed:i}),this._handlersById[t]=e}stop(t){if(!this._updatingCamera){for(const{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(ps(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,e,i){for(const n in t)if(n!==i&&(!e||e.indexOf(n)<0))return!0;return!1}_getMapTouches(t){const e=[];for(const i of t)this._el.contains(i.target)&&e.push(i);return e}mergeHandlerResult(t,i,n,s,r){if(!n)return;e.e(t,n);const o={handlerName:s,originalEvent:n.originalEvent||r};void 0!==n.zoomDelta&&(i.zoom=o),void 0!==n.panDelta&&(i.drag=o),void 0!==n.pitchDelta&&(i.pitch=o),void 0!==n.bearingDelta&&(i.rotate=o)}_applyChanges(){const t={},i={},n={};for(const[s,r,o]of this._changes)s.panDelta&&(t.panDelta=(t.panDelta||new e.P(0,0))._add(s.panDelta)),s.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+s.zoomDelta),s.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+s.bearingDelta),s.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+s.pitchDelta),void 0!==s.around&&(t.around=s.around),void 0!==s.pinchAround&&(t.pinchAround=s.pinchAround),s.noInertia&&(t.noInertia=s.noInertia),e.e(i,r),e.e(n,o);this._updateMapTransform(t,i,n),this._changes=[]}_updateMapTransform(t,e,i){const n=this._map,s=n._getTransformForUpdate(),r=n.terrain;if(!(Is(t)||r&&this._terrainMovement))return this._fireEvents(e,i,!0);let{panDelta:o,zoomDelta:a,bearingDelta:l,pitchDelta:c,around:g,pinchAround:h}=t;void 0!==h&&(g=h),n._stop(!0),g=g||n.transform.centerPoint;const u=s.pointLocation(o?g.sub(o):g);l&&(s.bearing+=l),c&&(s.pitch+=c),a&&(s.zoom+=a),r?this._terrainMovement||!e.drag&&!e.zoom?e.drag&&this._terrainMovement?s.center=s.pointLocation(s.centerPoint.sub(o)):s.setLocationAtPoint(u,g):(this._terrainMovement=!0,this._map._elevationFreeze=!0,s.setLocationAtPoint(u,g)):s.setLocationAtPoint(u,g),n._applyUpdatedTransform(s),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,i,!0)}_fireEvents(t,i,n){const s=ps(this._eventsInProgress),o=ps(t),a={};for(const e in t){const{originalEvent:i}=t[e];this._eventsInProgress[e]||(a[`${e}start`]=i),this._eventsInProgress[e]=t[e]}!s&&o&&this._fireEvent("movestart",o.originalEvent);for(const t in a)this._fireEvent(t,a[t]);o&&this._fireEvent("move",o.originalEvent);for(const e in t){const{originalEvent:i}=t[e];this._fireEvent(e,i)}const l={};let c;for(const t in this._eventsInProgress){const{handlerName:e,originalEvent:n}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],c=i[e]||n,l[`${t}end`]=c)}for(const t in l)this._fireEvent(t,l[t]);const g=ps(this._eventsInProgress),h=(s||o)&&!g;if(h&&this._terrainMovement&&(this._map._elevationFreeze=!1,this._terrainMovement=!1,this._map.transform.recalculateZoom(this._map.terrain)),n&&h){this._updatingCamera=!0;const t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=t=>0!==t&&-this._bearingSnap{delete this._frameId,this.handleEvent(new ms("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class fs extends e.E{constructor(t,e){super(),this._renderFrameCallback=()=>{const t=Math.min((r.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=e.bearingSnap,this.on("moveend",(()=>{delete this._requestedCameraState}))}getCenter(){return new e.N(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}panBy(t,i,n){return t=e.P.convert(t).mult(-1),this.panTo(this.transform.center,e.e({offset:t},i),n)}panTo(t,i,n){return this.easeTo(e.e({center:t},i),n)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(t,i,n){return this.easeTo(e.e({zoom:t},i),n)}zoomIn(t,e){return this.zoomTo(this.getZoom()+1,t,e),this}zoomOut(t,e){return this.zoomTo(this.getZoom()-1,t,e),this}getBearing(){return this.transform.bearing}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(t,i,n){return this.easeTo(e.e({bearing:t},i),n)}resetNorth(t,i){return this.rotateTo(0,e.e({duration:1e3},t),i),this}resetNorthPitch(t,i){return this.easeTo(e.e({bearing:0,pitch:0,duration:1e3},t),i),this}snapToNorth(t,e){return Math.abs(this.getBearing()){if(this._zooming&&(s.zoom=e.z.number(o,C,n)),this._rotating&&(s.bearing=e.z.number(a,g,n)),this._pitching&&(s.pitch=e.z.number(l,h,n)),this._padding&&(s.interpolatePadding(c,u,n),p=s.centerPoint.add(d)),this.terrain&&!t.freezeElevation&&this._updateElevation(n),b)s.setLocationAtPoint(b,_);else{const t=s.zoomScale(s.zoom-o),e=C>o?Math.min(2,y):Math.max(.5,y),i=Math.pow(e,1-n),r=s.unproject(f.add(A.mult(n*i)).mult(t));s.setLocationAtPoint(s.renderWorldCopies?r.wrap():r,p)}this._applyUpdatedTransform(s),this._fireMoveEvents(i)}),(e=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(i,e)}),t),this}_prepareEase(t,i,n={}){this._moving=!0,i||n.moving||this.fire(new e.k("movestart",t)),this._zooming&&!n.zooming&&this.fire(new e.k("zoomstart",t)),this._rotating&&!n.rotating&&this.fire(new e.k("rotatestart",t)),this._pitching&&!n.pitching&&this.fire(new e.k("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&i!==this._elevationTarget){const e=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(e-(i-(e*t+this._elevationStart))/(1-t)),this._elevationTarget=i}this.transform.elevation=e.z.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(t){if(!this.transformCameraUpdate)return;const e=t.clone(),{center:i,zoom:n,pitch:s,bearing:r,elevation:o}=this.transformCameraUpdate(e);i&&(e.center=i),void 0!==n&&(e.zoom=n),void 0!==s&&(e.pitch=s),void 0!==r&&(e.bearing=r),void 0!==o&&(e.elevation=o),this.transform.apply(e)}_fireMoveEvents(t){this.fire(new e.k("move",t)),this._zooming&&this.fire(new e.k("zoom",t)),this._rotating&&this.fire(new e.k("rotate",t)),this._pitching&&this.fire(new e.k("pitch",t))}_afterEase(t,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const n=this._zooming,s=this._rotating,r=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,n&&this.fire(new e.k("zoomend",t)),s&&this.fire(new e.k("rotateend",t)),r&&this.fire(new e.k("pitchend",t)),this.fire(new e.k("moveend",t))}flyTo(t,i){var n;if(!t.essential&&r.prefersReducedMotion){const n=e.M(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(n,i)}this.stop(),t=e.e({offset:[0,0],speed:1.2,curve:1.42,easing:e.b9},t);const s=this._getTransformForUpdate(),o=this.getZoom(),a=this.getBearing(),l=this.getPitch(),c=this.getPadding(),g="bearing"in t?this._normalizeBearing(t.bearing,a):a,h="pitch"in t?+t.pitch:l,u="padding"in t?t.padding:s.padding,d=e.P.convert(t.offset);let p=s.centerPoint.add(d);const m=s.pointLocation(p),{center:I,zoom:C}=s.getConstrained(e.N.convert(t.center||m),null!==(n=t.zoom)&&void 0!==n?n:o);this._normalizeCenter(I);const f=s.zoomScale(C-o),A=s.project(m),y=s.project(I).sub(A);let b=t.curve;const _=Math.max(s.width,s.height),v=_/f,x=y.mag();if("minZoom"in t){const i=e.ad(Math.min(t.minZoom,o,C),s.minZoom,s.maxZoom),n=_/s.zoomScale(i-o);b=Math.sqrt(n/x*2)}const w=b*b;function S(t){const e=(v*v-_*_+(t?-1:1)*w*w*x*x)/(2*(t?v:_)*w*x);return Math.log(Math.sqrt(e*e+1)-e)}function k(t){return(Math.exp(t)-Math.exp(-t))/2}function Z(t){return(Math.exp(t)+Math.exp(-t))/2}const B=S(!1);let G=function(t){return Z(B)/Z(B+b*t)},R=function(t){return _*((Z(B)*(k(e=B+b*t)/Z(e))-k(B))/w)/x;var e},V=(S(!0)-B)/b;if(Math.abs(x)<1e-6||!isFinite(V)){if(Math.abs(_-v)<1e-6)return this.easeTo(t,i);const e=v<_?-1:1;V=Math.abs(Math.log(v/_))/b,R=()=>0,G=t=>Math.exp(e*b*t)}return t.duration="duration"in t?+t.duration:1e3*V/("screenSpeed"in t?+t.screenSpeed/b:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=a!==g,this._pitching=h!==l,this._padding=!s.isPaddingEqual(u),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(I),this._ease((n=>{const r=n*V,m=1/G(r);s.zoom=1===n?C:o+s.scaleZoom(m),this._rotating&&(s.bearing=e.z.number(a,g,n)),this._pitching&&(s.pitch=e.z.number(l,h,n)),this._padding&&(s.interpolatePadding(c,u,n),p=s.centerPoint.add(d)),this.terrain&&!t.freezeElevation&&this._updateElevation(n);const f=1===n?I:s.unproject(A.add(y.mult(R(r))).mult(m));s.setLocationAtPoint(s.renderWorldCopies?f.wrap():f,p),this._applyUpdatedTransform(s),this._fireMoveEvents(i)}),(()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(i)}),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,e){var i;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,e)}return t||null===(i=this.handlers)||void 0===i||i.stop(!1),this}_ease(t,e,i){!1===i.animate||0===i.duration?(t(1),e()):(this._easeStart=r.now(),this._easeOptions=i,this._onEaseFrame=t,this._onEaseEnd=e,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,i){t=e.b3(t,-180,180);const n=Math.abs(t-i);return Math.abs(t-360-i)180?-360:i<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(e.N.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}const As={compact:!0,customAttribution:'MapLibre'};class ys{constructor(t=As){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=t=>{!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType&&"terrain"!==t.type||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=o.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=o.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=o.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){o.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,e){const i=this._map._getUIString(`AttributionControl.${e}`);t.title=i,t.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((t=>"string"!=typeof t?"":t))):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}const e=this._map.style.sourceCaches;for(const i in e){const n=e[i];if(n.used||n.usedForTerrain){const e=n.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution)}}t=t.filter((t=>String(t).trim())),t.sort(((t,e)=>t.length-e.length)),t=t.filter(((e,i)=>{for(let n=i+1;n=0)return!1;return!0}));const i=t.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,t.length?(this._innerContainer.innerHTML=i,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class bs{constructor(t={}){this._updateCompact=()=>{const t=this._container.children;if(t.length){const e=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&e.classList.add("maplibregl-compact"):e.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=o.create("div","maplibregl-ctrl");const e=o.create("a","maplibregl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){o.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class _s{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){const e=this._currentlyRunning,i=e?this._queue.concat(e):this._queue;for(const e of i)if(e.id===t)return void(e.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const e=this._currentlyRunning=this._queue;this._queue=[];for(const i of e)if(!i.cancelled&&(i.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var vs=e.Y([{name:"a_pos3d",type:"Int16",components:3}]);class xs extends e.E{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,i){this.sourceCache.update(t,i),this._renderableTilesKeys=[];const n={};for(const s of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i}))n[s.key]=!0,this._renderableTilesKeys.push(s.key),this._tiles[s.key]||(s.posMatrix=new Float64Array(16),e.aQ(s.posMatrix,0,e.X,0,e.X,0,1),this._tiles[s.key]=new lt(s,this.tileSize));for(const t in this._tiles)n[t]||delete this._tiles[t]}freeRtt(t){for(const e in this._tiles){const i=this._tiles[e];(!t||i.tileID.equals(t)||i.tileID.isChildOf(t)||t.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const i={};for(const n of this._renderableTilesKeys){const s=this._tiles[n].tileID;if(s.canonical.equals(t.canonical)){const s=t.clone();s.posMatrix=new Float64Array(16),e.aQ(s.posMatrix,0,e.X,0,e.X,0,1),i[n]=s}else if(s.canonical.isChildOf(t.canonical)){const r=t.clone();r.posMatrix=new Float64Array(16);const o=s.canonical.z-t.canonical.z,a=s.canonical.x-(s.canonical.x>>o<>o<>o;e.aQ(r.posMatrix,0,c,0,c,0,1),e.J(r.posMatrix,r.posMatrix,[-a*c,-l*c,0]),i[n]=r}else if(t.canonical.isChildOf(s.canonical)){const r=t.clone();r.posMatrix=new Float64Array(16);const o=t.canonical.z-s.canonical.z,a=t.canonical.x-(t.canonical.x>>o<>o<>o;e.aQ(r.posMatrix,0,e.X,0,e.X,0,1),e.J(r.posMatrix,r.posMatrix,[a*c,l*c,0]),e.K(r.posMatrix,r.posMatrix,[1/2**o,1/2**o,0]),i[n]=r}}return i}getSourceTile(t,e){const i=this.sourceCache._source;let n=t.overscaledZ-this.deltaZoom;if(n>i.maxzoom&&(n=i.maxzoom),n=i.minzoom&&(!s||!s.dem);)s=this.sourceCache.getTileByID(t.scaledTo(n--).key);return s}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter((e=>e.timeAdded>=t))}}class ws{constructor(t,e,i){this.painter=t,this.sourceCache=new xs(e),this.options=i,this.exaggeration="number"==typeof i.exaggeration?i.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,i,n,s=e.X){var r;if(!(i>=0&&i=0&&nt.canonical.z&&(t.canonical.z>=n?s=t.canonical.z-n:e.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const r=t.canonical.x-(t.canonical.x>>s<>s<>8<<4|t>>8,i[e+3]=0;const n=new e.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),s=new b(t,n,t.gl.RGBA,{premultiply:!1});return s.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=s,s}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),n=this.painter.context,s=n.gl,r=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),o=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),a=Math.round(this.painter.height/devicePixelRatio);n.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),s.readPixels(r,a-o-1,1,1,s.RGBA,s.UNSIGNED_BYTE,i),n.bindFramebuffer.set(null);const l=i[0]+(i[2]>>4<<8),c=i[1]+((15&i[2])<<8),g=this.coordsIndex[255-i[3]],h=g&&this.sourceCache.getTileByID(g);if(!h)return null;const u=this._coordsTextureSize,d=(1<t.id!==e)),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length!t.inUse))}}const ks={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Zs{constructor(t,e){this.painter=t,this.terrain=e,this.pool=new Ss(t.context,30,e.sourceCache.tileSize*e.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,e){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter((i=>!t._layers[i].isHidden(e))),this._coordsDescendingInv={};for(const e in t.sourceCaches){this._coordsDescendingInv[e]={};const i=t.sourceCaches[e].getVisibleCoordinates();for(const t of i){const i=this.terrain.sourceCache.getTerrainCoords(t);for(const t in i)this._coordsDescendingInv[e][t]||(this._coordsDescendingInv[e][t]=[]),this._coordsDescendingInv[e][t].push(i[t])}}this._coordsDescendingInvStr={};for(const e of t._order){const i=t._layers[e],n=i.source;if(ks[i.type]&&!this._coordsDescendingInvStr[n]){this._coordsDescendingInvStr[n]={};for(const t in this._coordsDescendingInv[n])this._coordsDescendingInvStr[n][t]=this._coordsDescendingInv[n][t].map((t=>t.key)).sort().join()}}for(const t of this._renderableTiles)for(const e in this._coordsDescendingInvStr){const i=this._coordsDescendingInvStr[e][t.tileID.key];i&&i!==t.rttCoords[e]&&(t.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const i=t.type,n=this.painter,s=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(ks[i]&&(this._prevType&&ks[this._prevType]||this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(t.id),!s))return!0;if(ks[this._prevType]||ks[i]&&s){this._prevType=i;const t=this._stacks.length-1,s=this._stacks[t]||[];for(const i of this._renderableTiles){if(this.pool.isFull()&&(hn(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(i),i.rtt[t]){const e=this.pool.getObjectForId(i.rtt[t].id);if(e.stamp===i.rtt[t].stamp){this.pool.useObject(e);continue}}const r=this.pool.getOrCreateFreeObject();this.pool.useObject(r),this.pool.stampObject(r),i.rtt[t]={id:r.id,stamp:r.stamp},n.context.bindFramebuffer.set(r.fbo.framebuffer),n.context.clear({color:e.aN.transparent,stencil:0}),n.currentStencilSource=void 0;for(let t=0;t{t.touchstart=t.dragStart,t.touchmoveWindow=t.dragMove,t.touchend=t.dragEnd},Ts={showCompass:!0,showZoom:!0,visualizePitch:!1};class Ws{constructor(t,i,n=!1){this.mousedown=t=>{this.startMouse(e.e({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),o.mousePos(this.element,t)),o.addEventListener(window,"mousemove",this.mousemove),o.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=t=>{this.moveMouse(t,o.mousePos(this.element,t))},this.mouseup=t=>{this.mouseRotate.dragEnd(t),this.mousePitch&&this.mousePitch.dragEnd(t),this.offTemp()},this.touchstart=t=>{1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=o.touchPos(this.element,t.targetTouches)[0],this.startTouch(t,this._startPos),o.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),o.addEventListener(window,"touchend",this.touchend))},this.touchmove=t=>{1!==t.targetTouches.length?this.reset():(this._lastPos=o.touchPos(this.element,t.targetTouches)[0],this.moveTouch(t,this._lastPos))},this.touchend=t=>{0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const s=t.dragRotate._mouseRotate.getClickTolerance(),r=t.dragRotate._mousePitch.getClickTolerance();this.element=i,this.mouseRotate=Dn({clickTolerance:s,enable:!0}),this.touchRotate=(({enable:t,clickTolerance:e,bearingDegreesPerPixelMoved:i=.8})=>{const n=new Ln;return new Fn({clickTolerance:e,move:(t,e)=>({bearingDelta:(e.x-t.x)*i}),moveStateManager:n,enable:t,assignEvents:Vs})})({clickTolerance:s,enable:!0}),this.map=t,n&&(this.mousePitch=Yn({clickTolerance:r,enable:!0}),this.touchPitch=(({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:i=-.5})=>{const n=new Ln;return new Fn({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*i}),moveStateManager:n,enable:t,assignEvents:Vs})})({clickTolerance:r,enable:!0})),o.addEventListener(i,"mousedown",this.mousedown),o.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),o.addEventListener(i,"touchcancel",this.reset)}startMouse(t,e){this.mouseRotate.dragStart(t,e),this.mousePitch&&this.mousePitch.dragStart(t,e),o.disableDrag()}startTouch(t,e){this.touchRotate.dragStart(t,e),this.touchPitch&&this.touchPitch.dragStart(t,e),o.disableDrag()}moveMouse(t,e){const i=this.map,{bearingDelta:n}=this.mouseRotate.dragMove(t,e)||{};if(n&&i.setBearing(i.getBearing()+n),this.mousePitch){const{pitchDelta:n}=this.mousePitch.dragMove(t,e)||{};n&&i.setPitch(i.getPitch()+n)}}moveTouch(t,e){const i=this.map,{bearingDelta:n}=this.touchRotate.dragMove(t,e)||{};if(n&&i.setBearing(i.getBearing()+n),this.touchPitch){const{pitchDelta:n}=this.touchPitch.dragMove(t,e)||{};n&&i.setPitch(i.getPitch()+n)}}off(){const t=this.element;o.removeEventListener(t,"mousedown",this.mousedown),o.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),o.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),o.removeEventListener(window,"touchend",this.touchend),o.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){o.enableDrag(),o.removeEventListener(window,"mousemove",this.mousemove),o.removeEventListener(window,"mouseup",this.mouseup),o.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),o.removeEventListener(window,"touchend",this.touchend)}}let Js;function zs(t,i,n){const s=new e.N(t.lng,t.lat);if(t=new e.N(t.lng,t.lat),i){const s=new e.N(t.lng-360,t.lat),r=new e.N(t.lng+360,t.lat),o=n.locationPoint(t).distSqr(i);n.locationPoint(s).distSqr(i)180;){const e=n.locationPoint(t);if(e.x>=0&&e.y>=0&&e.x<=n.width&&e.y<=n.height)break;t.lng>n.center.lng?t.lng-=360:t.lng+=360}return t.lng!==s.lng&&n.locationPoint(t).y>n.height/2-n.getHorizon()?t:s}const Ps={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Ms(t,e,i){const n=t.classList;for(const t in Ps)n.remove(`maplibregl-${i}-anchor-${t}`);n.add(`maplibregl-${i}-anchor-${e}`)}class Xs extends e.E{constructor(t){if(super(),this._onKeyPress=t=>{const e=t.code,i=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==i&&13!==i||this.togglePopup()},this._onMapClick=t=>{const e=t.originalEvent.target,i=this._element;this._popup&&(e===i||i.contains(e))&&this.togglePopup()},this._update=t=>{var e;if(!this._map)return;const i=this._map.loaded()&&!this._map.isMoving();("terrain"===(null==t?void 0:t.type)||"render"===(null==t?void 0:t.type)&&!i)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?zs(this._lngLat,this._flatPos,this._map.transform):null===(e=this._lngLat)||void 0===e?void 0:e.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let n="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?n=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(n=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let s="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?s="rotateX(0deg)":"map"===this._pitchAlignment&&(s=`rotateX(${this._map.getPitch()}deg)`),t&&"moveend"!==t.type||(this._pos=this._pos.round()),o.setTransform(this._element,`${Ps[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${s} ${n}`),r.frameAsync(new AbortController).then((()=>{this._updateOpacity(t&&"moveend"===t.type)})).catch((()=>{}))},this._onMove=t=>{if(!this._isDragging){const e=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=e}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new e.k("dragstart"))),this.fire(new e.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new e.k("dragend")),this._state="inactive"},this._addDragHandler=t=>{this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&"auto"!==t.pitchAlignment?t.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(null==t?void 0:t.opacity,null==t?void 0:t.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=e.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=o.create("div");const i=o.createNS("http://www.w3.org/2000/svg","svg"),n=41,s=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${n}px`),i.setAttributeNS(null,"width",`${s}px`),i.setAttributeNS(null,"viewBox",`0 0 ${s} ${n}`);const r=o.createNS("http://www.w3.org/2000/svg","g");r.setAttributeNS(null,"stroke","none"),r.setAttributeNS(null,"stroke-width","1"),r.setAttributeNS(null,"fill","none"),r.setAttributeNS(null,"fill-rule","evenodd");const a=o.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"fill-rule","nonzero");const l=o.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");const c=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const t of c){const e=o.createNS("http://www.w3.org/2000/svg","ellipse");e.setAttributeNS(null,"opacity","0.04"),e.setAttributeNS(null,"cx","10.5"),e.setAttributeNS(null,"cy","5.80029008"),e.setAttributeNS(null,"rx",t.rx),e.setAttributeNS(null,"ry",t.ry),l.appendChild(e)}const g=o.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"fill",this._color);const h=o.createNS("http://www.w3.org/2000/svg","path");h.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),g.appendChild(h);const u=o.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"opacity","0.25"),u.setAttributeNS(null,"fill","#000000");const d=o.createNS("http://www.w3.org/2000/svg","path");d.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),u.appendChild(d);const p=o.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"transform","translate(6.0, 7.0)"),p.setAttributeNS(null,"fill","#FFFFFF");const m=o.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(8.0, 8.0)");const I=o.createNS("http://www.w3.org/2000/svg","circle");I.setAttributeNS(null,"fill","#000000"),I.setAttributeNS(null,"opacity","0.25"),I.setAttributeNS(null,"cx","5.5"),I.setAttributeNS(null,"cy","5.5"),I.setAttributeNS(null,"r","5.4999962");const C=o.createNS("http://www.w3.org/2000/svg","circle");C.setAttributeNS(null,"fill","#FFFFFF"),C.setAttributeNS(null,"cx","5.5"),C.setAttributeNS(null,"cy","5.5"),C.setAttributeNS(null,"r","5.4999962"),m.appendChild(I),m.appendChild(C),a.appendChild(l),a.appendChild(g),a.appendChild(u),a.appendChild(p),a.appendChild(m),i.appendChild(a),i.setAttributeNS(null,"height",n*this._scale+"px"),i.setAttributeNS(null,"width",s*this._scale+"px"),this._element.appendChild(i),this._offset=e.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(t=>{t.preventDefault()})),this._element.addEventListener("mousedown",(t=>{t.preventDefault()})),Ms(this._element,this._anchor,"marker"),t&&t.className)for(const e of t.className.split(" "))this._element.classList.add(e);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),o.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.N.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const e=38.1,i=13.5,n=Math.abs(i)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-e],"bottom-left":[n,-1*(e-i+n)],"bottom-right":[-n,-1*(e-i+n)],left:[i,-1*(e-i)],right:[-i,-1*(e-i)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var i,n;if(!(null===(i=this._map)||void 0===i?void 0:i.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}const s=this._map,r=s.terrain.depthAtPoint(this._pos),o=s.terrain.getElevationForLngLatZoom(this._lngLat,s.transform.tileZoom);if(s.transform.lngLatToCameraDepth(this._lngLat,o)-r<.006)return void(this._element.style.opacity=this._opacity);const a=-this._offset.y/s.transform._pixelPerMeter,l=Math.sin(s.getPitch()*Math.PI/180)*a,c=s.terrain.depthAtPoint(new e.P(this._pos.x,this._pos.y-this._offset.y)),g=s.transform.lngLatToCameraDepth(this._lngLat,o+l)-c>.006;(null===(n=this._popup)||void 0===n?void 0:n.isOpen())&&g&&this._popup.remove(),this._element.style.opacity=g?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=e.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,e){return void 0===t&&void 0===e&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==t&&(this._opacity=t),void 0!==e&&(this._opacityWhenCovered=e),this._map&&this._updateOpacity(!0),this}}const Fs={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Ks=0,Hs=!1;const Ls={maxWidth:100,unit:"metric"};function Es(t,e,i){const n=i&&i.maxWidth||100,s=t._container.clientHeight/2,r=t.unproject([0,s]),o=t.unproject([n,s]),a=r.distanceTo(o);if(i&&"imperial"===i.unit){const i=3.2808*a;i>5280?Ds(e,n,i/5280,t._getUIString("ScaleControl.Miles")):Ds(e,n,i,t._getUIString("ScaleControl.Feet"))}else i&&"nautical"===i.unit?Ds(e,n,a/1852,t._getUIString("ScaleControl.NauticalMiles")):a>=1e3?Ds(e,n,a/1e3,t._getUIString("ScaleControl.Kilometers")):Ds(e,n,a,t._getUIString("ScaleControl.Meters"))}function Ds(t,e,i,n){const s=function(t){const e=Math.pow(10,`${Math.floor(t)}`.length-1);let i=t/e;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(t){const e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(i),e*i}(i);t.style.width=e*(s/i)+"px",t.innerHTML=`${s} ${n}`}const Ys={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Ns=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Os(t){if(t){if("number"==typeof t){const i=Math.round(Math.abs(t)/Math.SQRT2);return{center:new e.P(0,0),top:new e.P(0,t),"top-left":new e.P(i,i),"top-right":new e.P(-i,i),bottom:new e.P(0,-t),"bottom-left":new e.P(i,-i),"bottom-right":new e.P(-i,-i),left:new e.P(t,0),right:new e.P(-t,0)}}if(t instanceof e.P||Array.isArray(t)){const i=e.P.convert(t);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:e.P.convert(t.center||[0,0]),top:e.P.convert(t.top||[0,0]),"top-left":e.P.convert(t["top-left"]||[0,0]),"top-right":e.P.convert(t["top-right"]||[0,0]),bottom:e.P.convert(t.bottom||[0,0]),"bottom-left":e.P.convert(t["bottom-left"]||[0,0]),"bottom-right":e.P.convert(t["bottom-right"]||[0,0]),left:e.P.convert(t.left||[0,0]),right:e.P.convert(t.right||[0,0])}}return Os(new e.P(0,0))}const Us=i;t.AJAXError=e.bg,t.Evented=e.E,t.LngLat=e.N,t.MercatorCoordinate=e.Z,t.Point=e.P,t.addProtocol=e.bh,t.config=e.a,t.removeProtocol=e.bi,t.AttributionControl=ys,t.BoxZoomHandler=Jn,t.CanvasSource=et,t.CooperativeGesturesHandler=ds,t.DoubleClickZoomHandler=as,t.DragPanHandler=gs,t.DragRotateHandler=hs,t.EdgeInsets=In,t.FullscreenControl=class extends e.E{constructor(t={}){super(),this._onFullscreenChange=()=>{var t;let e=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;null===(t=null==e?void 0:e.shadowRoot)||void 0===t?void 0:t.fullscreenElement;)e=e.shadowRoot.fullscreenElement;e===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,t&&t.container&&(t.container instanceof HTMLElement?this._container=t.container:e.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){o.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const t=this._fullscreenButton=o.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);o.create("span","maplibregl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new e.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new e.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},t.GeoJSONSource=Q,t.GeolocateControl=class extends e.E{constructor(t){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.k("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new e.k("geolocate",t)),this._finish()}},this._updateCamera=t=>{const i=new e.N(t.coords.longitude,t.coords.latitude),n=t.coords.accuracy,s=this._map.getBearing(),r=e.e({bearing:s},this.options.fitBoundsOptions),o=Y.fromLngLat(i,n);this._map.fitBounds(o,r,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const i=new e.N(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=t=>{if(this._map){if(this.options.trackUserLocation)if(1===t.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&Hs)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new e.k("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=t=>{if(this._map){if(this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this._geolocateButton=o.create("button","maplibregl-ctrl-geolocate",this._container),o.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===t){e.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=o.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Xs({element:this._dotElement}),this._circleElement=o.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Xs({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",(()=>this.trigger())),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(t=>{t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||t.originalEvent&&"resize"===t.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new e.k("trackuserlocationend")),this.fire(new e.k("userlocationlostfocus")))}))}},this.options=e.e({},Fs,t)}onAdd(t){return this._map=t,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(){return e._(this,arguments,void 0,(function*(t=!1){if(void 0!==Js&&!t)return Js;if(void 0===window.navigator.permissions)return Js=!!window.navigator.geolocation,Js;try{const t=yield window.navigator.permissions.query({name:"geolocation"});Js="denied"!==t.state}catch(t){Js=!!window.navigator.geolocation}return Js}))}().then((t=>this._setupUI(t))),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),o.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Ks=0,Hs=!1}_isOutOfMapMaxBounds(t){const e=this._map.getMaxBounds(),i=t.coords;return e&&(i.longitudee.getEast()||i.latitudee.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const t=this._map.getBounds(),e=t.getSouthEast(),i=t.getNorthEast(),n=e.distanceTo(i),s=Math.ceil(this._accuracy/(n/this._map._container.clientHeight)*2);this._circleElement.style.width=`${s}px`,this._circleElement.style.height=`${s}px`}trigger(){if(!this._setup)return e.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new e.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Ks--,Hs=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new e.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new e.k("trackuserlocationstart")),this.fire(new e.k("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let t;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Ks++,Ks>1?(t={maximumAge:6e5,timeout:0},Hs=!0):(t=this.options.positionOptions,Hs=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},t.Hash=yn,t.ImageSource=$,t.KeyboardHandler=ns,t.LngLatBounds=Y,t.LogoControl=bs,t.Map=class extends fs{constructor(t){e.be.mark(e.bf.create);const i=Object.assign(Object.assign({},Rs),t);if(null!=i.minZoom&&null!=i.maxZoom&&i.minZoom>i.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=i.minPitch&&null!=i.maxPitch&&i.minPitch>i.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=i.minPitch&&i.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=i.maxPitch&&i.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new fn(i.minZoom,i.maxZoom,i.minPitch,i.maxPitch,i.renderWorldCopies),{bearingSnap:i.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new _s,this._controls=[],this._mapId=e.a4(),this._contextLost=t=>{t.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new e.k("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{this._setupPainter(),this.resize(),this._update(),this.fire(new e.k("webglcontextrestored",{originalEvent:t}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=i.interactive,this._maxTileCacheSize=i.maxTileCacheSize,this._maxTileCacheZoomLevels=i.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=!0===i.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=!0===i.preserveDrawingBuffer,this._antialias=!0===i.antialias,this._trackResize=!0===i.trackResize,this._bearingSnap=i.bearingSnap,this._refreshExpiredTiles=!0===i.refreshExpiredTiles,this._fadeDuration=i.fadeDuration,this._crossSourceCollisions=!0===i.crossSourceCollisions,this._collectResourceTiming=!0===i.collectResourceTiming,this._locale=Object.assign(Object.assign({},Bs),i.locale),this._clickTolerance=i.clickTolerance,this._overridePixelRatio=i.pixelRatio,this._maxCanvasSize=i.maxCanvasSize,this.transformCameraUpdate=i.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=!0===i.cancelPendingTileRequestsWhileZooming,this._imageQueueHandle=d.addThrottleControl((()=>this.isMoving())),this._requestManager=new p(i.transformRequest),"string"==typeof i.container){if(this._container=document.getElementById(i.container),!this._container)throw new Error(`Container '${i.container}' not found.`)}else{if(!(i.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=i.container}if(i.maxBounds&&this.setMaxBounds(i.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))).on("moveend",(()=>this._update(!1))).on("zoom",(()=>this._update(!0))).on("terrain",(()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)})).once("idle",(()=>{this._idleTriggered=!0})),"undefined"!=typeof window){addEventListener("online",this._onWindowOnline,!1);let t=!1;const e=An((t=>{this._trackResize&&!this._removed&&this.resize(t)._update()}),50);this._resizeObserver=new ResizeObserver((i=>{t?e(i):t=!0})),this._resizeObserver.observe(this._container)}this.handlers=new Cs(this,i),this._hash=i.hash&&new yn("string"==typeof i.hash&&i.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:i.center,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch}),i.bounds&&(this.resize(),this.fitBounds(i.bounds,e.e({},i.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=i.localIdeographFontFamily,this._validateStyle=i.validateStyle,i.style&&this.setStyle(i.style,{localIdeographFontFamily:i.localIdeographFontFamily}),i.attributionControl&&this.addControl(new ys("boolean"==typeof i.attributionControl?void 0:i.attributionControl)),i.maplibreLogo&&this.addControl(new bs,i.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)})),this.on("data",(t=>{this._update("style"===t.dataType),this.fire(new e.k(`${t.dataType}data`,t))})),this.on("dataloading",(t=>{this.fire(new e.k(`${t.dataType}dataloading`,t))})),this.on("dataabort",(t=>{this.fire(new e.k("sourcedataabort",t))}))}_getMapId(){return this._mapId}addControl(t,i){if(void 0===i&&(i=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t||!t.onAdd)return this.fire(new e.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=t.onAdd(this);this._controls.push(t);const s=this._controlPositions[i];return-1!==i.indexOf("bottom")?s.insertBefore(n,s.firstChild):s.appendChild(n),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new e.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(t);return i>-1&&this._controls.splice(i,1),t.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}calculateCameraOptionsFromTo(t,e,i,n){return null==n&&this.terrain&&(n=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(t,e,i,n)}resize(t){var i;const n=this._containerDimensions(),s=n[0],r=n[1],o=this._getClampedPixelRatio(s,r);if(this._resizeCanvas(s,r,o),this.painter.resize(s,r,o),this.painter.overLimit()){const t=this.painter.context.gl;this._maxCanvasSize=[t.drawingBufferWidth,t.drawingBufferHeight];const e=this._getClampedPixelRatio(s,r);this._resizeCanvas(s,r,e),this.painter.resize(s,r,e)}this.transform.resize(s,r),null===(i=this._requestedCameraState)||void 0===i||i.resize(s,r);const a=!this._moving;return a&&(this.stop(),this.fire(new e.k("movestart",t)).fire(new e.k("move",t))),this.fire(new e.k("resize",t)),a&&this.fire(new e.k("moveend",t)),this}_getClampedPixelRatio(t,e){const{0:i,1:n}=this._maxCanvasSize,s=this.getPixelRatio(),r=t*s,o=e*s;return Math.min(r>i?i/r:1,o>n?n/o:1)*s}getPixelRatio(){var t;return null!==(t=this._overridePixelRatio)&&void 0!==t?t:devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds(Y.convert(t)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.renderWorldCopies=t,this._update()}project(t){return this.transform.locationPoint(e.N.convert(t),this.style&&this.terrain)}unproject(t){return this.transform.pointLocation(e.P.convert(t),this.terrain)}isMoving(){var t;return this._moving||(null===(t=this.handlers)||void 0===t?void 0:t.isMoving())}isZooming(){var t;return this._zooming||(null===(t=this.handlers)||void 0===t?void 0:t.isZooming())}isRotating(){var t;return this._rotating||(null===(t=this.handlers)||void 0===t?void 0:t.isRotating())}_createDelegatedListener(t,e,i){if("mouseenter"===t||"mouseover"===t){let n=!1;const s=s=>{const r=this.getLayer(e)?this.queryRenderedFeatures(s.point,{layers:[e]}):[];r.length?n||(n=!0,i.call(this,new Bn(t,this,s.originalEvent,{features:r}))):n=!1};return{layer:e,listener:i,delegates:{mousemove:s,mouseout:()=>{n=!1}}}}if("mouseleave"===t||"mouseout"===t){let n=!1;const s=s=>{(this.getLayer(e)?this.queryRenderedFeatures(s.point,{layers:[e]}):[]).length?n=!0:n&&(n=!1,i.call(this,new Bn(t,this,s.originalEvent)))},r=e=>{n&&(n=!1,i.call(this,new Bn(t,this,e.originalEvent)))};return{layer:e,listener:i,delegates:{mousemove:s,mouseout:r}}}{const n=t=>{const n=this.getLayer(e)?this.queryRenderedFeatures(t.point,{layers:[e]}):[];n.length&&(t.features=n,i.call(this,t),delete t.features)};return{layer:e,listener:i,delegates:{[t]:n}}}}on(t,e,i){if(void 0===i)return super.on(t,e);const n=this._createDelegatedListener(t,e,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(n);for(const t in n.delegates)this.on(t,n.delegates[t]);return this}once(t,e,i){if(void 0===i)return super.once(t,e);const n=this._createDelegatedListener(t,e,i);for(const t in n.delegates)this.once(t,n.delegates[t]);return this}off(t,e,i){return void 0===i?super.off(t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&(n=>{const s=this._delegatedListeners[t];for(let t=0;tthis._updateStyle(t,e)));const i=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t?(this.style=new he(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t,e,i):this.style.loadJSON(t,e,i),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new he(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(t,i){if("string"==typeof t){const n=this._requestManager.transformRequest(t,"Style");e.h(n,new AbortController).then((t=>{this._updateDiff(t.data,i)})).catch((t=>{t&&this.fire(new e.j(t))}))}else"object"==typeof t&&this._updateDiff(t,i)}_updateDiff(t,i){try{this.style.setState(t,i)&&this._update(!0)}catch(n){e.w(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(t,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():e.w("There is no style added to the map.")}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(t){const i=this.style&&this.style.sourceCaches[t];if(void 0!==i)return i.loaded();this.fire(new e.j(new Error(`There is no source with ID '${t}'`)))}setTerrain(t){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),t){const i=this.style.sourceCaches[t.source];if(!i)throw new Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);null===this.terrain&&i.reload();for(const i in this.style._layers){const n=this.style._layers[i];"hillshade"===n.type&&n.source===t.source&&e.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new ws(this.painter,i,t),this.painter.renderToTexture=new Zs(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=e=>{"style"===e.dataType?this.terrain.sourceCache.freeRtt():"source"===e.dataType&&e.tile&&(e.sourceId!==t.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(e.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new e.k("terrain",{terrain:t})),this}getTerrain(){var t,e;return null!==(e=null===(t=this.terrain)||void 0===t?void 0:t.options)&&void 0!==e?e:null}areTilesLoaded(){const t=this.style&&this.style.sourceCaches;for(const e in t){const i=t[e]._tiles;for(const t in i){const e=i[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}}return!0}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}addImage(t,i,n={}){const{pixelRatio:s=1,sdf:o=!1,stretchX:a,stretchY:l,content:c,textFitWidth:g,textFitHeight:h}=n;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||e.b(i))){if(void 0===i.width||void 0===i.height)return this.fire(new e.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:n,height:r,data:u}=i,d=i;return this.style.addImage(t,{data:new e.R({width:n,height:r},new Uint8Array(u)),pixelRatio:s,stretchX:a,stretchY:l,content:c,textFitWidth:g,textFitHeight:h,sdf:o,version:0,userImage:d}),d.onAdd&&d.onAdd(this,t),this}}{const{width:n,height:u,data:d}=r.getImageData(i);this.style.addImage(t,{data:new e.R({width:n,height:u},d),pixelRatio:s,stretchX:a,stretchY:l,content:c,textFitWidth:g,textFitHeight:h,sdf:o,version:0})}}updateImage(t,i){const n=this.style.getImage(t);if(!n)return this.fire(new e.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=i instanceof HTMLImageElement||e.b(i)?r.getImageData(i):i,{width:o,height:a,data:l}=s;if(void 0===o||void 0===a)return this.fire(new e.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(o!==n.data.width||a!==n.data.height)return this.fire(new e.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const c=!(i instanceof HTMLImageElement||e.b(i));return n.data.replace(l,c),this.style.updateImage(t,n),this}getImage(t){return this.style.getImage(t)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new e.j(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(t){return d.getImage(this._requestManager.transformRequest(t,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(t,e,i){return this.style.setLayerZoomRange(t,e,i),this._update(!0)}setFilter(t,e,i={}){return this.style.setFilter(t,e,i),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,i,n={}){return this.style.setPaintProperty(t,e,i,n),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,i,n={}){return this.style.setLayoutProperty(t,e,i,n),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setGlyphs(t,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,e,i,(t=>{t||this._update(!0)})),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,e,(t=>{t||this._update(!0)})),this}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(t){return this._lazyInitEmptyStyle(),this.style.setSky(t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]}_setupContainer(){const t=this._container;t.classList.add("maplibregl-map");const e=this._canvasContainer=o.create("div","maplibregl-canvas-container",t);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=o.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const i=this._containerDimensions(),n=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],n);const s=this._controlContainer=o.create("div","maplibregl-control-container",t),r=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((t=>{r[t]=o.create("div",`maplibregl-ctrl-${t} `,s)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,e,i){this._canvas.width=Math.floor(i*t),this._canvas.height=Math.floor(i*e),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const t={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let e=null;this._canvas.addEventListener("webglcontextcreationerror",(i=>{e={requestedAttributes:t},i&&(e.statusMessage=i.statusMessage,e.type=i.type)}),{once:!0});const i=this._canvas.getContext("webgl2",t)||this._canvas.getContext("webgl",t);if(!i){const t="Failed to initialize WebGL";throw e?(e.message=t,new Error(JSON.stringify(e))):new Error(t)}this.painter=new dn(i,this.transform),a.testSupport(i)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(t){const i=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const t=this.transform.zoom,s=r.now();this.style.zoomHistory.update(t,s);const o=new e.a9(t,{now:s,fadeDuration:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),a=o.crossFadingFactor();1===a&&a===this._crossFadingFactor||(n=!0,this._crossFadingFactor=a),this.style.update(o)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,i,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:i,showPadding:this.showPadding}),this.fire(new e.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,e.be.mark(e.bf.load),this.fire(new e.k("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const s=this._sourcesDirty||this._styleDirty||this._placementDirty;return s||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new e.k("idle")),!this._loaded||this._fullyLoaded||s||(this._fullyLoaded=!0,e.be.mark(e.bf.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var t;this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"undefined"!=typeof window&&removeEventListener("online",this._onWindowOnline,!1),d.removeThrottleControl(this._imageQueueHandle),null===(t=this._resizeObserver)||void 0===t||t.disconnect();const i=this.painter.context.gl.getExtension("WEBGL_lose_context");(null==i?void 0:i.loseContext)&&i.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),o.remove(this._canvasContainer),o.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),e.be.clearMetrics(),this._removed=!0,this.fire(new e.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,r.frameAsync(this._frameRequest).then((t=>{e.be.frame(t),this._frameRequest=null,this._render(t)})).catch((()=>{})))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return Gs}getCameraTargetElevation(){return this.transform.elevation}},t.MapMouseEvent=Bn,t.MapTouchEvent=Gn,t.MapWheelEvent=Rn,t.Marker=Xs,t.NavigationControl=class{constructor(t){this._updateZoomButtons=()=>{const t=this._map.getZoom(),e=t===this._map.getMaxZoom(),i=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())},this._rotateCompassArrow=()=>{const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t},this._setButtonTitle=(t,e)=>{const i=this._map._getUIString(`NavigationControl.${e}`);t.title=i,t.setAttribute("aria-label",i)},this.options=e.e({},Ts,t),this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),o.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(t=>this._map.zoomOut({},{originalEvent:t}))),o.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})),this._compassIcon=o.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Ws(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){o.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(t,e){const i=o.create("button",t,this._container);return i.type="button",i.addEventListener("click",e),i}},t.Popup=class extends e.E{constructor(t){super(),this.remove=()=>(this._content&&o.remove(this._content),this._container&&(o.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new e.k("close"))),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{var e;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=o.create("div","maplibregl-popup",this._map.getContainer()),this._tip=o.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const t of this.options.className.split(" "))this._container.classList.add(t);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?zs(this._lngLat,this._flatPos,this._map.transform):null===(e=this._lngLat)||void 0===e?void 0:e.wrap(),this._trackPointer&&!t)return;const i=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationPoint(this._lngLat));let n=this.options.anchor;const s=Os(this.options.offset);if(!n){const t=this._container.offsetWidth,e=this._container.offsetHeight;let r;r=i.y+s.bottom.ythis._map.transform.height-e?["bottom"]:[],i.xthis._map.transform.width-t/2&&r.push("right"),n=0===r.length?"bottom":r.join("-")}let r=i.add(s[n]);this.options.subpixelPositioning||(r=r.round()),o.setTransform(this._container,`${Ps[n]} translate(${r.x}px,${r.y}px)`),Ms(this._container,n,"popup")},this._onClose=()=>{this.remove()},this.options=e.e(Object.create(Ys),t)}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new e.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.N.convert(t),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){const e=document.createDocumentFragment(),i=document.createElement("body");let n;for(i.innerHTML=t;n=i.firstChild,n;)e.appendChild(n);return this.setDOMContent(e)}getMaxWidth(){var t;return null===(t=this._container)||void 0===t?void 0:t.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=o.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){return this._container&&this._container.classList.add(t),this}removeClassName(t){return this._container&&this._container.classList.remove(t),this}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}setSubpixelPositioning(t){this.options.subpixelPositioning=t}_createCloseButton(){this.options.closeButton&&(this._closeButton=o.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const t=this._container.querySelector(Ns);t&&t.focus()}},t.RasterDEMTileSource=j,t.RasterTileSource=U,t.ScaleControl=class{constructor(t){this._onMove=()=>{Es(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,Es(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Ls),t)}getDefaultPosition(){return"bottom-left"}onAdd(t){return this._map=t,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){o.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},t.ScrollZoomHandler=os,t.Style=he,t.TerrainControl=class{constructor(t){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=t}onAdd(t){return this._map=t,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=o.create("button","maplibregl-ctrl-terrain",this._container),o.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){o.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},t.TwoFingersTouchPitchHandler=es,t.TwoFingersTouchRotateHandler=$n,t.TwoFingersTouchZoomHandler=Qn,t.TwoFingersTouchZoomRotateHandler=us,t.VectorTileSource=O,t.VideoSource=tt,t.addSourceType=(t,i)=>e._(void 0,void 0,void 0,(function*(){if(nt(t))throw new Error(`A source type called "${t}" already exists.`);((t,e)=>{it[t]=e})(t,i)})),t.clearPrewarmedResources=function(){const t=P;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(W),P=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},t.getMaxParallelImageRequests=function(){return e.a.MAX_PARALLEL_IMAGE_REQUESTS},t.getRTLTextPluginStatus=function(){return at().getRTLTextPluginStatus()},t.getVersion=function(){return Us},t.getWorkerCount=function(){return J.workerCount},t.getWorkerUrl=function(){return e.a.WORKER_URL},t.importScriptInWorkers=function(t){return K().broadcast("IS",t)},t.prewarm=function(){X().acquire(W)},t.setMaxParallelImageRequests=function(t){e.a.MAX_PARALLEL_IMAGE_REQUESTS=t},t.setRTLTextPlugin=function(t,e){return at().setRTLTextPlugin(t,e)},t.setWorkerCount=function(t){J.workerCount=t},t.setWorkerUrl=function(t){e.a.WORKER_URL=t}}));var n=t;return n}();var S=w.exports,k=x(S);class Z{layer;buttonControl;buttonElement;nav;constructor(t,e){const i=t.id;this.layer=t,this.buttonControl=e,t.depth=t.depth??0,this.buttonControl.buttons[i]=this,this.buttonElement=document.createElement("button"),this.nav=document.createElement("nav"),this.nav.appendChild(this.buttonElement),this.buttonElement.setAttribute("id",i),this.buttonElement.setAttribute("class","maplibregl-ctrl maplibregl-ctrl-group");const n=void 0!==t.name?t.name:i.replace("-"," ");this.buttonElement.appendChild(document.createTextNode(n)),this.buttonElement.onclick=t=>this.toggle()}toggle(){this.buttonElement.classList.contains("active")?this.deselect():this.select()}select(){this.deselectDirectory(),this.buttonControl.deselectGroup(this.layer.group),this.buttonElement.classList.add("active")}deselect(){this.buttonElement.classList.remove("active"),this.deselectDirectory()}deselectDirectory(){this.buttonControl.deselectDirectories()}}class B extends Z{directoryNav;constructor(t,e){super(t,e);const i="buttonHolder"+(t.depth%2==0?"Even":"Odd");this.directoryNav=document.createElement("nav"),this.directoryNav.classList.add(i),this.nav.classList.add(i),this.nav.appendChild(this.directoryNav),(void 0===t.active||t.active)&&(this.directoryNav.style.display="none");t.source.forEach((e=>e.depth=t.depth+1)),this.buttonControl.addLayerButtons(t.source,this.directoryNav)}select(){super.select(),this.directoryNav.style.display="inherit"}deselect(){super.deselect(),this.directoryNav.style.display="none"}deselectDirectory(){this.buttonControl.deselectDirectories(this.layer.depth)}}class G extends Z{constructor(t,e){super(t,e)}select(){super.select();const t=this.layer.id;if(null!=this.layer.beforeId&&null==this.buttonControl.map.getLayer(this.layer.beforeId)&&(this.layer.beforeId=void 0),null==this.buttonControl.map.getSource(t)&&this.buttonControl.map.addSource(t,this.layer.source),this.buttonControl.map.addLayer({id:t,type:this.layer.type,source:t,layout:this.layer.layout??{},paint:this.layer.paint??{},...this.getOptions(this.layer.type)},this.layer.beforeId),"symbol"===this.layer.type){const e=this.buttonControl.map;this.buttonControl.map.on("click",t,(t=>{const i=t.features;if(null==i||null==i[0]?.properties?.description)return;const n=i[0].geometry,s=i[0].properties.description;"Point"==n.type&&new S.Popup({maxWidth:"none"}).setLngLat(n.coordinates).setHTML(s).addTo(e)}))}}deselect(){super.deselect();const t=this.layer.id;null!=this.buttonControl.map.getLayer(t)&&this.buttonControl.map.removeLayer(t)}getOptions(t){return"symbol"==t?{layout:{"icon-image":["coalesce",["get","icon-image"],"marker_11"],"icon-size":["coalesce",["get","icon-size"],1],"text-field":"{title}","icon-allow-overlap":!0,"text-allow-overlap":!0,"text-anchor":"top","text-font":["Open Sans Regular"],"text-max-width":9,"icon-offset":[0,-3],"text-offset":[0,.75],"text-padding":2,"text-size":12},paint:{"text-color":"#666","text-halo-blur":.5,"text-halo-color":"white","text-halo-width":2}}:"line"==t?{layout:{"line-join":"round"},paint:{"line-color":"#00d","line-width":{base:1.2,stops:[[6,2],[20,20]]},"line-opacity":.4}}:"heatmap"==t?{maxzoom:16,minzoom:9,paint:{"heatmap-weight":["*",["coalesce",["get","count"],1],1e-5],"heatmap-intensity":{stops:[[9,.1],[16,3e3]]},"heatmap-radius":{type:"exponential",stops:[[9,1],[16,20]]},"heatmap-color":["interpolate",["linear"],["heatmap-density"],0,"rgba(0,0,0,0)",.1,"#103",.3,"#926",.4,"#f71",.5,"#ffa"],"heatmap-opacity":.8}}:void("raster"!=t&&console.error("unknown type: ",t))}}class R extends G{constructor(t,e){super(t,e)}select(){super.select(),document.getElementById("rainLegend").style.display="inline-block"}deselect(){document.getElementById("rainLegend").style.display="none",super.deselect()}}class V extends Z{routeControl;constructor(t,e){super(t,e),this.routeControl=new b}select(){super.select(),this.buttonControl.map.addControl(this.routeControl)}deselect(){this.buttonControl.map.removeControl(this.routeControl),super.deselect()}}class T extends Z{constructor(t,e){super(t,e)}select(){super.select(),super.deselect(),this.buttonControl.deselectAll()}}class W extends Z{constructor(t,e){super(t,e)}select(){super.select(),super.deselect(),document.getElementById("about").style.display="inherit"}deselect(){super.deselect(),document.getElementById("about").style.display="none"}}class J extends Z{originalProperties={};constructor(t,e){super(t,e);const i=this.buttonControl.map;Object.entries(this.layer.layerIds).forEach((([t,e])=>{const n=i.getLayer(t);void 0!==n?(this.originalProperties[t]=[],e.forEach((e=>{const s=e.propertyType,r=e.property;if(e.value,"layout"===s)this.originalProperties[t].push({propertyType:s,property:r,value:i.getLayoutProperty(t,r)});else if("paint"===s)this.originalProperties[t].push({propertyType:s,property:r,value:i.getPaintProperty(t,r)});else if("zoom"===s){const e=n.minzoom,i=n.maxzoom;this.originalProperties[t].push({propertyType:s,property:r,value:{minzoom:e,maxzoom:i}})}}))):console.error(`layer ${t} is not found in the map`)}))}select(){super.select(),this.apply(this.layer.layerIds)}deselect(){this.apply(this.originalProperties),super.deselect()}apply(t){const e=this.buttonControl.map;Object.entries(t).forEach((([t,i])=>{i.forEach((i=>{const n=i.propertyType,s=i.property,r=i.value;"layout"===n?e.setLayoutProperty(t,s,r):"paint"===n?e.setPaintProperty(t,s,r):"zoom"===n&&e.setLayerZoomRange(t,r.minzoom,r.maxzoom)}))}))}}class z extends Z{constructor(t,e){super(t,e)}select(){super.select(),super.deselect();let t=this.layer.url;void 0!==t?window.open(z.formatUrl(this.buttonControl.map,t)):console.error("url not defined")}static formatUrl(t,e){return e.replace("{z1}",(t.getZoom()+1).toFixed(0)).replace("{z}",t.getZoom().toFixed(0)).replace("{latitude}",t.getCenter().lat.toFixed(5)).replace("{longitude}",t.getCenter().lng.toFixed(5))}}class P{mainControl;map;container;buttons={};savePointUrl;constructor(t){this.mainControl=t}onAdd(t){return this.map=t,this.map.on("click",(t=>this.deselectDirectories())),this.container=document.createElement("div"),this.container.className="maplibregl-ctrl",this.checkAddButtons(),this.setupButtons(),this.container}onRemove(t){this.container.parentNode.removeChild(this.container),this.map=void 0}checkAddGeoJsonLayer(){const t=this.mainControl.query.get("geo"),e=this.mainControl.query.get("type")??"line";null!==t&&this.addLayerHelper("geoJsonData",e,t)}checkAddButtons(){const t=this.mainControl.getButtonsQuery();null!==t&&v(t,(t=>{this.savePointUrl=t.savePointUrl,this.map.on("style.load",(e=>{this.addLayerButtons(t.buttons)})),this.map.on("load",(e=>{this.addLayerButtons(t.buttons),this.setupIcons(),this.checkAddGeoJsonLayer()}))}))}setupButtons(){document.getElementsByClassName("maplibregl-ctrl-top-left")[0].append(document.getElementById("buttonHolder"))}addLayerButtons(t,e=null){for(const i of t)this.addLayerButton(i,e)}removeLayerButtons(t){for(const e of t)e.id in this.buttons&&this.removeLayerButton(this.buttons[e.id])}addLayerHelper(t,e,i){this.addLayerButton({id:t,type:e,class:"layer",source:{type:"geojson",data:i},active:!0})}generatorMap={directory:t=>new B(t,this),rain:t=>new R(t,this),layer:t=>new G(t,this),reset:t=>new T(t,this),about:t=>new W(t,this),layerIds:t=>new J(t,this),externalLink:t=>new z(t,this),route:t=>new V(t,this)};generateButton(t){return void 0===t.class&&(t.class="externalLink"),t.class in this.generatorMap||console.error(`could not find class ${t.class} in generator map`),this.generatorMap[t.class](t)}addLayerButton(t,e=null){if(null!=document.getElementById(t.id))return;const i=this.generateButton(t);(null!=e?e:document.getElementById("buttonHolder")).appendChild(i.nav),t.active&&i.select()}removeLayerButton(t){t.deselect();const e=t.layer.id;null!=this.map.getSource(e)&&this.map.removeSource(e),t.buttonElement.remove()}removeLayerButtonById(t){const e=this.buttons[t];void 0!==e&&this.removeLayerButton(e)}removeLayerById(t){const e=this.buttons[t];void 0!==e&&e.deselect()}deselectAll(){Object.values(this.buttons).filter((t=>t.buttonElement.classList.contains("active"))).forEach((t=>t.deselect()))}deselectGroup(t){void 0!==t&&Object.values(this.buttons).filter((e=>e.layer.group===t&&e.buttonElement.classList.contains("active"))).forEach((t=>t.deselect()))}deselectDirectories(t=void 0){Object.values(this.buttons).filter((e=>e instanceof B&&(void 0===t||e.layer.depth===t)&&!e.layer.active&&e.buttonElement.classList.contains("active"))).forEach((t=>t.deselect()))}setupIcons(){this.map.loadImage("sprite/2197.png").then((t=>this.map.addImage("upright",t.data))),this.map.loadImage("sprite/2198.png").then((t=>this.map.addImage("downright",t.data))),this.map.loadImage("sprite/27a1.png").then((t=>this.map.addImage("right",t.data)))}}class M{buttonControl;map;dummyContainer;constructor(t){this.buttonControl=t}onAdd(t){return this.map=t,this.dummyContainer=document.createElement("div"),this.addSavePointListener(),this.dummyContainer}onRemove(t){this.dummyContainer.parentNode.removeChild(this.dummyContainer),this.map=void 0}addSavePointListener(){this.map.on("click",(t=>{(t.originalEvent.ctrlKey||t.originalEvent.metaKey)&&this.fireSavePoint(t)}))}fireSavePoint(t){if(void 0===this.buttonControl.savePointUrl)return;let e=prompt("please enter a category","edited");if(null==e)return;let i=prompt("please enter a title","");if(null==i)return;let n=new URLSearchParams;n.set("point",_(t.lngLat,4)),n.set("category",e),n.set("title",i),v(`${this.buttonControl.savePointUrl}?${n}`,(t=>{alert(t?.msg??"failure")}))}} /*! js-cookie v3.0.5 | MIT */ -function F(t){for(var e=1;e=l)return o;if(n)return n=!1,r;var e,s=c;if(34===t.charCodeAt(s)){for(var a=s;a++=0?0:1],s=Math.abs(t),n=Math.floor(s),r=60*(s-n),o=Math.floor(r);return{whole:n,minutes:o,seconds:Math.floor(60*(r-o)),dir:i}}function A(t,e){if(e||(e="NSEW"),"string"!=typeof t)return null;var i=(t=t.toUpperCase()).match(/^[\s\,]*([NSEW])?\s*([\-|\—|\―]?[0-9.]+)[°º˚]?\s*(?:([0-9.]+)['’′‘]\s*)?(?:([0-9.]+)(?:''|"|”|″)\s*)?([NSEW])?/);if(!i)return null;var s,n=i[0];if(i[1]&&i[5]?(s=i[1],n=n.slice(0,-1)):s=i[1]||i[5],s&&-1===e.indexOf(s))return null;var r=i[2]?parseFloat(i[2]):0,o=i[3]?parseFloat(i[3])/60:0,a=i[4]?parseFloat(i[4])/3600:0,l=r<0?-1:1;return"S"!==s&&"W"!==s||(l*=-1),{val:(Math.abs(r)+o+a)*l,dim:s,matched:n,remain:t.slice(n.length)}}I.exports=function(t,e){var i=A(t,e);return null===i?null:i.val},I.exports.pair=function(t,e){var i=A(t=t.trim(),e);if(!i)return null;var s=A(t=i.remain.trim(),e);return!s||s.remain?null:i.dim?function(t,e,i){return"N"===i||"S"===i?[t,e]:"W"===i||"E"===i?[e,t]:void 0}(i.val,s.val,i.dim):[i.val,s.val]},I.exports.format=C,I.exports.formatPair=function(t){return C(t.lat,"lat")+" "+C(t.lon,"lon")},I.exports.coordToDMS=f;var y=I.exports,b=m,_=y,v=/(Lat)(itude)?/gi,x=/(L)(on|ng)(gitude)?/i;function w(t,e){var i,s,n;for(var r in t)(s=r.match(e))&&(!i||s[0].length/r.length>n)&&(n=s[0].length/r.length,i=r);return i}function S(t){return w(t,v)}function k(t){return w(t,x)}function B(t){return"object"==typeof t?Object.keys(t).length:0}function Z(t){var e=[];return[",",";","\t","|"].forEach((function(i){var s=b.dsvFormat(i).parse(t);if(s.length>=1){for(var n=B(s[0]),r=0;r{i[s]=t}));return i}function H(t){return 1===t?.nodeType}function E(t){return M(t,"line",(t=>Object.assign({},F(t,"color",(t=>({stroke:`#${t}`}))),K(t,"opacity",(t=>({"stroke-opacity":t}))),K(t,"width",(t=>({"stroke-width":96*t/25.4}))))))}function D(t){let e=[];if(null===t)return e;for(const i of Array.from(t.childNodes)){if(!H(i))continue;const t=Y(i.nodeName);if("gpxtpx:TrackPointExtension"===t)e=e.concat(D(i));else{const s=z(i);e.push([t,N(s)])}}return e}function Y(t){return["heart","gpxtpx:hr","hr"].includes(t)?"heart":t}function N(t){const e=parseFloat(t);return isNaN(e)?t:e}function O(t){const e=[parseFloat(t.getAttribute("lon")||""),parseFloat(t.getAttribute("lat")||"")];if(isNaN(e[0])||isNaN(e[1]))return null;P(t,"ele",(t=>{e.push(t)}));const i=J(t,"time");return{coordinates:e,time:i?z(i):null,extendedValues:D(J(t,"extensions"))}}function U(t){const e=X(t,["name","cmt","desc","type","time","keywords"]),i=Array.from(t.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/GpxExtensions/v3","*"));for(const s of i)s.parentNode?.parentNode===t&&(e[s.tagName.replace(":","_")]=z(s));const s=V(t,"link");return s.length&&(e.links=s.map((t=>Object.assign({href:t.getAttribute("href")},X(t,["text","type"]))))),e}function j(t,e){const i=V(t,e),s=[],n=[],r={};for(let t=0;t1,o=Object.assign({_gpxType:"trk"},U(t),E(J(t,"extensions")),s.length?{coordinateProperties:{times:r?s:s[0]}}:{});for(const t of n){i.push(t.line),o.coordinateProperties||(o.coordinateProperties={});const e=o.coordinateProperties,s=Object.entries(t.extendedValues);for(let t=0;tnew Array(t.line.length).fill(null)))),e[i][t]=o):e[i]=o}}return{type:"Feature",properties:o,geometry:r?{type:"MultiLineString",coordinates:i}:{type:"LineString",coordinates:i[0]}}}function $(t){const e=Object.assign(U(t),X(t,["sym"])),i=O(t);return i?{type:"Feature",properties:e,geometry:{type:"Point",coordinates:i.coordinates}}:null}function*tt(t){for(const e of V(t,"trk")){const t=q(e);t&&(yield t)}for(const e of V(t,"rte")){const t=Q(e);t&&(yield t)}for(const e of V(t,"wpt")){const t=$(e);t&&(yield t)}}const et="http://www.garmin.com/xmlschemas/ActivityExtension/v2",it=[["heartRate","heartRates"],["Cadence","cadences"],["Speed","speeds"],["Watts","watts"]],st=[["TotalTimeSeconds","totalTimeSeconds"],["DistanceMeters","distanceMeters"],["MaximumSpeed","maxSpeed"],["AverageHeartRateBpm","avgHeartRate"],["MaximumHeartRateBpm","maxHeartRate"],["AvgSpeed","avgSpeed"],["AvgWatts","avgWatts"],["MaxWatts","maxWatts"]];function nt(t,e){const i=[];for(const[s,n]of e){let e=J(t,s);if(!e){const i=t.getElementsByTagNameNS(et,s);i.length&&(e=i[0])}const r=parseFloat(z(e));isNaN(r)||i.push([n,r])}return i}function rt(t){const e=[P(t,"LongitudeDegrees"),P(t,"LatitudeDegrees")];if(void 0===e[0]||isNaN(e[0])||void 0===e[1]||isNaN(e[1]))return null;const i=J(t,"HeartRateBpm"),s=z(J(t,"Time"));return J(t,"AltitudeMeters",(t=>{const i=parseFloat(z(t));isNaN(i)||e.push(i)})),{coordinates:e,time:s||null,heartRate:i?parseFloat(z(i)):null,extensions:nt(t,it)}}function ot(t){const e=V(t,"Trackpoint"),i=[],s=[],n=[];if(e.length<2)return null;const r={},o={extendedProperties:r};for(let t=0;t({name:z(t)}))));for(const t of e)o=ot(t),o&&(i.push(o.line),o.times.length&&s.push(o.times),o.heartRates.length&&n.push(o.heartRates),r.push(o.extendedProperties));for(let t=0;tArray(t.length).fill(null)))),a[n][t]=s[n])}return 0===i.length?null:((s.length||n.length)&&(a.coordinateProperties=Object.assign(s.length?{times:1===i.length?s[0]:s}:{},n.length?{heart:1===i.length?n[0]:n}:{})),{type:"Feature",properties:a,geometry:1===i.length?{type:"LineString",coordinates:i[0]}:{type:"MultiLineString",coordinates:i}})}function*lt(t){for(const e of V(t,"Lap")){const t=at(e);t&&(yield t)}for(const e of V(t,"Courses")){const t=at(e);t&&(yield t)}}function ct(t,e){const i={},s="stroke"==e||"fill"===e?e:e+"-color";return"#"===t[0]&&(t=t.substring(1)),6===t.length||3===t.length?i[s]="#"+t:8===t.length&&(i[e+"-opacity"]=parseInt(t.substring(0,2),16)/255,i[s]="#"+t.substring(6,8)+t.substring(4,6)+t.substring(2,4)),i}function gt(t,e,i){const s={};return P(t,e,(t=>{s[i]=t})),s}function ht(t,e){return M(t,"color",(t=>ct(z(t),e)))}function ut(t){return M(t,"Icon",((t,e)=>(F(t,"href",(t=>{e.icon=t})),e)))}function dt(t){return Object.assign({},function(t){return M(t,"PolyStyle",((t,e)=>Object.assign(e,M(t,"color",(t=>ct(z(t),"fill"))),F(t,"fill",(t=>{if("0"===t)return{"fill-opacity":0}})),F(t,"outline",(t=>{if("0"===t)return{"stroke-opacity":0}})))))}(t),function(t){return M(t,"LineStyle",(t=>Object.assign(ht(t,"stroke"),gt(t,"width","stroke-width"))))}(t),function(t){return M(t,"LabelStyle",(t=>Object.assign(ht(t,"label"),gt(t,"scale","label-scale"))))}(t),function(t){return M(t,"IconStyle",(t=>Object.assign(ht(t,"icon"),gt(t,"scale","icon-scale"),gt(t,"heading","icon-heading"),M(t,"hotSpot",(t=>{const e=parseFloat(t.getAttribute("x")||""),i=parseFloat(t.getAttribute("y")||""),s=t.getAttribute("xunits")||"",n=t.getAttribute("yunits")||"";return isNaN(e)||isNaN(i)?{}:{"icon-offset":[e,i],"icon-offset-units":[s,n]}})),ut(t))))}(t))}const pt=t=>Number(t),mt={string:t=>t,int:pt,uint:pt,short:pt,ushort:pt,float:pt,double:pt,bool:t=>Boolean(t)};function It(t,e){return M(t,"ExtendedData",((t,i)=>{for(const e of V(t,"Data"))i[e.getAttribute("name")||""]=z(J(e,"value"));for(const s of V(t,"SimpleData")){const t=s.getAttribute("name")||"",n=e[t]||mt.string;i[t]=n(z(s))}return i}))}function Ct(t){const e=J(t,"description");for(const t of Array.from(e?.childNodes||[]))if(4===t.nodeType)return{description:{"@type":"html",value:z(t)}};return{}}function ft(t){return M(t,"TimeSpan",(t=>({timespan:{begin:z(J(t,"begin")),end:z(J(t,"end"))}})))}function At(t){return M(t,"TimeStamp",(t=>({timestamp:z(J(t,"when"))})))}function yt(t,e){return F(t,"styleUrl",(t=>(t=W(t),e[t]?Object.assign({styleUrl:t},e[t]):{styleUrl:t})))}const bt=/\s*/g,_t=/^\s*|\s*$/g,vt=/\s+/;function xt(t){return t.replace(bt,"").split(",").map(parseFloat).filter((t=>!isNaN(t))).slice(0,3)}function wt(t){return t.replace(_t,"").split(vt).map(xt).filter((t=>t.length>=2))}function St(t){let e=V(t,"coord");0===e.length&&(e=function(t,e,i){return Array.from(t.getElementsByTagNameNS(i,e))}(t,"coord","*"));const i=e.map((t=>z(t).split(" ").map(parseFloat)));return 0===i.length?null:{geometry:i.length>2?{type:"LineString",coordinates:i}:{type:"Point",coordinates:i[0]},times:V(t,"when").map((t=>z(t)))}}function kt(t){if(0===t.length)return t;const e=t[0],i=t[t.length-1];let s=!0;for(let t=0;t=2&&e.push({type:"Point",coordinates:t});break}case"LinearRing":case"LineString":{const t=wt(Bt(n));t.length>=2&&e.push({type:"LineString",coordinates:t});break}case"Polygon":{const t=[];for(const e of V(n,"LinearRing")){const i=kt(wt(Bt(e)));i.length>=4&&t.push(i)}t.length&&e.push({type:"Polygon",coordinates:t});break}case"Track":case"gx:Track":{const t=St(n);if(!t)break;const{times:s,geometry:r}=t;e.push(r),s.length&&i.push(s);break}}}return{geometries:e,coordTimes:i}}function Gt(t){return 0===t.length?null:1===t.length?t[0]:{type:"GeometryCollection",geometries:t}}function Rt(t,e,i){const{coordTimes:s,geometries:n}=Zt(t),r={type:"Feature",geometry:Gt(n),properties:Object.assign(X(t,["name","address","visibility","open","phoneNumber","description"]),Ct(t),yt(t,e),dt(t),It(t,i),ft(t),At(t),s.length?{coordinateProperties:{times:1===s.length?s[0]:s}}:{})};void 0!==r.properties?.visibility&&(r.properties.visibility="0"!==r.properties.visibility);const o=t.getAttribute("id");return null!==o&&""!==o&&(r.id=o),r}function Tt(t){return J(t,"gx:LatLonQuad")?{type:"Polygon",coordinates:[kt(wt(Bt(t)))]}:function(t){const e=J(t,"LatLonBox");if(e){const t=P(e,"north"),i=P(e,"west"),s=P(e,"east"),n=P(e,"south"),r=P(e,"rotation");if("number"==typeof t&&"number"==typeof n&&"number"==typeof i&&"number"==typeof s){let e=[[[i,t],[s,t],[s,n],[i,n],[i,t]]];return"number"==typeof r&&(e=function(t,e,i){const s=[(t[0]+t[2])/2,(t[1]+t[3])/2];return[e[0].map((t=>{const e=t[1]-s[1],n=t[0]-s[0],r=Math.sqrt(Math.pow(e,2)+Math.pow(n,2)),o=Math.atan2(e,n)-i*Vt;return[s[0]+Math.cos(o)*r,s[1]+Math.sin(o)*r]}))]}([i,n,s,t],e,r)),{type:"Polygon",coordinates:e}}}return null}(t)}const Vt=Math.PI/180;function Wt(t,e,i){const s={type:"Feature",geometry:Tt(t),properties:Object.assign({"@geometry-type":"groundoverlay"},X(t,["name","address","visibility","open","phoneNumber","description"]),Ct(t),yt(t,e),dt(t),ut(t),It(t,i),ft(t),At(t))};void 0!==s.properties?.visibility&&(s.properties.visibility="0"!==s.properties.visibility);const n=t.getAttribute("id");return null!==n&&""!==n&&(s.id=n),s}function zt(t){let e=t.getAttribute("id");const i=t.parentNode;return!e&&H(i)&&"CascadingStyle"===i.localName&&(e=i.getAttribute("kml:id")||i.getAttribute("id")),W(e||"")}function Jt(t){const e={};for(const i of V(t,"Style"))e[zt(i)]=dt(i);for(const i of V(t,"StyleMap")){const t=W(i.getAttribute("id")||"");F(i,"styleUrl",(i=>{i=W(i),e[i]&&(e[t]=e[i])}))}return e}function Mt(t){const e={};for(const i of V(t,"SimpleField"))e[i.getAttribute("name")||""]=mt[i.getAttribute("type")||""]||mt.string;return e}const Ft=["name","visibility","open","address","description","phoneNumber","visibility"];function*Kt(t){const e=Jt(t),i=Mt(t);for(const s of V(t,"Placemark")){const t=Rt(s,e,i);t&&(yield t)}for(const s of V(t,"GroundOverlay")){const t=Wt(s,e,i);t&&(yield t)}}var Lt=Object.freeze({__proto__:null,gpx:function(t){return{type:"FeatureCollection",features:Array.from(tt(t))}},gpxGen:tt,kml:function(t){return{type:"FeatureCollection",features:Array.from(Kt(t))}},kmlGen:Kt,kmlWithFolders:function(t){const e=Jt(t),i=Mt(t),s={type:"root",children:[]};return function t(s,n){if(H(s))switch(s.tagName){case"GroundOverlay":{const t=Wt(s,e,i);t&&n.children.push(t);break}case"Placemark":{const t=Rt(s,e,i);t&&n.children.push(t);break}case"Folder":{const t=function(t){const e={};for(const i of Array.from(t.childNodes))H(i)&&Ft.includes(i.tagName)&&(e[i.tagName]=z(i));return{type:"folder",meta:e,children:[]}}(s);n.children.push(t),n=t;break}}if(s.childNodes)for(let e=0;e{const t=t=>t[0],e=t=>t[t.length-1],i=t=>t.join(","),s=(t,e,i)=>{let s=t[e];s?s.push(i):t[e]=[i]},n=(t,e,i)=>{let s=t[e],n=null;s&&(n=s.indexOf(i))>=0&&s.splice(n,1)},r=(t,e)=>{let i=t[e];return i&&i.length>0?i[0]:null},o=s=>s.length>3&&i(t(s))===i(e(s)),a=(t,e,i)=>{e=e||0,i=i||1;let s=t.reduce(((i,s,n)=>t[i][e]>s[e]?i:n),0),n=s<=0?t.length-2:s-1,r=s>=t.length-1?1:s+1,o=t[n][e],a=t[s][e],l=t[r][e],c=t[n][i],g=t[s][i];return(a-o)*(t[r][i]-c)-(l-o)*(g-c)<0?"clockwise":"counterclockwise"},l=t=>t instanceof Array?t.map(l):parseFloat(t);class c extends Map{constructor(){super(),this.binders=[]}add(t,e){this.has(t)||this.set(t,e)}addBinder(t){this.binders.push(t)}bindAll(){this.binders.forEach((t=>t.bind()))}}return{purgeProps:(t,e)=>{if(t){let i=Object.assign({},t);if(e)for(let t of e)delete i[t];return i}return{}},mergeProps:(t,e)=>(t=t||{},e=e||{},Object.assign(t,e)),first:t,last:e,coordsToKey:i,addToMap:s,removeFromMap:n,getFirstFromMap:r,isRing:o,ringDirection:a,ptInsidePolygon:(t,e,i,s)=>{i=i||0,s=s||1;let n=!1;for(let r=0,o=e.length-1;r=0){let i=[e,1];t&&i.push(t),[].splice.apply(this.container,i)}}else if("object"==typeof this.container){let e=Object.keys(this.container).find((t=>this.container[t]===this));e&&(t?this.container[e]=t:delete this.container[e])}}},WayCollection:class extends Array{constructor(){super(),this.firstMap={},this.lastMap={}}addWay(n){(n=n.toCoordsArray()).length>0&&(this.push(n),s(this.firstMap,i(t(n)),n),s(this.lastMap,i(e(n)),n))}toStrings(){let s=[],o=null;for(;o=this.shift();){n(this.firstMap,i(t(o)),o),n(this.lastMap,i(e(o)),o);let a=o,c=null;do{let s=i(e(a)),o=!1;c=r(this.firstMap,s),c||(c=r(this.lastMap,s),o=!0),c&&(this.splice(this.indexOf(c),1),n(this.firstMap,i(t(c)),c),n(this.lastMap,i(e(c)),c),o&&(c.length>a.length&&([a,c]=[c,a]),c.reverse()),a=a.concat(c.slice(1)))}while(c);s.push(l(a))}return s}toRings(t){let e=this.toStrings(),i=[],s=null;for(;s=e.shift();)o(s)&&(a(s)!==t&&s.reverse(),i.push(s));return i}}}})(),Xt={building:{},highway:{whitelist:["services","rest_area","escape","elevator"]},natural:{blacklist:["coastline","cliff","ridge","arete","tree_row"]},landuse:{},waterway:{whitelist:["riverbank","dock","boatyard","dam"]},amenity:{},leisure:{},barrier:{whitelist:["city_wall","ditch","hedge","retaining_wall","wall","spikes"]},railway:{whitelist:["station","turntable","roundhouse","platform"]},area:{},boundary:{},man_made:{blacklist:["cutline","embankment","pipeline"]},power:{whitelist:["plant","substation","generator","transformer"]},place:{},shop:{},aeroway:{blacklist:["taxiway"]},tourism:{},historic:{},public_transport:{},office:{},"building:part":{},military:{},ruins:{},"area:highway":{},craft:{},golf:{},indoor:{}},Ht=(()=>{const{first:t,last:e,coordsToKey:i,addToMap:s,removeFromMap:n,getFirstFromMap:r,isRing:o,ringDirection:a,ptInsidePolygon:l,strToFloat:c,LateBinder:g,WayCollection:h}=Pt,u=Xt;class d{constructor(t,e,i){this.type=t,this.id=e,this.refElems=i,this.tags={},this.props={id:this.getCompositeId()},this.refCount=0,this.hasTag=!1,i&&i.add(this.getCompositeId(),this)}addTags(t){this.tags=Object.assign(this.tags,t),this.hasTag=!!t}addTag(t,e){this.tags[t]=e,this.hasTag=!!t}addProp(t,e){this.props[t]=e}addProps(t){this.props=Object.assign(this.props,t)}getCompositeId(){return`${this.type}/${this.id}`}getProps(){return Object.assign(this.props,this.tags)}toFeatureArray(){return[]}}class p extends d{constructor(t,e){super("node",t,e),this.latLng=null}setLatLng(t){this.latLng=t}toFeatureArray(){return this.latLng?[{type:"Feature",id:this.getCompositeId(),properties:this.getProps(),geometry:{type:"Point",coordinates:c([this.latLng.lon,this.latLng.lat])}}]:[]}getLatLng(){return this.latLng}}class m extends d{constructor(t,e){super("way",t,e),this.latLngArray=[],this.isPolygon=!1}addLatLng(t){this.latLngArray.push(t)}setLatLngArray(t){this.latLngArray=t}addNodeRef(t){let e=new g(this.latLngArray,(function(t){let e=this.refElems.get(`node/${t}`);if(e)return e.refCount++,e.getLatLng()}),this,[t]);this.latLngArray.push(e),this.refElems.addBinder(e)}analyzeTag(t,e){let i=u[t];i&&(this.isPolygon=!0,i.whitelist?this.isPolygon=i.whitelist.indexOf(e)>=0:i.blacklist&&(this.isPolygon=!(i.blacklist.indexOf(e)>=0)))}addTags(t){super.addTags(t);for(let[e,i]of Object.entries(t))this.analyzeTag(e,i)}addTag(t,e){super.addTag(t,e),this.analyzeTag(t,e)}toCoordsArray(){return this.latLngArray.map((t=>[t.lon,t.lat]))}toFeatureArray(){let t=this.toCoordsArray();if(t.length>1){t=c(t);let e={type:"Feature",id:this.getCompositeId(),properties:this.getProps(),geometry:{type:"LineString",coordinates:t}};return this.isPolygon&&o(t)?("counterclockwise"!==a(t)&&t.reverse(),e.geometry={type:"Polygon",coordinates:[t]},[e]):[e]}return[]}}return{Node:p,Way:m,Relation:class extends d{constructor(t,e){super("relation",t,e),this.relations=[],this.nodes=[],this.bounds=null}setBounds(t){this.bounds=t}addMember(t){switch(t.type){case"relation":let e=new g(this.relations,(function(t){let e=this.refElems.get(`relation/${t}`);if(e)return e.refCount++,e}),this,[t.ref]);this.relations.push(e),this.refElems.addBinder(e);break;case"way":t.role||(t.role="");let i=this[t.role];if(i||(i=this[t.role]=[]),t.geometry){let e=new m(t.ref,this.refElems);e.setLatLngArray(t.geometry),e.refCount++,i.push(e)}else if(t.nodes){let e=new m(t.ref,this.refElems);for(let i of t.nodes)e.addNodeRef(i);e.refCount++,i.push(e)}else{let e=new g(i,(function(t){let e=this.refElems.get(`way/${t}`);if(e)return e.refCount++,e}),this,[t.ref]);i.push(e),this.refElems.addBinder(e)}break;case"node":let s=null;if(t.lat&&t.lon){s=new p(t.ref,this.refElems),s.setLatLng({lon:t.lon,lat:t.lat}),t.tags&&s.addTags(t.tags);for(let[e,i]of Object.entries(t))["id","type","lat","lon"].indexOf(e)<0&&s.addProp(e,i);s.refCount++,this.nodes.push(s)}else{let e=new g(this.nodes,(function(t){let e=this.refElems.get(`node/${t}`);if(e)return e.refCount++,e}),this,[t.ref]);this.nodes.push(e),this.refElems.addBinder(e)}}}toFeatureArray(){let e=[],i=[],s=[];const n=["outer","inner",""];for(let t of this.relations)if(t)for(let e of n){let i=t[e];if(i){let t=this[e];t?[].splice.apply(t,[t.length,0].concat(i)):this[e]=i}}for(let t of n){let e=this[t];if(e){this[t]=new h;for(let i of e)this[t].addWay(i)}}let r=null,o={type:"Feature",id:this.getCompositeId(),bbox:this.bounds,properties:this.getProps()};this.bounds||delete o.bbox,this.outer?(r=((e,i)=>{let s=e?e.toRings("counterclockwise"):[],n=i?i.toRings("clockwise"):[];if(s.length>0){let e=[],i=null;for(i of s)e.push([i]);for(;i=n.shift();)for(let n in s)if(l(t(i),s[n])){e[n].push(i);break}return 1===e.length?{type:"Polygon",coordinates:e[0]}:{type:"MultiPolygon",coordinates:e}}return null})(this.outer,this.inner),r&&(o.geometry=r,e.push(o))):this[""]&&(r=(t=>{let e=t?t.toStrings():[];return e.length>0?1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e}:null})(this[""]),r&&(o.geometry=r,i.push(o)));for(let t of this.nodes)s=s.concat(t.toFeatureArray());return e.concat(i).concat(s)}}}})(),Et=(()=>{function t(t){return null!=t.match(/^(.+?)\[(.+?)\]>$/g)}function e(t){let e=/^(.+?)\[(.+?)\]>$/g.exec(t);return e?{evt:e[1]+">",exp:e[2]}:{evt:t}}return class{constructor(t){t&&(this.queryParent=!!t.queryParent,this.progressive=t.progressive,this.queryParent&&(this.parentMap=new WeakMap)),this.evtListeners={}}parse(t,e,i){i=i?i+".":"";let s=/<([^ >\/]+)(.*?)>/gm,n=null,r=[];for(;n=s.exec(t);){let o=n[1],a={$tag:o},l=i+o,c=n[2].trim(),g=!1;(c.endsWith("/")||o.startsWith("?")||o.startsWith("!"))&&(g=!0);let h=/([^ ]+?)="(.+?)"/g,u=/([^ ]+?)='(.+?)'/g,d=null,p=!1;for(;d=h.exec(c);)p=!0,a[d[1]]=d[2];if(!p)for(;d=u.exec(c);)p=!0,a[d[1]]=d[2];if(p||""===c||(a.text=c),this.progressive&&this.emit(`<${l}>`,a,e),!g){let e=new RegExp(`([^]+?)`,"g");e.lastIndex=s.lastIndex;let i=e.exec(t);if(i&&i[1]){s.lastIndex=e.lastIndex;let t=this.parse(i[1],a,l);t.length>0?a.$innerNodes=t:a.$innerText=i[1]}}this.queryParent&&e&&this.parentMap.set(a,e),this.progressive&&this.emit(``,a,e),r.push(a)}return r}getParent(t){return this.queryParent?this.parentMap.get(t):null}$addListener(t,e){let i=this.evtListeners[t];i?i.push(e):this.evtListeners[t]=[e]}addListener(i,s){t(i)&&(i=e(i),s.condition=function(t){let e="return "+t.replace(/(\$.+?)(?=[=!.])/g,"node.$&")+";";return new Function("node",e)}(i.exp),i=i.evt),this.$addListener(i,s)}$removeListener(t,e){let i=this.evtListeners[t],s=null;i&&(s=i.indexOf(e))>=0&&i.splice(s,1)}removeListener(i,s){t(i)&&(i=(i=e(i)).evt),this.$removeListener(i,s)}emit(t,...e){let i=this.evtListeners[t];if(i)for(let t of i)t.condition?!0===t.condition.apply(null,e)&&t.apply(null,e):t.apply(null,e)}on(t,e){this.addListener(t,e)}off(t,e){this.removeListener(t,e)}}})();const{Node:Dt,Way:Yt,Relation:Nt}=Ht,{purgeProps:Ot,RefElements:Ut}=Pt,jt=Et;var Qt=(t,e)=>{let i=!1,s=!1,n=!0;(t=>{if(t){i=!(!t.completeFeature&&!t.allFeatures),s=!!t.renderTagged;let e=t.suppressWay||t.excludeWay;void 0===e||e||(n=!1)}})(e);let r=(t=>t.elements?"json":t.indexOf("=0?"xml":t.trim().startsWith("{")?"json-raw":"invalid")(t),o=new Ut,a=[];"json-raw"===r&&(r=(t=JSON.parse(t)).elements?"json":"invalid"),"json"===r?(t=>{for(let e of t.elements)switch(e.type){case"node":let t=new Dt(e.id,o);e.tags&&t.addTags(e.tags),t.addProps(Ot(e,["id","type","tags","lat","lon"])),t.setLatLng(e);break;case"way":let i=new Yt(e.id,o);if(e.tags&&i.addTags(e.tags),i.addProps(Ot(e,["id","type","tags","nodes","geometry"])),e.nodes)for(let t of e.nodes)i.addNodeRef(t);else e.geometry&&i.setLatLngArray(e.geometry);break;case"relation":let s=new Nt(e.id,o);if(e.bounds&&s.setBounds([parseFloat(e.bounds.minlon),parseFloat(e.bounds.minlat),parseFloat(e.bounds.maxlon),parseFloat(e.bounds.maxlat)]),e.tags&&s.addTags(e.tags),s.addProps(Ot(e,["id","type","tags","bounds","members"])),e.members)for(let t of e.members)s.addMember(t)}})(t):"xml"===r&&(t=>{const e=new jt({progressive:!0});e.on("",(t=>{let e=new Dt(t.id,o);for(let[i,s]of Object.entries(t))!i.startsWith("$")&&["id","lon","lat"].indexOf(i)<0&&e.addProp(i,s);if(e.setLatLng(t),t.$innerNodes)for(let i of t.$innerNodes)"tag"===i.$tag&&e.addTag(i.k,i.v)})),e.on("",(t=>{let e=new Yt(t.id,o);for(let[i,s]of Object.entries(t))!i.startsWith("$")&&["id"].indexOf(i)<0&&e.addProp(i,s);if(t.$innerNodes)for(let i of t.$innerNodes)"nd"===i.$tag?i.lon&&i.lat?e.addLatLng(i):i.ref&&e.addNodeRef(i.ref):"tag"===i.$tag&&e.addTag(i.k,i.v)})),e.on("",(t=>{new Nt(t.id,o)})),e.on("",((t,e)=>{let i=o.get(`relation/${e.id}`),s={type:t.type,role:t.role?t.role:"",ref:t.ref};if(t.lat&&t.lon){s.lat=t.lat,s.lon=t.lon,s.tags={};for(let[e,i]of Object.entries(t))!e.startsWith("$")&&["type","lat","lon"].indexOf(e)<0&&(s[e]=i)}if(t.$innerNodes){let e=[],i=[];for(let s of t.$innerNodes)s.lat&&s.lon?e.push(s):i.push(s.ref);e.length>0?s.geometry=e:i.length>0&&(s.nodes=i)}i.addMember(s)})),e.on("",((t,e)=>{o.get(`relation/${e.id}`).setBounds([parseFloat(t.minlon),parseFloat(t.minlat),parseFloat(t.maxlon),parseFloat(t.maxlat)])})),e.on("",((t,e)=>{o.get(`relation/${e.id}`).addTag(t.k,t.v)})),e.parse(t)})(t),o.bindAll();for(let t of o.values())if(t.refCount<=0||t.hasTag&&s&&!(t instanceof Yt&&n)){let e=t.toFeatureArray();if(t instanceof Nt&&!i&&e.length>0)return e[0].geometry;a=a.concat(e)}return{type:"FeatureCollection",features:a}},qt=e(Qt);const $t=["topojson","osm","kml","gpx","tcx","csv","tsv"];class te{constructor(t,e){this.blankGeoJSON=()=>({type:"FeatureCollection",features:[]}),this._rawData=e,this._format=t;const i={topojson:this.loadTopoJson,osm:this.loadOsm,kml:this.loadXml,gpx:this.loadXml,tcx:this.loadXml,csv:this.loadCsv,tsv:this.loadCsv};this._conversionFn=i[t]}async convert(){return this._conversionFn?this._conversionFn():new Promise(((t,e)=>e(`No converter exists for ${this._format}`)))}async loadXml(){return Lt[this._format]((new DOMParser).parseFromString(this._rawData,"text/xml"))}async loadCsv(){let t={};return"tsv"===this._format&&(t.delimiter="\t"),await new Promise(((e,i)=>{G.csv2geojson(this._rawData,t,((t,s)=>{t?i(t):e(s)}))}))}async loadTopoJson(){let t={};try{t=JSON.parse(this._rawData)}catch(t){throw"Invalid TopoJson"}let e=this.blankGeoJSON();return"Topology"===t.type&&void 0!==t.objects&&(e={type:"FeatureCollection",features:e.features=Object.keys(t.objects).map((e=>{return i=t,"string"==typeof(s=e)&&(s=i.objects[s]),"GeometryCollection"===s.type?{type:"FeatureCollection",features:s.geometries.map((function(t){return T(i,t)}))}:T(i,s);var i,s})).reduce(((t,e)=>[...t,...e.features]),[])}),e}async loadOsm(){return qt(this._rawData)}}var ee=null;try{var ie=L.require("worker_threads")||"function"==typeof __non_webpack_require__&&__non_webpack_require__("worker_threads")||require("worker_threads");ee=ie.Worker}catch(t){}function se(t,e,i){var s=void 0===e?null:e,n=function(t,e){return Buffer.from(t,"base64").toString(e?"utf16":"utf8")}(t,void 0!==i&&i),r=n.indexOf("\n",10)+1,o=n.substring(r)+(s?"//# sourceMappingURL="+s:"");return function(t){return new ee(o,Object.assign({},t,{eval:!0}))}}function ne(t,e,i){var s=void 0===e?null:e,n=function(t,e){var i=atob(t);if(e){for(var s=new Uint8Array(i.length),n=0,r=i.length;nMath.random().toString(36).substring(2);class he{constructor(t,e){this.initId=ge()+"-"+t,this.worker=new ce,this.handlers=new Map,this.worker.onmessage=e=>{const i=e.data,s=this.handlers.get(i.id),n=this;if(s){if("response"===i.type&&s.resolve(i.message),"error"===i.type){const e=i.error||new Error(`Unknown error with ${t}`);s.reject(e)}"init_response"===i.type&&(this._=Object.keys(i.message).map((t=>{const e="function"==typeof i.message[t];return[t,function(){return e?n.exec(t)(...arguments):n.get(t)}]})).reduce(((t,e)=>({...t,[e[0]]:e[1]})),{}),s.resolve(this._))}},this.worker.postMessage({type:"init",id:this.initId,command:t,message:e})}onLoad(){return new Promise((t=>{void 0===this._?this.handlers.set(this.initId,{resolve:t,reject:t}):t(this._)}))}exec(t){const e=this;return function(...i){return new Promise(((s,n)=>{const r=ge()+"-"+t;e.handlers.set(r,{resolve:s,reject:n}),e.worker.postMessage({type:"exec",id:r,command:t,message:[...i]})}))}}get(t){return new Promise(((e,i)=>{const s=ge()+"-"+t;this.handlers.set(s,{resolve:e,reject:i}),this.worker.postMessage({type:"get",id:s,command:t,message:[]})}))}}const ue="test://http://example.com"!==new URL("test://http://example.com").href;async function de(t,e,i){const s=await fetch(t,i?{signal:i.signal}:void 0);if(200==s.status){const t=await s.text();let i,n;return["kml","tcx","gpx"].indexOf(e)>=0||!(()=>{let t=!1;try{t="function"==typeof window.Worker}catch(e){t=!1}return t})()?(i=new te(e,t),n=i.convert()):(i=new he("Converter",[e,t]),n=i.exec("convert")()),await n}throw new Error(`Data fetch error: ${s.statusText}`)}const pe=(t,e)=>{const i=new AbortController,s=t.url.split("://")[0],n=t.url.replace(new RegExp(`^${s}://`),""),r=ue?(t=>{const e=new RegExp("^(https?)(//)");return t.replace(e,"$1:$2")})(n):n;return r&&de(r,s,i).then((t=>e(null,t))).catch((t=>e(t))),{cancel:()=>{i.abort()}}};t.VectorTextProtocol=pe,t.addProtocols=t=>{$t.forEach((e=>{t.addProtocol(e,pe)}))},Object.defineProperty(t,"__esModule",{value:!0})}(P.exports);var X=i(P.exports);const H={expires:182};class E{map;dummyContainer;query=new URLSearchParams(window.location.search);constructor(){X.addProtocols(r);let t=+(K.get("latitude")||40),e=+(K.get("longitude")||-96),i=+(K.get("zoom")||5);this.map=new n.Map({container:"map",style:this.getStyleQuery(),center:new n.LngLat(e,t),zoom:i,hash:!0,failIfMajorPerformanceCaveat:!0,dragRotate:!1,customAttribution:"openmaptiles ©openstreetmap contributorsosrm"}),this.map.addControl(this),this.map.addControl(new n.NavigationControl),this.map.addControl(new n.ScaleControl({})),this.map.addControl(new n.GeolocateControl({positionOptions:{enableHighAccuracy:!0},trackUserLocation:!0}));const s=new p(this);this.map.addControl(s),this.map.addControl(new m(s)),this.map.addControl(new M(s)),this.map.scrollZoom.setWheelZoomRate(4/450),this.map.on("load",(t=>this.map.resize()))}onAdd(t){return this.dummyContainer=document.createElement("div"),this.addMoveListener(),this.addClickListeners(),this.dummyContainer}onRemove(t){this.dummyContainer.parentNode.removeChild(this.dummyContainer)}addMoveListener(){this.map.on("moveend",(()=>this.checkMove())),this.checkMove(),this.map.on("zoom",(()=>this.checkZoom())),this.checkZoom()}checkZoom(){let t=this.map.getZoom()>=12;document.getElementById("footLegend").style.opacity=(t?1:0).toString()}checkMove(){if(this.map.isMoving())return;let t=this.map.getCenter().lat,e=this.map.getCenter().lng,i=this.map.getZoom();K.set("latitude",t.toString(),H),K.set("longitude",e.toString(),H),K.set("zoom",i.toString(),H)}addClickListeners(){this.map.on("mouseup",(e=>{e.originalEvent.shiftKey&&alert(`point: ${t(e.lngLat,4)}`)}))}getStyleQuery(){let t=K.get("style")||null,e=this.query.has("style")?`style-${this.query.get("style")}.json`:t;return null!=e&&K.set("style",e,H),""+(null!=e?e:"style.json")}getButtonsQuery(){let t=K.get("buttons")||null,e=this.query.has("buttons")?this.query.get("buttons"):t;return null!=e&&K.set("buttons",e,H),null!=e?e:"buttons.json"}openOsmEdit(){window.open(d.formatUrl(this.map,"https://www.openstreetmap.org/edit#map={z1}/{latitude}/{longitude}"))}}const D=new E;window.mainControl=D;export{E as MainControl,D as mainControl}; +function X(t){for(var e=1;e=l)return o;if(s)return s=!1,r;var e,n=c;if(34===t.charCodeAt(n)){for(var a=n;a++=0?0:1],n=Math.abs(t),s=Math.floor(n),r=60*(n-s),o=Math.floor(r);return{whole:s,minutes:o,seconds:Math.floor(60*(r-o)),dir:i}}function A(t,e){if(e||(e="NSEW"),"string"!=typeof t)return null;var i=(t=t.toUpperCase()).match(/^[\s\,]*([NSEW])?\s*([\-|—|―]?[0-9.]+)[°º˚]?\s*(?:([0-9.]+)['’′‘]\s*)?(?:([0-9.]+)(?:''|"|”|″)\s*)?([NSEW])?/);if(!i)return null;var n,s=i[0];if(i[1]&&i[5]?(n=i[1],s=s.slice(0,-1)):n=i[1]||i[5],n&&-1===e.indexOf(n))return null;var r=i[2]?parseFloat(i[2]):0,o=i[3]?parseFloat(i[3])/60:0,a=i[4]?parseFloat(i[4])/3600:0,l=r<0?-1:1;return"S"!==n&&"W"!==n||(l*=-1),{val:(Math.abs(r)+o+a)*l,dim:n,matched:s,remain:t.slice(s.length)}}I.exports=function(t,e){var i=A(t,e);return null===i?null:i.val},I.exports.pair=function(t,e){var i=A(t=t.trim(),e);if(!i)return null;var n=A(t=i.remain.trim(),e);return!n||n.remain?null:i.dim?function(t,e,i){return"N"===i||"S"===i?[t,e]:"W"===i||"E"===i?[e,t]:void 0}(i.val,n.val,i.dim):[i.val,n.val]},I.exports.format=C,I.exports.formatPair=function(t){return C(t.lat,"lat")+" "+C(t.lon,"lon")},I.exports.coordToDMS=f;var y=I.exports,b=m,_=y,v=/(Lat)(itude)?/gi,x=/(L)(on|ng)(gitude)?/i;function w(t,e){var i,n,s;for(var r in t)(n=r.match(e))&&(!i||n[0].length/r.length>s)&&(s=n[0].length/r.length,i=r);return i}function S(t){return w(t,v)}function k(t){return w(t,x)}function Z(t){return"object"==typeof t?Object.keys(t).length:0}function B(t){var e=[];return[",",";","\t","|"].forEach((function(i){var n=b.dsvFormat(i).parse(t);if(n.length>=1){for(var s=Z(n[0]),r=0;r{i[n]=t}));return i}function L(t){return 1===t?.nodeType}function E(t){return P(t,"line",(t=>Object.assign({},M(t,"color",(t=>({stroke:`#${t}`}))),X(t,"opacity",(t=>({"stroke-opacity":t}))),X(t,"width",(t=>({"stroke-width":96*t/25.4}))))))}function D(t){let e=[];if(null===t)return e;for(const i of Array.from(t.childNodes)){if(!L(i))continue;const t=Y(i.nodeName);if("gpxtpx:TrackPointExtension"===t)e=e.concat(D(i));else{const n=J(i);e.push([t,N(n)])}}return e}function Y(t){return["heart","gpxtpx:hr","hr"].includes(t)?"heart":t}function N(t){const e=parseFloat(t);return isNaN(e)?t:e}function O(t){const e=[parseFloat(t.getAttribute("lon")||""),parseFloat(t.getAttribute("lat")||"")];if(isNaN(e[0])||isNaN(e[1]))return null;F(t,"ele",(t=>{e.push(t)}));const i=z(t,"time");return{coordinates:e,time:i?J(i):null,extendedValues:D(z(t,"extensions"))}}function U(t){const e=H(t,["name","cmt","desc","type","time","keywords"]),i=Array.from(t.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/GpxExtensions/v3","*"));for(const n of i)n.parentNode?.parentNode===t&&(e[n.tagName.replace(":","_")]=J(n));const n=T(t,"link");return n.length&&(e.links=n.map((t=>Object.assign({href:t.getAttribute("href")},H(t,["text","type"]))))),e}function j(t,e){const i=T(t,e),n=[],s=[],r={};for(let t=0;t1,o=Object.assign({_gpxType:"trk"},U(t),E(z(t,"extensions")),n.length?{coordinateProperties:{times:r?n:n[0]}}:{});for(const t of s){i.push(t.line),o.coordinateProperties||(o.coordinateProperties={});const e=o.coordinateProperties,n=Object.entries(t.extendedValues);for(let t=0;tnew Array(t.line.length).fill(null)))),e[i][t]=o):e[i]=o}}return{type:"Feature",properties:o,geometry:r?{type:"MultiLineString",coordinates:i}:{type:"LineString",coordinates:i[0]}}}function $(t){const e=Object.assign(U(t),H(t,["sym"])),i=O(t);return i?{type:"Feature",properties:e,geometry:{type:"Point",coordinates:i.coordinates}}:null}function*tt(t){for(const e of T(t,"trk")){const t=q(e);t&&(yield t)}for(const e of T(t,"rte")){const t=Q(e);t&&(yield t)}for(const e of T(t,"wpt")){const t=$(e);t&&(yield t)}}const et="http://www.garmin.com/xmlschemas/ActivityExtension/v2",it=[["heartRate","heartRates"],["Cadence","cadences"],["Speed","speeds"],["Watts","watts"]],nt=[["TotalTimeSeconds","totalTimeSeconds"],["DistanceMeters","distanceMeters"],["MaximumSpeed","maxSpeed"],["AverageHeartRateBpm","avgHeartRate"],["MaximumHeartRateBpm","maxHeartRate"],["AvgSpeed","avgSpeed"],["AvgWatts","avgWatts"],["MaxWatts","maxWatts"]];function st(t,e){const i=[];for(const[n,s]of e){let e=z(t,n);if(!e){const i=t.getElementsByTagNameNS(et,n);i.length&&(e=i[0])}const r=parseFloat(J(e));isNaN(r)||i.push([s,r])}return i}function rt(t){const e=[F(t,"LongitudeDegrees"),F(t,"LatitudeDegrees")];if(void 0===e[0]||isNaN(e[0])||void 0===e[1]||isNaN(e[1]))return null;const i=z(t,"HeartRateBpm"),n=J(z(t,"Time"));return z(t,"AltitudeMeters",(t=>{const i=parseFloat(J(t));isNaN(i)||e.push(i)})),{coordinates:e,time:n||null,heartRate:i?parseFloat(J(i)):null,extensions:st(t,it)}}function ot(t){const e=T(t,"Trackpoint"),i=[],n=[],s=[];if(e.length<2)return null;const r={},o={extendedProperties:r};for(let t=0;t({name:J(t)}))));for(const t of e)o=ot(t),o&&(i.push(o.line),o.times.length&&n.push(o.times),o.heartRates.length&&s.push(o.heartRates),r.push(o.extendedProperties));for(let t=0;tArray(t.length).fill(null)))),a[s][t]=n[s])}return 0===i.length?null:((n.length||s.length)&&(a.coordinateProperties=Object.assign(n.length?{times:1===i.length?n[0]:n}:{},s.length?{heart:1===i.length?s[0]:s}:{})),{type:"Feature",properties:a,geometry:1===i.length?{type:"LineString",coordinates:i[0]}:{type:"MultiLineString",coordinates:i}})}function*lt(t){for(const e of T(t,"Lap")){const t=at(e);t&&(yield t)}for(const e of T(t,"Courses")){const t=at(e);t&&(yield t)}}function ct(t,e){const i={},n="stroke"==e||"fill"===e?e:e+"-color";return"#"===t[0]&&(t=t.substring(1)),6===t.length||3===t.length?i[n]="#"+t:8===t.length&&(i[e+"-opacity"]=parseInt(t.substring(0,2),16)/255,i[n]="#"+t.substring(6,8)+t.substring(4,6)+t.substring(2,4)),i}function gt(t,e,i){const n={};return F(t,e,(t=>{n[i]=t})),n}function ht(t,e){return P(t,"color",(t=>ct(J(t),e)))}function ut(t){return P(t,"Icon",((t,e)=>(M(t,"href",(t=>{e.icon=t})),e)))}function dt(t){return Object.assign({},function(t){return P(t,"PolyStyle",((t,e)=>Object.assign(e,P(t,"color",(t=>ct(J(t),"fill"))),M(t,"fill",(t=>{if("0"===t)return{"fill-opacity":0}})),M(t,"outline",(t=>{if("0"===t)return{"stroke-opacity":0}})))))}(t),function(t){return P(t,"LineStyle",(t=>Object.assign(ht(t,"stroke"),gt(t,"width","stroke-width"))))}(t),function(t){return P(t,"LabelStyle",(t=>Object.assign(ht(t,"label"),gt(t,"scale","label-scale"))))}(t),function(t){return P(t,"IconStyle",(t=>Object.assign(ht(t,"icon"),gt(t,"scale","icon-scale"),gt(t,"heading","icon-heading"),P(t,"hotSpot",(t=>{const e=parseFloat(t.getAttribute("x")||""),i=parseFloat(t.getAttribute("y")||""),n=t.getAttribute("xunits")||"",s=t.getAttribute("yunits")||"";return isNaN(e)||isNaN(i)?{}:{"icon-offset":[e,i],"icon-offset-units":[n,s]}})),ut(t))))}(t))}const pt=t=>Number(t),mt={string:t=>t,int:pt,uint:pt,short:pt,ushort:pt,float:pt,double:pt,bool:t=>Boolean(t)};function It(t,e){return P(t,"ExtendedData",((t,i)=>{for(const e of T(t,"Data"))i[e.getAttribute("name")||""]=J(z(e,"value"));for(const n of T(t,"SimpleData")){const t=n.getAttribute("name")||"",s=e[t]||mt.string;i[t]=s(J(n))}return i}))}function Ct(t){const e=z(t,"description");for(const t of Array.from(e?.childNodes||[]))if(4===t.nodeType)return{description:{"@type":"html",value:J(t)}};return{}}function ft(t){return P(t,"TimeSpan",(t=>({timespan:{begin:J(z(t,"begin")),end:J(z(t,"end"))}})))}function At(t){return P(t,"TimeStamp",(t=>({timestamp:J(z(t,"when"))})))}function yt(t,e){return M(t,"styleUrl",(t=>(t=W(t),e[t]?Object.assign({styleUrl:t},e[t]):{styleUrl:t})))}const bt=/\s*/g,_t=/^\s*|\s*$/g,vt=/\s+/;function xt(t){return t.replace(bt,"").split(",").map(parseFloat).filter((t=>!isNaN(t))).slice(0,3)}function wt(t){return t.replace(_t,"").split(vt).map(xt).filter((t=>t.length>=2))}function St(t){let e=T(t,"coord");0===e.length&&(e=function(t,e,i){return Array.from(t.getElementsByTagNameNS(i,e))}(t,"coord","*"));const i=e.map((t=>J(t).split(" ").map(parseFloat)));return 0===i.length?null:{geometry:i.length>2?{type:"LineString",coordinates:i}:{type:"Point",coordinates:i[0]},times:T(t,"when").map((t=>J(t)))}}function kt(t){if(0===t.length)return t;const e=t[0],i=t[t.length-1];let n=!0;for(let t=0;t=2&&e.push({type:"Point",coordinates:t});break}case"LinearRing":case"LineString":{const t=wt(Zt(s));t.length>=2&&e.push({type:"LineString",coordinates:t});break}case"Polygon":{const t=[];for(const e of T(s,"LinearRing")){const i=kt(wt(Zt(e)));i.length>=4&&t.push(i)}t.length&&e.push({type:"Polygon",coordinates:t});break}case"Track":case"gx:Track":{const t=St(s);if(!t)break;const{times:n,geometry:r}=t;e.push(r),n.length&&i.push(n);break}}}return{geometries:e,coordTimes:i}}function Gt(t,e,i,n){const{coordTimes:s,geometries:r}=Bt(t),o=function(t){return 0===t.length?null:1===t.length?t[0]:{type:"GeometryCollection",geometries:t}}(r);if(!o&&n.skipNullGeometry)return null;const a={type:"Feature",geometry:o,properties:Object.assign(H(t,["name","address","visibility","open","phoneNumber","description"]),Ct(t),yt(t,e),dt(t),It(t,i),ft(t),At(t),s.length?{coordinateProperties:{times:1===s.length?s[0]:s}}:{})};void 0!==a.properties?.visibility&&(a.properties.visibility="0"!==a.properties.visibility);const l=t.getAttribute("id");return null!==l&&""!==l&&(a.id=l),a}function Rt(t){return z(t,"gx:LatLonQuad")?{geometry:{type:"Polygon",coordinates:[kt(wt(Zt(t)))]}}:function(t){const e=z(t,"LatLonBox");if(e){const t=F(e,"north"),i=F(e,"west"),n=F(e,"east"),s=F(e,"south"),r=F(e,"rotation");if("number"==typeof t&&"number"==typeof s&&"number"==typeof i&&"number"==typeof n){const e=[i,s,n,t];let o=[[[i,t],[n,t],[n,s],[i,s],[i,t]]];return"number"==typeof r&&(o=function(t,e,i){const n=[(t[0]+t[2])/2,(t[1]+t[3])/2];return[e[0].map((t=>{const e=t[1]-n[1],s=t[0]-n[0],r=Math.sqrt(Math.pow(e,2)+Math.pow(s,2)),o=Math.atan2(e,s)+i*Vt;return[n[0]+Math.cos(o)*r,n[1]+Math.sin(o)*r]}))]}(e,o,r)),{bbox:e,geometry:{type:"Polygon",coordinates:o}}}}return null}(t)}const Vt=Math.PI/180;function Tt(t,e,i,n){const s=Rt(t),r=s?.geometry||null;if(!r&&n.skipNullGeometry)return null;const o={type:"Feature",geometry:r,properties:Object.assign({"@geometry-type":"groundoverlay"},H(t,["name","address","visibility","open","phoneNumber","description"]),Ct(t),yt(t,e),dt(t),ut(t),It(t,i),ft(t),At(t))};s?.bbox&&(o.bbox=s.bbox),void 0!==o.properties?.visibility&&(o.properties.visibility="0"!==o.properties.visibility);const a=t.getAttribute("id");return null!==a&&""!==a&&(o.id=a),o}function Wt(t){let e=t.getAttribute("id");const i=t.parentNode;return!e&&L(i)&&"CascadingStyle"===i.localName&&(e=i.getAttribute("kml:id")||i.getAttribute("id")),W(e||"")}function Jt(t){const e={};for(const i of T(t,"Style"))e[Wt(i)]=dt(i);for(const i of T(t,"StyleMap")){const t=W(i.getAttribute("id")||"");M(i,"styleUrl",(i=>{i=W(i),e[i]&&(e[t]=e[i])}))}return e}function zt(t){const e={};for(const i of T(t,"SimpleField"))e[i.getAttribute("name")||""]=mt[i.getAttribute("type")||""]||mt.string;return e}const Pt=["name","visibility","open","address","description","phoneNumber","visibility"];function*Mt(t,e={skipNullGeometry:!1}){const i=Jt(t),n=zt(t);for(const s of T(t,"Placemark")){const t=Gt(s,i,n,e);t&&(yield t)}for(const s of T(t,"GroundOverlay")){const t=Tt(s,i,n,e);t&&(yield t)}}var Xt=Object.freeze({__proto__:null,gpx:function(t){return{type:"FeatureCollection",features:Array.from(tt(t))}},gpxGen:tt,kml:function(t,e={skipNullGeometry:!1}){return{type:"FeatureCollection",features:Array.from(Mt(t,e))}},kmlGen:Mt,kmlWithFolders:function(t,e={skipNullGeometry:!1}){const i=Jt(t),n=zt(t),s={type:"root",children:[]};return function t(e,s,r){if(L(e))switch(e.tagName){case"GroundOverlay":{const t=Tt(e,i,n,r);t&&s.children.push(t);break}case"Placemark":{const t=Gt(e,i,n,r);t&&s.children.push(t);break}case"Folder":{const t=function(t){const e={};for(const i of Array.from(t.childNodes))L(i)&&Pt.includes(i.tagName)&&(e[i.tagName]=J(i));return{type:"folder",meta:e,children:[]}}(e);s.children.push(t),s=t;break}}if(e.childNodes)for(let i=0;i=0?1:-1)}function n(t,e,n){var s=2*((t=i(t*n))-(e=i(e*n)));s<0&&(s=-s-1);for(var r="";s>=32;)r+=String.fromCharCode(63+(32|31&s)),s/=32;return r+String.fromCharCode(63+(0|s))}function s(t){for(var e=[],i=0;i=32);i=1&l?(-l-1)/2:l/2,a=1,l=0;do{l+=(31&(c=t.charCodeAt(n++)-63))*a,a*=32}while(c>=32);s+=i,r+=1&l?(-l-1)/2:l/2,o.push([s/g,r/g])}return o},e.encode=function(t,e){if(!t.length)return"";for(var i=Math.pow(10,Number.isInteger(e)?e:5),s=n(t[0][0],0,i)+n(t[0][1],0,i),r=1;r{const t=t=>t[0],e=t=>t[t.length-1],i=t=>t.join(","),n=(t,e,i)=>{let n=t[e];n?n.push(i):t[e]=[i]},s=(t,e,i)=>{let n=t[e],s=null;n&&(s=n.indexOf(i))>=0&&n.splice(s,1)},r=(t,e)=>{let i=t[e];return i&&i.length>0?i[0]:null},o=n=>n.length>3&&i(t(n))===i(e(n)),a=(t,e,i)=>{e=e||0,i=i||1;let n=t.reduce(((i,n,s)=>t[i][e]>n[e]?i:s),0),s=n<=0?t.length-2:n-1,r=n>=t.length-1?1:n+1,o=t[s][e],a=t[n][e],l=t[r][e],c=t[s][i],g=t[n][i];return(a-o)*(t[r][i]-c)-(l-o)*(g-c)<0?"clockwise":"counterclockwise"},l=t=>t instanceof Array?t.map(l):parseFloat(t);class c extends Map{constructor(){super(),this.binders=[]}add(t,e){this.has(t)||this.set(t,e)}addBinder(t){this.binders.push(t)}bindAll(){this.binders.forEach((t=>t.bind()))}}return{purgeProps:(t,e)=>{if(t){let i=Object.assign({},t);if(e)for(let t of e)delete i[t];return i}return{}},mergeProps:(t,e)=>(t=t||{},e=e||{},Object.assign(t,e)),first:t,last:e,coordsToKey:i,addToMap:n,removeFromMap:s,getFirstFromMap:r,isRing:o,ringDirection:a,ptInsidePolygon:(t,e,i,n)=>{i=i||0,n=n||1;let s=!1;for(let r=0,o=e.length-1;r=0){let i=[e,1];t&&i.push(t),[].splice.apply(this.container,i)}}else if("object"==typeof this.container){let e=Object.keys(this.container).find((t=>this.container[t]===this));e&&(t?this.container[e]=t:delete this.container[e])}}},WayCollection:class extends Array{constructor(){super(),this.firstMap={},this.lastMap={}}addWay(s){(s=s.toCoordsArray()).length>0&&(this.push(s),n(this.firstMap,i(t(s)),s),n(this.lastMap,i(e(s)),s))}toStrings(){let n=[],o=null;for(;o=this.shift();){s(this.firstMap,i(t(o)),o),s(this.lastMap,i(e(o)),o);let a=o,c=null;do{let n=i(e(a)),o=!1;c=r(this.firstMap,n),c||(c=r(this.lastMap,n),o=!0),c&&(this.splice(this.indexOf(c),1),s(this.firstMap,i(t(c)),c),s(this.lastMap,i(e(c)),c),o&&(c.length>a.length&&([a,c]=[c,a]),c.reverse()),a=a.concat(c.slice(1)))}while(c);n.push(l(a))}return n}toRings(t){let e=this.toStrings(),i=[],n=null;for(;n=e.shift();)o(n)&&(a(n)!==t&&n.reverse(),i.push(n));return i}}}})(),Lt={building:{},highway:{whitelist:["services","rest_area","escape","elevator"]},natural:{blacklist:["coastline","cliff","ridge","arete","tree_row"]},landuse:{},waterway:{whitelist:["riverbank","dock","boatyard","dam"]},amenity:{},leisure:{},barrier:{whitelist:["city_wall","ditch","hedge","retaining_wall","wall","spikes"]},railway:{whitelist:["station","turntable","roundhouse","platform"]},area:{},boundary:{},man_made:{blacklist:["cutline","embankment","pipeline"]},power:{whitelist:["plant","substation","generator","transformer"]},place:{},shop:{},aeroway:{blacklist:["taxiway"]},tourism:{},historic:{},public_transport:{},office:{},"building:part":{},military:{},ruins:{},"area:highway":{},craft:{},golf:{},indoor:{}},Et=(()=>{const{first:t,last:e,coordsToKey:i,addToMap:n,removeFromMap:s,getFirstFromMap:r,isRing:o,ringDirection:a,ptInsidePolygon:l,strToFloat:c,LateBinder:g,WayCollection:h}=Ht,u=Lt;class d{constructor(t,e,i){this.type=t,this.id=e,this.refElems=i,this.tags={},this.props={id:this.getCompositeId()},this.refCount=0,this.hasTag=!1,i&&i.add(this.getCompositeId(),this)}addTags(t){this.tags=Object.assign(this.tags,t),this.hasTag=!!t}addTag(t,e){this.tags[t]=e,this.hasTag=!!t}addProp(t,e){this.props[t]=e}addProps(t){this.props=Object.assign(this.props,t)}getCompositeId(){return`${this.type}/${this.id}`}getProps(){return Object.assign(this.props,this.tags)}toFeatureArray(){return[]}}class p extends d{constructor(t,e){super("node",t,e),this.latLng=null}setLatLng(t){this.latLng=t}toFeatureArray(){return this.latLng?[{type:"Feature",id:this.getCompositeId(),properties:this.getProps(),geometry:{type:"Point",coordinates:c([this.latLng.lon,this.latLng.lat])}}]:[]}getLatLng(){return this.latLng}}class m extends d{constructor(t,e){super("way",t,e),this.latLngArray=[],this.isPolygon=!1}addLatLng(t){this.latLngArray.push(t)}setLatLngArray(t){this.latLngArray=t}addNodeRef(t){let e=new g(this.latLngArray,(function(t){let e=this.refElems.get(`node/${t}`);if(e)return e.refCount++,e.getLatLng()}),this,[t]);this.latLngArray.push(e),this.refElems.addBinder(e)}analyzeGeometryType(t,e){let i=u[t];i&&(this.isPolygon=!0,i.whitelist?this.isPolygon=i.whitelist.indexOf(e)>=0:i.blacklist&&(this.isPolygon=!(i.blacklist.indexOf(e)>=0)))}addTags(t){super.addTags(t);for(let[e,i]of Object.entries(t))this.analyzeGeometryType(e,i)}addTag(t,e){super.addTag(t,e),this.analyzeGeometryType(t,e)}toCoordsArray(){return this.latLngArray.map((t=>[t.lon,t.lat]))}toFeatureArray(){let t=this.toCoordsArray();if(t.length>1){t=c(t);let e={type:"Feature",id:this.getCompositeId(),properties:this.getProps(),geometry:{type:"LineString",coordinates:t}};return this.isPolygon&&o(t)?("counterclockwise"!==a(t)&&t.reverse(),e.geometry={type:"Polygon",coordinates:[t]},[e]):[e]}return[]}}return{Node:p,Way:m,Relation:class extends d{constructor(t,e){super("relation",t,e),this.relations=[],this.nodes=[],this.bounds=null}setBounds(t){this.bounds=t}addMember(t){switch(t.type){case"relation":let e=new g(this.relations,(function(t){let e=this.refElems.get(`relation/${t}`);if(e)return e.refCount++,e}),this,[t.ref]);this.relations.push(e),this.refElems.addBinder(e);break;case"way":t.role||(t.role="");let i=this[t.role];if(i||(i=this[t.role]=[]),t.geometry){let e=new m(t.ref,this.refElems);e.setLatLngArray(t.geometry),e.refCount++,i.push(e)}else if(t.nodes){let e=new m(t.ref,this.refElems);for(let i of t.nodes)e.addNodeRef(i);e.refCount++,i.push(e)}else{let e=new g(i,(function(t){let e=this.refElems.get(`way/${t}`);if(e)return e.refCount++,e}),this,[t.ref]);i.push(e),this.refElems.addBinder(e)}break;case"node":let n=null;if(t.lat&&t.lon){n=new p(t.ref,this.refElems),n.setLatLng({lon:t.lon,lat:t.lat}),t.tags&&n.addTags(t.tags);for(let[e,i]of Object.entries(t))["id","type","lat","lon"].indexOf(e)<0&&n.addProp(e,i);n.refCount++,this.nodes.push(n)}else{let e=new g(this.nodes,(function(t){let e=this.refElems.get(`node/${t}`);if(e)return e.refCount++,e}),this,[t.ref]);this.nodes.push(e),this.refElems.addBinder(e)}}}toFeatureArray(){let e=[],i=[],n=[];const s=["outer","inner",""];for(let t of this.relations)if(t)for(let e of s){let i=t[e];if(i){let t=this[e];t?[].splice.apply(t,[t.length,0].concat(i)):this[e]=i}}for(let t of s){let e=this[t];if(e){this[t]=new h;for(let i of e)this[t].addWay(i)}}let r=null,o={type:"Feature",id:this.getCompositeId(),bbox:this.bounds,properties:this.getProps()};this.bounds||delete o.bbox,this.outer?(r=((e,i)=>{let n=e?e.toRings("counterclockwise"):[],s=i?i.toRings("clockwise"):[];if(n.length>0){let e=[],i=null;for(i of n)e.push([i]);for(;i=s.shift();)for(let s in n)if(l(t(i),n[s])){e[s].push(i);break}return 1===e.length?{type:"Polygon",coordinates:e[0]}:{type:"MultiPolygon",coordinates:e}}return null})(this.outer,this.inner),r&&(o.geometry=r,e.push(o))):this[""]&&(r=(t=>{let e=t?t.toStrings():[];return e.length>0?1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e}:null})(this[""]),r&&(o.geometry=r,i.push(o)));for(let t of this.nodes)n=n.concat(t.toFeatureArray());return e.concat(i).concat(n)}}}})(),Dt=(()=>{function t(t){return null!=t.match(/^(.+?)\[(.+?)\]>$/g)}function e(t){let e=/^(.+?)\[(.+?)\]>$/g.exec(t);return e?{evt:e[1]+">",exp:e[2]}:{evt:t}}return class{constructor(t){t&&(this.queryParent=!!t.queryParent,this.progressive=t.progressive,this.queryParent&&(this.parentMap=new WeakMap)),this.evtListeners={}}parse(t,e,i){i=i?i+".":"";let n=/<([^ >\/]+)(.*?)>/gm,s=null,r=[];for(;s=n.exec(t);){let o=s[1],a={$tag:o},l=i+o,c=s[2].trim(),g=!1;(c.endsWith("/")||o.startsWith("?")||o.startsWith("!"))&&(g=!0);let h=/([^ ]+?)="(.+?)"/g,u=/([^ ]+?)='(.+?)'/g,d=null,p=!1;for(;d=h.exec(c);)p=!0,a[d[1]]=d[2];if(!p)for(;d=u.exec(c);)p=!0,a[d[1]]=d[2];if(p||""===c||(a.text=c),this.progressive&&this.emit(`<${l}>`,a,e),!g){let e=new RegExp(`([^]+?)`,"g");e.lastIndex=n.lastIndex;let i=e.exec(t);if(i&&i[1]){n.lastIndex=e.lastIndex;let t=this.parse(i[1],a,l);t.length>0?a.$innerNodes=t:a.$innerText=i[1]}}this.queryParent&&e&&this.parentMap.set(a,e),this.progressive&&this.emit(``,a,e),r.push(a)}return r}getParent(t){return this.queryParent?this.parentMap.get(t):null}#t(t,e){let i=this.evtListeners[t];i?i.push(e):this.evtListeners[t]=[e]}addListener(i,n){t(i)&&(i=e(i),n.condition=function(t){let e="return "+t.replace(/(\$.+?)(?=[=!.])/g,"node.$&")+";";return new Function("node",e)}(i.exp),i=i.evt),this.#t(i,n)}#e(t,e){let i=this.evtListeners[t],n=null;i&&(n=i.indexOf(e))>=0&&i.splice(n,1)}removeListener(i,n){t(i)&&(i=(i=e(i)).evt),this.#e(i,n)}emit(t,...e){let i=this.evtListeners[t];if(i)for(let t of i)t.condition?!0===t.condition.apply(null,e)&&t.apply(null,e):t.apply(null,e)}on(t,e){this.addListener(t,e)}off(t,e){this.removeListener(t,e)}}})();const{Node:Yt,Way:Nt,Relation:Ot}=Et,{purgeProps:Ut,RefElements:jt}=Ht,Qt=Dt;var qt=(t,e)=>{let i=!1,n=!1,s=!0;(t=>{if(t){i=!(!t.completeFeature&&!t.allFeatures),n=!!t.renderTagged;let e=t.suppressWay||t.excludeWay;void 0===e||e||(s=!1)}})(e);let r=(t=>t.elements?"json":t.indexOf("=0?"xml":t.trim().startsWith("{")?"json-raw":"invalid")(t),o=new jt,a=[];"json-raw"===r&&(r=(t=JSON.parse(t)).elements?"json":"invalid"),"json"===r?(t=>{for(let e of t.elements)switch(e.type){case"node":let t=new Yt(e.id,o);e.tags&&t.addTags(e.tags),t.addProps(Ut(e,["id","type","tags","lat","lon"])),t.setLatLng(e);break;case"way":let i=new Nt(e.id,o);if(e.tags&&i.addTags(e.tags),i.addProps(Ut(e,["id","type","tags","nodes","geometry"])),e.nodes)for(let t of e.nodes)i.addNodeRef(t);else e.geometry&&i.setLatLngArray(e.geometry);break;case"relation":let n=new Ot(e.id,o);if(e.bounds&&n.setBounds([parseFloat(e.bounds.minlon),parseFloat(e.bounds.minlat),parseFloat(e.bounds.maxlon),parseFloat(e.bounds.maxlat)]),e.tags&&n.addTags(e.tags),n.addProps(Ut(e,["id","type","tags","bounds","members"])),e.members)for(let t of e.members)n.addMember(t)}})(t):"xml"===r&&(t=>{const e=new Qt({progressive:!0});e.on("",(t=>{let e=new Yt(t.id,o);for(let[i,n]of Object.entries(t))!i.startsWith("$")&&["id","lon","lat"].indexOf(i)<0&&e.addProp(i,n);if(e.setLatLng(t),t.$innerNodes)for(let i of t.$innerNodes)"tag"===i.$tag&&e.addTag(i.k,i.v)})),e.on("",(t=>{let e=new Nt(t.id,o);for(let[i,n]of Object.entries(t))!i.startsWith("$")&&["id"].indexOf(i)<0&&e.addProp(i,n);if(t.$innerNodes)for(let i of t.$innerNodes)"nd"===i.$tag?i.lon&&i.lat?e.addLatLng(i):i.ref&&e.addNodeRef(i.ref):"tag"===i.$tag&&e.addTag(i.k,i.v)})),e.on("",(t=>{new Ot(t.id,o)})),e.on("",((t,e)=>{let i=o.get(`relation/${e.id}`),n={type:t.type,role:t.role?t.role:"",ref:t.ref};if(t.lat&&t.lon){n.lat=t.lat,n.lon=t.lon,n.tags={};for(let[e,i]of Object.entries(t))!e.startsWith("$")&&["type","lat","lon"].indexOf(e)<0&&(n[e]=i)}if(t.$innerNodes){let e=[],i=[];for(let n of t.$innerNodes)n.lat&&n.lon?e.push(n):i.push(n.ref);e.length>0?n.geometry=e:i.length>0&&(n.nodes=i)}i.addMember(n)})),e.on("",((t,e)=>{o.get(`relation/${e.id}`).setBounds([parseFloat(t.minlon),parseFloat(t.minlat),parseFloat(t.maxlon),parseFloat(t.maxlat)])})),e.on("",((t,e)=>{o.get(`relation/${e.id}`).addTag(t.k,t.v)})),e.parse(t)})(t),o.bindAll();for(let t of o.values())if(t.refCount<=0||t.hasTag&&n&&!(t instanceof Nt&&s)){let e=t.toFeatureArray();if(t instanceof Ot&&!i&&e.length>0)return e[0].geometry;a=a.concat(e)}return{type:"FeatureCollection",features:a}},$t=e(qt);const te=["topojson","osm","kml","gpx","tcx","csv","tsv","polyline"];class ee{constructor(t,e,i={}){this.blankGeoJSON=()=>({type:"FeatureCollection",features:[]}),this._rawData=e,this._format=t,this._options=i;const n={topojson:this.loadTopoJson,osm:this.loadOsm,kml:this.loadXml,gpx:this.loadXml,tcx:this.loadXml,csv:this.loadCsv,tsv:this.loadCsv,polyline:this.loadPolyline};this._conversionFn=n[t]}async convert(){return this._conversionFn?this._conversionFn():new Promise(((t,e)=>e(`No converter exists for ${this._format}`)))}async loadXml(){return Xt[this._format]((new DOMParser).parseFromString(this._rawData,"text/xml"))}async loadCsv(){let t=this._options.csvOptions||{};return"tsv"===this._format&&(t.delimiter="\t"),await new Promise(((e,i)=>{G.csv2geojson(this._rawData,t,((t,n)=>{t?i(t):e(n)}))}))}async loadTopoJson(){let t={};try{t=JSON.parse(this._rawData)}catch(t){throw"Invalid TopoJson"}let e=this.blankGeoJSON();return"Topology"===t.type&&void 0!==t.objects&&(e={type:"FeatureCollection",features:e.features=Object.keys(t.objects).map((e=>{return i=t,"string"==typeof(n=e)&&(n=i.objects[n]),"GeometryCollection"===n.type?{type:"FeatureCollection",features:n.geometries.map((function(t){return V(i,t)}))}:V(i,n);var i,n})).reduce(((t,e)=>[...t,...e.features]),[])}),e}async loadOsm(){return $t(this._rawData)}async loadPolyline(){let t=this._options.polylineOptions||{};return await new Promise(((e,i)=>{try{const i=Kt.toGeoJSON(this._rawData,t.precision);let n=i;"point"===t.type?1===i.coordinates.length?n={type:"Point",coordinates:i.coordinates[0]}:console.warn("Cannot convert polyline to "+t.type):"polygon"===t.type&&(i.coordinates[0][0]===i.coordinates[i.coordinates.length-1][0]&&i.coordinates[0][1]===i.coordinates[i.coordinates.length-1][1]?n={type:"Polygon",coordinates:[i.coordinates]}:console.warn("Cannot convert polyline to "+t.type)),e({type:"FeatureCollection",features:[{type:"Feature",geometry:n,properties:t.properties||{}}]})}catch(t){i(t)}}))}}var ie=null;try{var ne=K.require("worker_threads")||"function"==typeof __non_webpack_require__&&__non_webpack_require__("worker_threads")||require("worker_threads");ie=ne.Worker}catch(t){}function se(t,e,i){var n=void 0===e?null:e,s=function(t,e){return Buffer.from(t,"base64").toString(e?"utf16":"utf8")}(t,void 0!==i&&i),r=s.indexOf("\n",10)+1,o=s.substring(r)+(n?"//# sourceMappingURL="+n:"");return function(t){return new ie(o,Object.assign({},t,{eval:!0}))}}function re(t,e,i){var n=void 0===e?null:e,s=function(t,e){var i=atob(t);if(e){for(var n=new Uint8Array(i.length),s=0,r=i.length;sMath.random().toString(36).substring(2);class ue{constructor(t,e){this.initId=he()+"-"+t,this.worker=new ge,this.handlers=new Map,this.worker.onmessage=e=>{const i=e.data,n=this.handlers.get(i.id),s=this;if(n){if("response"===i.type&&n.resolve(i.message),"error"===i.type){const e=i.error||new Error(`Unknown error with ${t}`);n.reject(e)}"init_response"===i.type&&(this._=Object.keys(i.message).map((t=>{const e="function"==typeof i.message[t];return[t,function(){return e?s.exec(t)(...arguments):s.get(t)}]})).reduce(((t,e)=>({...t,[e[0]]:e[1]})),{}),n.resolve(this._))}},this.worker.postMessage({type:"init",id:this.initId,command:t,message:e})}onLoad(){return new Promise((t=>{void 0===this._?this.handlers.set(this.initId,{resolve:t,reject:t}):t(this._)}))}exec(t){const e=this;return function(...i){return new Promise(((n,s)=>{const r=he()+"-"+t;e.handlers.set(r,{resolve:n,reject:s}),e.worker.postMessage({type:"exec",id:r,command:t,message:[...i]})}))}}get(t){return new Promise(((e,i)=>{const n=he()+"-"+t;this.handlers.set(n,{resolve:e,reject:i}),this.worker.postMessage({type:"get",id:n,command:t,message:[]})}))}}const de="test://http://example.com"!==new URL("test://http://example.com").href;async function pe(t,e,i){const n=await fetch(t,i?{signal:i.signal}:void 0);let s={};try{const e=new URL(t,window.location.href);if(e.hash.length){const i=e.hash,n=decodeURIComponent(i.slice(1));try{s=JSON.parse(n)}catch(t){console.warn("Error parsing or reading URL:",t)}}}finally{}if(200==n.status){const t=await n.text();let i;return i=["kml","tcx","gpx"].indexOf(e)>=0||!(()=>{let t=!1;try{t="function"==typeof window.Worker}catch(e){t=!1}return t})()?new ee(e,t,s).convert():new ue("Converter",[e,t,s]).exec("convert")(),await i}throw new Error(`Data fetch error: ${n.statusText}`)}const me=t=>{const e=t.split("://")[0],i=t.replace(new RegExp(`^${e}://`),""),n=de?(t=>{const e=new RegExp("^(https?)(//)");return t.replace(e,"$1:$2")})(i):i;return{prefix:e,url:n}},Ie=(t,e)=>e instanceof AbortController?(async(t,e)=>{const{prefix:i,url:n}=me(t.url);if(!n)throw new Error("Invalid URL: "+t.url);try{return{data:await pe(n,i,e)}}catch(t){throw new Error(t||"Unknown Error")}})(t,e):((t,e)=>{const i=new AbortController,{prefix:n,url:s}=me(t.url);return s&&pe(s,n,i).then((t=>e(null,t))).catch((t=>e(t))),{cancel:()=>{i.abort()}}})(t,e),Ce=te;t.VectorTextProtocol=Ie,t.addOptions=(t,e)=>{try{const i=new URL(t);return i.hash=`#${encodeURIComponent(JSON.stringify(e))}`,i.toString()}catch(e){return console.error("Error parsing or updating URL:",e),t}},t.addProtocols=t=>{te.forEach((e=>{t.addProtocol(e,Ie)}))},t.vectorFormats=Ce}(H.exports);var L=x(H.exports);const E={expires:182};class D{map;dummyContainer;query=new URLSearchParams(window.location.search);constructor(){L.addProtocols(k);let t=+(F.get("latitude")||40),e=+(F.get("longitude")||-96),i=+(F.get("zoom")||5);this.map=new S.Map({container:"map",style:this.getStyleQuery(),center:new S.LngLat(e,t),zoom:i,hash:!0,failIfMajorPerformanceCaveat:!0,dragRotate:!1,attributionControl:!1}),this.map.addControl(new k.AttributionControl({customAttribution:"maplibre"})),this.map.addControl(this),this.map.addControl(new S.NavigationControl),this.map.addControl(new S.ScaleControl({})),this.map.addControl(new S.GeolocateControl({positionOptions:{enableHighAccuracy:!0},trackUserLocation:!0}));const n=new P(this);this.map.addControl(n),this.map.addControl(new M(n)),this.map.scrollZoom.setWheelZoomRate(4/450),this.map.on("load",(t=>this.map.resize()))}onAdd(t){return this.dummyContainer=document.createElement("div"),this.addMoveListener(),this.addClickListeners(),this.dummyContainer}onRemove(t){this.dummyContainer.parentNode.removeChild(this.dummyContainer)}addMoveListener(){this.map.on("moveend",(()=>this.checkMove())),this.checkMove(),this.map.on("zoom",(()=>this.checkZoom())),this.checkZoom()}checkZoom(){let t=this.map.getZoom()>=12;document.getElementById("footLegend").style.opacity=(t?1:0).toString()}checkMove(){if(this.map.isMoving())return;let t=this.map.getCenter().lat,e=this.map.getCenter().lng,i=this.map.getZoom();F.set("latitude",t.toString(),E),F.set("longitude",e.toString(),E),F.set("zoom",i.toString(),E)}addClickListeners(){this.map.on("mouseup",(t=>{t.originalEvent.shiftKey&&alert(`point: ${_(t.lngLat,4)}`)}))}getStyleQuery(){let t=F.get("style")||null,e=this.query.has("style")?`style-${this.query.get("style")}.json`:t;return null!=e&&F.set("style",e,E),""+(null!=e?e:"style.json")}getButtonsQuery(){let t=F.get("buttons")||null,e=this.query.has("buttons")?this.query.get("buttons"):t;return null!=e&&F.set("buttons",e,E),null!=e?e:"buttons.json"}openOsmEdit(){window.open(z.formatUrl(this.map,"https://www.openstreetmap.org/edit#map={z1}/{latitude}/{longitude}"))}}const Y=new D;window.mainControl=Y;export{D as MainControl,Y as mainControl}; diff --git a/index.html b/index.html index ec04b22..e9f0d02 100644 --- a/index.html +++ b/index.html @@ -184,7 +184,7 @@
  • if you notice a problem, please edit osm
  • "surface" is how we know what is unpaved
  • -
  • changes to osm take two weeks to propagate
  • +
  • changes to osm take months to propagate
  • thanks to the many projects that this site depends on.

    @@ -197,12 +197,14 @@
  • maptiler tile server
  • postgresql & postgis
  • wikidata
  • -
  • project osrm
  • + +
  • mapbox satellite & routing
  • natural earth
  • osmborder
  • omniscale
  • -
  • maplibre
  • +
  • maplibre & maplibre-directions
  • +
  • maplibre-gl vector-text-protocol
  • national weather service advanced hydrologic prediction service
  • maputnik
  • docker / ubuntu / gnu / linux
  • diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..64356fe --- /dev/null +++ b/install.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +set -e #exit on failure + +./npm.sh install "$@" + diff --git a/npm.sh b/npm.sh new file mode 100755 index 0000000..a045a55 --- /dev/null +++ b/npm.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +set -e #exit on failure + +docker run --user=$(id --user):$(id --group) --rm --volume=.:/home --workdir=/home -it node:22 npm "$@" + diff --git a/package-lock.json b/package-lock.json index 1d2e6dc..9474d74 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,23 +6,23 @@ "": { "name": "cyclemaps", "dependencies": { - "@maplibre/maplibre-gl-directions": "^0.6.1", + "@maplibre/maplibre-gl-directions": "^0.7.0", "@types/geojson": "^7946.0.13", "@types/js-cookie": "^3.0.6", "build": "^0.1.4", "js-cookie": "^3.0.5", - "maplibre-gl": "^3.6.2", - "maplibre-gl-vector-text-protocol": "github:jimmyrocks/maplibre-gl-vector-text-protocol#d71ae363b1d6ee2c0bd9bf58fde8008707dd8df3" + "maplibre-gl": "^4.5.0", + "maplibre-gl-vector-text-protocol": "github:jimmyrocks/maplibre-gl-vector-text-protocol#e514aa41ea1a3c03970c8fba7544a3d23a79d84b" }, "devDependencies": { - "@rollup/plugin-commonjs": "^25.0.7", + "@rollup/plugin-commonjs": "^26.0.1", "@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-strip": "^3.0.4", "@rollup/plugin-terser": "^0.4.4", "@types/node": "^20.11.26", "dotenv": "^16.4.5", - "rollup": "^3.29.4", - "rollup-plugin-dotenv": "^0.5.0", + "rollup": "^4.13.0", + "rollup-plugin-dotenv": "^0.5.1", "rollup-plugin-import-css": "^3.4.0", "tslib": "^2.6.2", "typescript": "^5.3.3" @@ -32,33 +32,34 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.23.5", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz", - "integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", + "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==", "dependencies": { - "@babel/highlight": "^7.23.4", - "chalk": "^2.4.2" + "@babel/highlight": "^7.24.7", + "picocolors": "^1.0.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", - "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", + "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { - "version": "7.23.4", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz", - "integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz", + "integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==", "dependencies": { - "@babel/helper-validator-identifier": "^7.22.20", + "@babel/helper-validator-identifier": "^7.24.7", "chalk": "^2.4.2", - "js-tokens": "^4.0.0" + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" }, "engines": { "node": ">=6.9.0" @@ -82,6 +83,23 @@ "kuler": "^2.0.0" } }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.5", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", @@ -165,6 +183,17 @@ "resolved": "https://registry.npmjs.org/@mapbox/point-geometry/-/point-geometry-0.1.0.tgz", "integrity": "sha512-6j56HdLTwWGO0fJPlrZtdU/B13q8Uwmo18Ck2GnGgN9PCFyKTZ3UbXeEdRFh18i9XQ92eH2VdtpJHpBD3aripQ==" }, + "node_modules/@mapbox/polyline": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@mapbox/polyline/-/polyline-1.2.1.tgz", + "integrity": "sha512-sn0V18O3OzW4RCcPoUIVDWvEGQaBNH9a0y5lgqrf5hUycyw1CzrhEoxV5irzrMNXKCkw1xRsZXcaVbsVZggHXA==", + "dependencies": { + "meow": "^9.0.0" + }, + "bin": { + "polyline": "bin/polyline.bin.js" + } + }, "node_modules/@mapbox/sexagesimal": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@mapbox/sexagesimal/-/sexagesimal-1.2.0.tgz", @@ -203,28 +232,30 @@ } }, "node_modules/@maplibre/maplibre-gl-directions": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-directions/-/maplibre-gl-directions-0.6.1.tgz", - "integrity": "sha512-pRiWnnXAJ2I5dhHgQZHUot/uu3Jcaa8SIMe7Slqf8lTvQc25dM6aZEwe7nxgYKbYaOw+D0pXMaZ8liAZDL8sFw==", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-directions/-/maplibre-gl-directions-0.7.0.tgz", + "integrity": "sha512-3mU+uy0BlqaSk+sCc1pzN/qHkkHswDdMH7VTrvDqU4m1/LKY0GqB4HXrlUIzm2VGsn6Y+/f2AHxBXw5Ogewrng==", "dependencies": { "@placemarkio/polyline": "^1.2.0", - "nanoid": "^5.0.4" + "nanoid": "^5.0.6" }, "peerDependencies": { - "maplibre-gl": "^3.0.0" + "maplibre-gl": "^4.0.0" } }, "node_modules/@maplibre/maplibre-gl-style-spec": { - "version": "19.3.3", - "resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-style-spec/-/maplibre-gl-style-spec-19.3.3.tgz", - "integrity": "sha512-cOZZOVhDSulgK0meTsTkmNXb1ahVvmTmWmfx9gRBwc6hq98wS9JP35ESIoNq3xqEan+UN+gn8187Z6E4NKhLsw==", + "version": "20.3.0", + "resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-style-spec/-/maplibre-gl-style-spec-20.3.0.tgz", + "integrity": "sha512-eSiQ3E5LUSxAOY9ABXGyfNhout2iEa6mUxKeaQ9nJ8NL1NuaQYU7zKqzx/LEYcXe1neT4uYAgM1wYZj3fTSXtA==", "dependencies": { "@mapbox/jsonlint-lines-primitives": "~2.0.2", "@mapbox/unitbezier": "^0.0.1", - "json-stringify-pretty-compact": "^3.0.0", + "json-stringify-pretty-compact": "^4.0.0", "minimist": "^1.2.8", + "quickselect": "^2.0.0", "rw": "^1.3.3", - "sort-object": "^3.0.3" + "sort-object": "^3.0.3", + "tinyqueue": "^2.0.3" }, "bin": { "gl-style-format": "dist/gl-style-format.mjs", @@ -232,6 +263,16 @@ "gl-style-validate": "dist/gl-style-validate.mjs" } }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "optional": true, + "engines": { + "node": ">=14" + } + }, "node_modules/@placemarkio/polyline": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@placemarkio/polyline/-/polyline-1.2.0.tgz", @@ -244,20 +285,20 @@ } }, "node_modules/@rollup/plugin-commonjs": { - "version": "25.0.7", - "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-25.0.7.tgz", - "integrity": "sha512-nEvcR+LRjEjsaSsc4x3XZfCCvZIaSMenZu/OiwOKGN2UhQpAYI7ru7czFvyWbErlpoGjnSX3D5Ch5FcMA3kRWQ==", + "version": "26.0.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-26.0.1.tgz", + "integrity": "sha512-UnsKoZK6/aGIH6AdkptXhNvhaqftcjq3zZdT+LY5Ftms6JR06nADcDsYp5hTU9E2lbJUEOhdlY5J4DNTneM+jQ==", "dev": true, "dependencies": { "@rollup/pluginutils": "^5.0.1", "commondir": "^1.0.1", "estree-walker": "^2.0.2", - "glob": "^8.0.3", + "glob": "^10.4.1", "is-reference": "1.2.1", "magic-string": "^0.30.3" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0 || 14 >= 14.17" }, "peerDependencies": { "rollup": "^2.68.0||^3.0.0||^4.0.0" @@ -294,9 +335,9 @@ } }, "node_modules/@rollup/plugin-replace": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/@rollup/plugin-replace/-/plugin-replace-5.0.5.tgz", - "integrity": "sha512-rYO4fOi8lMaTg/z5Jb+hKnrHHVn8j2lwkqwyS4kTRhKyWOLf2wST2sWXr4WzWiTcoHTp2sTjqUbqIj2E39slKQ==", + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/@rollup/plugin-replace/-/plugin-replace-5.0.7.tgz", + "integrity": "sha512-PqxSfuorkHz/SPpyngLyg5GCEkOcee9M1bkxiVDr41Pd61mqP1PLOoDPbpl44SB2mQGKwV/In74gqQmGITOhEQ==", "dev": true, "dependencies": { "@rollup/pluginutils": "^5.0.1", @@ -380,10 +421,221 @@ } } }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.18.0.tgz", + "integrity": "sha512-Tya6xypR10giZV1XzxmH5wr25VcZSncG0pZIjfePT0OVBvqNEurzValetGNarVrGiq66EBVAFn15iYX4w6FKgQ==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.18.0.tgz", + "integrity": "sha512-avCea0RAP03lTsDhEyfy+hpfr85KfyTctMADqHVhLAF3MlIkq83CP8UfAHUssgXTYd+6er6PaAhx/QGv4L1EiA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.18.0.tgz", + "integrity": "sha512-IWfdwU7KDSm07Ty0PuA/W2JYoZ4iTj3TUQjkVsO/6U+4I1jN5lcR71ZEvRh52sDOERdnNhhHU57UITXz5jC1/w==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.18.0.tgz", + "integrity": "sha512-n2LMsUz7Ynu7DoQrSQkBf8iNrjOGyPLrdSg802vk6XT3FtsgX6JbE8IHRvposskFm9SNxzkLYGSq9QdpLYpRNA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.18.0.tgz", + "integrity": "sha512-C/zbRYRXFjWvz9Z4haRxcTdnkPt1BtCkz+7RtBSuNmKzMzp3ZxdM28Mpccn6pt28/UWUCTXa+b0Mx1k3g6NOMA==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.18.0.tgz", + "integrity": "sha512-l3m9ewPgjQSXrUMHg93vt0hYCGnrMOcUpTz6FLtbwljo2HluS4zTXFy2571YQbisTnfTKPZ01u/ukJdQTLGh9A==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.18.0.tgz", + "integrity": "sha512-rJ5D47d8WD7J+7STKdCUAgmQk49xuFrRi9pZkWoRD1UeSMakbcepWXPF8ycChBoAqs1pb2wzvbY6Q33WmN2ftw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.18.0.tgz", + "integrity": "sha512-be6Yx37b24ZwxQ+wOQXXLZqpq4jTckJhtGlWGZs68TgdKXJgw54lUUoFYrg6Zs/kjzAQwEwYbp8JxZVzZLRepQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.18.0.tgz", + "integrity": "sha512-hNVMQK+qrA9Todu9+wqrXOHxFiD5YmdEi3paj6vP02Kx1hjd2LLYR2eaN7DsEshg09+9uzWi2W18MJDlG0cxJA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.18.0.tgz", + "integrity": "sha512-ROCM7i+m1NfdrsmvwSzoxp9HFtmKGHEqu5NNDiZWQtXLA8S5HBCkVvKAxJ8U+CVctHwV2Gb5VUaK7UAkzhDjlg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.18.0.tgz", + "integrity": "sha512-0UyyRHyDN42QL+NbqevXIIUnKA47A+45WyasO+y2bGJ1mhQrfrtXUpTxCOrfxCR4esV3/RLYyucGVPiUsO8xjg==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.18.0.tgz", + "integrity": "sha512-xuglR2rBVHA5UsI8h8UbX4VJ470PtGCf5Vpswh7p2ukaqBGFTnsfzxUBetoWBWymHMxbIG0Cmx7Y9qDZzr648w==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.18.0.tgz", + "integrity": "sha512-LKaqQL9osY/ir2geuLVvRRs+utWUNilzdE90TpyoX0eNqPzWjRm14oMEE+YLve4k/NAqCdPkGYDaDF5Sw+xBfg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.18.0.tgz", + "integrity": "sha512-7J6TkZQFGo9qBKH0pk2cEVSRhJbL6MtfWxth7Y5YmZs57Pi+4x6c2dStAUvaQkHQLnEQv1jzBUW43GvZW8OFqA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.18.0.tgz", + "integrity": "sha512-Txjh+IxBPbkUB9+SXZMpv+b/vnTEtFyfWZgJ6iyCmt2tdx0OF5WhFowLmnh8ENGNpfUlUZkdI//4IEmhwPieNg==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.18.0.tgz", + "integrity": "sha512-UOo5FdvOL0+eIVTgS4tIdbW+TtnBLWg1YBCcU2KWM7nuNwRz9bksDX1bekJJCpu25N1DVWaCwnT39dVQxzqS8g==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@tmcw/togeojson": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@tmcw/togeojson/-/togeojson-5.6.1.tgz", - "integrity": "sha512-0mIy/HrnUtwyEIPYpqp065vKsaTuRe2eACySH+s2JW+15T98azj9UoP9A4ylbolpzLLBajf1kadJIVhWQG8Qug==", + "version": "5.8.1", + "resolved": "https://registry.npmjs.org/@tmcw/togeojson/-/togeojson-5.8.1.tgz", + "integrity": "sha512-2YNrbis3l5kS0XrYwiHEZcGwiRp0MJ5CvwGwtMWp2z2tsVlskeec2qgvKHnF0RCwI5GnjrrBOoKsWfndEnd3LA==", + "engines": { + "node": "*" + }, "peerDependencies": { "@types/geojson": "*" } @@ -399,11 +651,24 @@ "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.14.tgz", "integrity": "sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg==" }, + "node_modules/@types/geojson-vt": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/@types/geojson-vt/-/geojson-vt-3.2.5.tgz", + "integrity": "sha512-qDO7wqtprzlpe8FfQ//ClPV9xiuoh2nkIgiouIptON9w5jvD/fA4szvP9GBlDVdJ5dldAl0kX/sy3URbWwLx0g==", + "dependencies": { + "@types/geojson": "*" + } + }, "node_modules/@types/js-cookie": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/@types/js-cookie/-/js-cookie-3.0.6.tgz", "integrity": "sha512-wkw9yd1kEXOPnvEeEV1Go1MmxtBJL0RR79aOTAApecWFVu7w0NNXNqhcWgvw2YgZDYadliXkl14pa3WXw5jlCQ==" }, + "node_modules/@types/junit-report-builder": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/junit-report-builder/-/junit-report-builder-3.0.2.tgz", + "integrity": "sha512-R5M+SYhMbwBeQcNXYWNCZkl09vkVfAtcPIaCGdzIkkbeaTrVbGQ7HVgi4s+EmM/M1K4ZuWQH0jGcvMvNePfxYA==" + }, "node_modules/@types/mapbox__point-geometry": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/@types/mapbox__point-geometry/-/mapbox__point-geometry-0.1.4.tgz", @@ -425,9 +690,9 @@ "integrity": "sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==" }, "node_modules/@types/node": { - "version": "20.11.26", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.26.tgz", - "integrity": "sha512-YwOMmyhNnAWijOBQweOJnQPl068Oqd4K3OFbTc6AHJwzweUwwWG3GIFY74OKks2PJUDkQPeddOQES9mLn1CTEQ==", + "version": "20.14.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.9.tgz", + "integrity": "sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -463,9 +728,9 @@ "integrity": "sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==" }, "node_modules/acorn": { - "version": "8.11.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", - "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.0.tgz", + "integrity": "sha512-RTvkC4w+KNXrM39/lWCUaG0IbRkWdCv7W/IOW9oU6SawyxulvkQy5HQPVTKxEjczcUvapcrw3cFx/60VN/NRNw==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -474,6 +739,18 @@ "node": ">=0.4.0" } }, + "node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, "node_modules/ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -690,6 +967,20 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/cssmin": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/cssmin/-/cssmin-0.3.2.tgz", @@ -786,6 +1077,18 @@ "resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.4.tgz", "integrity": "sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ==" }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, + "node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, "node_modules/enabled": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/enabled/-/enabled-2.0.0.tgz", @@ -846,11 +1149,21 @@ "resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz", "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==" }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true + "node_modules/foreground-child": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.2.1.tgz", + "integrity": "sha512-PXUUyLqrR2XCWICfv6ukppP96sdFwWbNEnfEMt7jNsISjMsvaLNinAHNDYyvkyU+SZG2BTSbT5NjG+vZslfGTA==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } }, "node_modules/fsevents": { "version": "2.3.3", @@ -875,9 +1188,9 @@ } }, "node_modules/geojson-vt": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/geojson-vt/-/geojson-vt-3.2.1.tgz", - "integrity": "sha512-EvGQQi/zPrDA6zr6BnJD/YhwAkBP8nnJ9emh3EnHQKVMfg/MRVtPbMYdgVy/IaEmn4UfagD2a6fafPDL5hbtwg==" + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/geojson-vt/-/geojson-vt-4.0.2.tgz", + "integrity": "sha512-AV9ROqlNqoZEIJGfm1ncNjEXfkz2hdFlZf0qkVfmkwdKa8vj7H16YUOT81rJw1rdFhyEDlN2Tds91p/glzbl5A==" }, "node_modules/get-stream": { "version": "6.0.1", @@ -904,19 +1217,23 @@ "integrity": "sha512-wcCp8vu8FT22BnvKVPjXa/ICBWRq/zjFfdofZy1WSpQZpphblv12/bOQLBC1rMM7SGOFS9ltVmKOHil5+Ml7gA==" }, "node_modules/glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.2.tgz", + "integrity": "sha512-GwMlUF6PkPo3Gk21UxkCohOv0PLcIXVtKyLlpEI28R/cO/4eNOdmLk3CMW1wROV/WR/EsZOWAfBbBOqYvs88/w==", "dev": true, "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" }, "engines": { - "node": ">=12" + "node": ">=16 || 14 >=14.18" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -935,6 +1252,17 @@ "node": ">=6" } }, + "node_modules/global-prefix/node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, "node_modules/hard-rejection": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", @@ -1000,16 +1328,6 @@ "node": ">=8" } }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", @@ -1041,11 +1359,14 @@ } }, "node_modules/is-core-module": { - "version": "2.13.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", - "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.14.0.tgz", + "integrity": "sha512-a5dFJih5ZLYlRtDc0dZWP7RiKr6xIKzmn/oAYCDvdLThadVgyJwlaoQPmRtMSpz+rk0OGAgIu+TcM9HUF0fk1A==", "dependencies": { - "hasown": "^2.0.0" + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -1059,6 +1380,15 @@ "node": ">=0.10.0" } }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/is-module": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", @@ -1122,6 +1452,24 @@ "node": ">=0.10.0" } }, + "node_modules/jackspeak": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.0.tgz", + "integrity": "sha512-JVYhQnN59LVPFCEcVa2C3CrEKYacvjRfqIQl+h8oi91aLYQVWRYbxjPcv1bUiUy/kLmQaANrYfNMCO3kuEDHfw==", + "dev": true, + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, "node_modules/js-cookie": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.5.tgz", @@ -1160,9 +1508,9 @@ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" }, "node_modules/json-stringify-pretty-compact": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/json-stringify-pretty-compact/-/json-stringify-pretty-compact-3.0.0.tgz", - "integrity": "sha512-Rc2suX5meI0S3bfdZuA7JMFBGkJ875ApfVyq2WHELjBiiG22My/l7/8zPpH/CfFVQHuVLd8NLR0nv6vi0BYYKA==" + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/json-stringify-pretty-compact/-/json-stringify-pretty-compact-4.0.0.tgz", + "integrity": "sha512-3CNZ2DnrpByG9Nqj6Xo8vqbjT4F6N+tb4Gb28ESAZjYZ5yqvmc56J+/kuIwkaAMOyblTQhUW7PxMkUb8Q36N3Q==" }, "node_modules/jxLoader": { "version": "0.1.1", @@ -1240,15 +1588,12 @@ } }, "node_modules/magic-string": { - "version": "0.30.8", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.8.tgz", - "integrity": "sha512-ISQTe55T2ao7XtlAStud6qwYPZjE4GK1S/BeVPus4jrq6JuOnQ00YKQC581RWhR122W7msZV263KzVeLoqidyQ==", + "version": "0.30.10", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.10.tgz", + "integrity": "sha512-iIRwTIf0QKV3UAnYK4PU8uiEc4SRh5jX0mwpIwETPpHdhVM4f53RSwS/vXvN1JhGX+Cs7B8qIq3d6AH49O5fAQ==", "dev": true, "dependencies": { "@jridgewell/sourcemap-codec": "^1.4.15" - }, - "engines": { - "node": ">=12" } }, "node_modules/makeerror": { @@ -1271,9 +1616,9 @@ } }, "node_modules/maplibre-gl": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-3.6.2.tgz", - "integrity": "sha512-krg2KFIdOpLPngONDhP6ixCoWl5kbdMINP0moMSJFVX7wX1Clm2M9hlNKXS8vBGlVWwR5R3ZfI6IPrYz7c+aCQ==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-4.5.0.tgz", + "integrity": "sha512-qOS1hn4d/pn2i0uva4S5Oz+fACzTkgBKq+NpwT/Tqzi4MSyzcWNtDELzLUSgWqHfNIkGCl5CZ/w7dtis+t4RCw==", "dependencies": { "@mapbox/geojson-rewind": "^0.5.2", "@mapbox/jsonlint-lines-primitives": "^2.0.2", @@ -1282,14 +1627,16 @@ "@mapbox/unitbezier": "^0.0.1", "@mapbox/vector-tile": "^1.3.1", "@mapbox/whoots-js": "^3.1.0", - "@maplibre/maplibre-gl-style-spec": "^19.3.3", - "@types/geojson": "^7946.0.13", + "@maplibre/maplibre-gl-style-spec": "^20.3.0", + "@types/geojson": "^7946.0.14", + "@types/geojson-vt": "3.2.5", + "@types/junit-report-builder": "^3.0.2", "@types/mapbox__point-geometry": "^0.1.4", "@types/mapbox__vector-tile": "^1.3.4", "@types/pbf": "^3.0.5", "@types/supercluster": "^7.1.3", "earcut": "^2.2.4", - "geojson-vt": "^3.2.1", + "geojson-vt": "^4.0.2", "gl-matrix": "^3.4.3", "global-prefix": "^3.0.0", "kdbush": "^4.0.2", @@ -1310,14 +1657,15 @@ } }, "node_modules/maplibre-gl-vector-text-protocol": { - "version": "0.0.2", - "resolved": "git+ssh://git@github.com/jimmyrocks/maplibre-gl-vector-text-protocol.git#d71ae363b1d6ee2c0bd9bf58fde8008707dd8df3", - "integrity": "sha512-TZI2Qwt04ED0TFESXiW/dSihyYRB2sstcJD+mDDJynogkATOF6bVh0uxRRfmO5IaTP0e+2/rLFAtjbNYXo2xFA==", + "version": "0.0.4", + "resolved": "git+ssh://git@github.com/jimmyrocks/maplibre-gl-vector-text-protocol.git#e514aa41ea1a3c03970c8fba7544a3d23a79d84b", + "integrity": "sha512-bMhyCie1KghcMVqXN0ySaek4/FdbMKT2zgPq0ViwNo3bLt49904bCCFiNLZcXjlNZpmflqcHulhQNUAnYmONzw==", "license": "MIT", "dependencies": { - "@tmcw/togeojson": "5.6.1", + "@mapbox/polyline": "^1.2.1", + "@tmcw/togeojson": "5.8.1", "csv2geojson": "^5.1.2", - "osm2geojson-lite": "^0.9.2", + "osm2geojson-lite": "^0.9.4", "topojson-client": "^3.1.0" } }, @@ -1355,15 +1703,18 @@ } }, "node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dev": true, "dependencies": { "brace-expansion": "^2.0.1" }, "engines": { - "node": ">=10" + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/minimist": { @@ -1387,6 +1738,15 @@ "node": ">= 6" } }, + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "dev": true, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, "node_modules/moo-server": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/moo-server/-/moo-server-1.3.0.tgz", @@ -1406,9 +1766,9 @@ "integrity": "sha512-TvmkNhkv8yct0SVBSy+o8wYzXjE4Zz3PCesbfs8HiCXXdcTuocApFv11UWlNFWKYsP2okqrhb7JNlSm9InBhIw==" }, "node_modules/nanoid": { - "version": "5.0.6", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.0.6.tgz", - "integrity": "sha512-rRq0eMHoGZxlvaFOUdK1Ev83Bd1IgzzR+WJ3IbDJ7QOSdAxYjlurSPqFs9s4lJg29RT6nPwizFtJhQS6V5xgiA==", + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.0.7.tgz", + "integrity": "sha512-oLxFY2gd2IqnjcYyOXD8XGCftpGtZP2AbHbOkthDkvRywH5ayNtPVy9YlOPcHckXzbLTCHpkb7FB+yuxKV13pQ==", "funding": [ { "type": "github", @@ -1436,15 +1796,6 @@ "node": ">=10" } }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "dependencies": { - "wrappy": "1" - } - }, "node_modules/one-time": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/one-time/-/one-time-1.0.0.tgz", @@ -1503,6 +1854,12 @@ "node": ">=6" } }, + "node_modules/package-json-from-dist": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", + "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==", + "dev": true + }, "node_modules/parse-json": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", @@ -1528,11 +1885,45 @@ "node": ">=8" } }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/path-parse": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, + "node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "dev": true, + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-scurry/node_modules/lru-cache": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.3.0.tgz", + "integrity": "sha512-CQl19J/g+Hbjbv4Y3mFNNXFEL/5t/KCg8POCuUqd4rMKjGG+j1ybER83hxV58zL+dFI1PTkt3GNFSHRt+d8qEQ==", + "dev": true, + "engines": { + "node": "14 || >=16.14" + } + }, "node_modules/pbf": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/pbf/-/pbf-3.2.1.tgz", @@ -1545,6 +1936,11 @@ "pbf": "bin/pbf" } }, + "node_modules/picocolors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", + "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==" + }, "node_modules/picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", @@ -1719,25 +2115,44 @@ } }, "node_modules/rollup": { - "version": "3.29.4", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz", - "integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==", + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.18.0.tgz", + "integrity": "sha512-QmJz14PX3rzbJCN1SG4Xe/bAAX2a6NpCP8ab2vfu2GiUr8AQcr2nCV/oEO3yneFarB67zk8ShlIyWb2LGTb3Sg==", "dev": true, + "dependencies": { + "@types/estree": "1.0.5" + }, "bin": { "rollup": "dist/bin/rollup" }, "engines": { - "node": ">=14.18.0", + "node": ">=18.0.0", "npm": ">=8.0.0" }, "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.18.0", + "@rollup/rollup-android-arm64": "4.18.0", + "@rollup/rollup-darwin-arm64": "4.18.0", + "@rollup/rollup-darwin-x64": "4.18.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.18.0", + "@rollup/rollup-linux-arm-musleabihf": "4.18.0", + "@rollup/rollup-linux-arm64-gnu": "4.18.0", + "@rollup/rollup-linux-arm64-musl": "4.18.0", + "@rollup/rollup-linux-powerpc64le-gnu": "4.18.0", + "@rollup/rollup-linux-riscv64-gnu": "4.18.0", + "@rollup/rollup-linux-s390x-gnu": "4.18.0", + "@rollup/rollup-linux-x64-gnu": "4.18.0", + "@rollup/rollup-linux-x64-musl": "4.18.0", + "@rollup/rollup-win32-arm64-msvc": "4.18.0", + "@rollup/rollup-win32-ia32-msvc": "4.18.0", + "@rollup/rollup-win32-x64-msvc": "4.18.0", "fsevents": "~2.3.2" } }, "node_modules/rollup-plugin-dotenv": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/rollup-plugin-dotenv/-/rollup-plugin-dotenv-0.5.0.tgz", - "integrity": "sha512-M2gZqEZebtcKaA7OBdO4UF3WmkI02wVD6UVwoxFlRKoq4/n1Q9Cw6UV8dPvVZYpGQ+ug2JPoogrCLaydIKU96A==", + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/rollup-plugin-dotenv/-/rollup-plugin-dotenv-0.5.1.tgz", + "integrity": "sha512-ARUPDmeKAw3niZ2Ajv0qKNRryIWFMW796oJSS1hNdop3HF63Vljio/QRmG6ob0aQzzVUrFq6vW1p4jOE6xDQrQ==", "dev": true, "dependencies": { "@rollup/plugin-replace": "^5.0.1", @@ -1747,7 +2162,7 @@ "node": ">=14" }, "peerDependencies": { - "rollup": "^1.20.0 || ^2.0.0 || ^3.0.0" + "rollup": "^1.20.0 || ^2.0.0 || ^3.0.0 || ^4.0.0" } }, "node_modules/rollup-plugin-import-css": { @@ -1798,12 +2213,9 @@ } }, "node_modules/semver": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", - "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", - "dependencies": { - "lru-cache": "^6.0.0" - }, + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", "bin": { "semver": "bin/semver.js" }, @@ -1834,6 +2246,39 @@ "node": ">=0.10.0" } }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/simple-swizzle": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", @@ -1848,9 +2293,9 @@ "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==" }, "node_modules/smob": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/smob/-/smob-1.4.1.tgz", - "integrity": "sha512-9LK+E7Hv5R9u4g4C3p+jjLstaLe11MDsL21UpYaCNmapvMkYhqCV4A/f/3gyH8QjMyh6l68q9xC85vihY9ahMQ==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/smob/-/smob-1.5.0.tgz", + "integrity": "sha512-g6T+p7QO8npa+/hNx9ohv1E5pVCmWrVCUzUXJyLdMmftX6ER0oiWY/w9knEonLpnOp6b6FenKnMfR8gqwWdwig==", "dev": true }, "node_modules/sort-asc": { @@ -1928,9 +2373,9 @@ } }, "node_modules/spdx-license-ids": { - "version": "3.0.17", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.17.tgz", - "integrity": "sha512-sh8PWc/ftMqAAdFiBu6Fy6JUOYjqDJBJvIhpfDMyHrr0Rbp5liZqd4TjtQ/RgfLjKFZb+LMx5hpml5qOWy0qvg==" + "version": "3.0.18", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.18.tgz", + "integrity": "sha512-xxRs31BqRYHwiMzudOrpSiHtZ8i/GeionCBDSilhYRj+9gIcI8wCZTlXZKu9vZIVqViP3dcp9qE5G6AlIaD+TQ==" }, "node_modules/split-string": { "version": "3.1.0", @@ -1979,6 +2424,102 @@ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==" }, + "node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/string-width-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-indent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", @@ -2021,9 +2562,9 @@ } }, "node_modules/terser": { - "version": "5.29.1", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.29.1.tgz", - "integrity": "sha512-lZQ/fyaIGxsbGxApKmoPTODIzELy3++mXhS5hOqaAWZjQtpq/hFHAc+rm29NND1rYRxRWKcjuARNwULNXa5RtQ==", + "version": "5.31.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.31.1.tgz", + "integrity": "sha512-37upzU1+viGvuFtBo9NPufCb9dwM0+l9hMxYyWfBA+fbwrPqNJAhbZ6W47bBFnZHKHTUBnMvi87434qq+qnxOg==", "dev": true, "dependencies": { "@jridgewell/source-map": "^0.3.3", @@ -2091,9 +2632,9 @@ } }, "node_modules/tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", + "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", "dev": true }, "node_modules/type-fest": { @@ -2116,9 +2657,9 @@ } }, "node_modules/typescript": { - "version": "5.4.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz", - "integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==", + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz", + "integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -2202,20 +2743,24 @@ } }, "node_modules/which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, "dependencies": { "isexe": "^2.0.0" }, "bin": { - "which": "bin/which" + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" } }, "node_modules/winston": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/winston/-/winston-3.12.0.tgz", - "integrity": "sha512-OwbxKaOlESDi01mC9rkM0dQqQt2I8DAUMRLZ/HpbwvDXm85IryEHgoogy5fziQy38PntgZsLlhAYHz//UPHZ5w==", + "version": "3.13.0", + "resolved": "https://registry.npmjs.org/winston/-/winston-3.13.0.tgz", + "integrity": "sha512-rwidmA1w3SE4j0E5MuIufFhyJPBDG7Nu71RkZor1p2+qHvJSZ9GYDA81AyleQcZbh/+V6HjeBdfnTZJm9rSeQQ==", "dependencies": { "@colors/colors": "^1.6.0", "@dabh/diagnostics": "^2.0.2", @@ -2288,12 +2833,127 @@ "safe-buffer": "~5.2.0" } }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/wrap-ansi-cjs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, "node_modules/wrench": { "version": "1.3.9", "resolved": "https://registry.npmjs.org/wrench/-/wrench-1.3.9.tgz", diff --git a/package.json b/package.json index 714fff3..4992856 100644 --- a/package.json +++ b/package.json @@ -9,23 +9,23 @@ "build-production": "tsc && rollup --config --environment BUILD:production" }, "dependencies": { - "@maplibre/maplibre-gl-directions": "^0.6.1", + "@maplibre/maplibre-gl-directions": "^0.7.0", "@types/geojson": "^7946.0.13", "@types/js-cookie": "^3.0.6", "build": "^0.1.4", "js-cookie": "^3.0.5", - "maplibre-gl": "^3.6.2", - "maplibre-gl-vector-text-protocol": "github:jimmyrocks/maplibre-gl-vector-text-protocol#d71ae363b1d6ee2c0bd9bf58fde8008707dd8df3" + "maplibre-gl": "^4.5.0", + "maplibre-gl-vector-text-protocol": "github:jimmyrocks/maplibre-gl-vector-text-protocol#e514aa41ea1a3c03970c8fba7544a3d23a79d84b" }, "devDependencies": { - "@rollup/plugin-commonjs": "^25.0.7", + "@rollup/plugin-commonjs": "^26.0.1", "@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-strip": "^3.0.4", "@rollup/plugin-terser": "^0.4.4", "@types/node": "^20.11.26", "dotenv": "^16.4.5", - "rollup": "^3.29.4", - "rollup-plugin-dotenv": "^0.5.0", + "rollup": "^4.13.0", + "rollup-plugin-dotenv": "^0.5.1", "rollup-plugin-import-css": "^3.4.0", "tslib": "^2.6.2", "typescript": "^5.3.3" diff --git a/src/button.ts b/src/button.ts index 9ce1b2a..642a508 100644 --- a/src/button.ts +++ b/src/button.ts @@ -1,5 +1,6 @@ import { MainControl } from './main.js'; +import { RouteControl } from './route.js'; import * as util from './util.js'; import { IControl, Popup, LayerSpecification, SourceSpecification, Map, MapMouseEvent, MapLayerMouseEvent, MapGeoJSONFeature } from 'maplibre-gl'; @@ -141,7 +142,6 @@ class LayerButton extends Button { paint: this.layer.paint ?? {}, ...this.getOptions(this.layer.type!), } as (LayerSpecification & {source?: string | SourceSpecification}), this.layer.beforeId); - if(this.layer.type === 'symbol') { const map = this.buttonControl.map!; @@ -267,6 +267,22 @@ class RainButton extends LayerButton { } } +class RouteButton extends Button { + routeControl: RouteControl; + constructor(layer: CyclemapLayerSpecification, buttonControl: ButtonControl) { + super(layer, buttonControl); + this.routeControl = new RouteControl(); + } + select() { + super.select(); + this.buttonControl.map!.addControl(this.routeControl); + } + deselect() { + this.buttonControl.map!.removeControl(this.routeControl); + super.deselect(); + } +} + class ResetButton extends Button { constructor(layer: CyclemapLayerSpecification, buttonControl: ButtonControl) { super(layer, buttonControl); @@ -384,7 +400,7 @@ export class ButtonControl implements IControl { onAdd(map: Map) { this.map = map; - this.map.on('click', (event: MapMouseEvent) => + this.map!.on('click', (event: MapMouseEvent) => this.deselectDirectories() ); //this.container = DOM.create('div', 'maplibregl-ctrl maplibregl-ctrl-group'); @@ -457,6 +473,7 @@ export class ButtonControl implements IControl { about: layer => new AboutButton(layer, this), layerIds: layer => new LayerIdsButton(layer, this), externalLink: layer => new ExternalLinkButton(layer, this), + route: layer => new RouteButton(layer, this), }; generateButton(layer: CyclemapLayerSpecification) { @@ -532,29 +549,8 @@ export class ButtonControl implements IControl { } setupIcons() { - this.map!.loadImage('sprite/2197.png', (error, image) => { - if (error) throw error; - if(image == null) { - console.error('trouble loading image'); - return; - } - this.map!.addImage('upright', image); - }); - this.map!.loadImage('sprite/2198.png', (error, image) => { - if (error) throw error; - if(image == null) { - console.error('trouble loading image'); - return; - } - this.map!.addImage('downright', image); - }); - this.map!.loadImage('sprite/27a1.png', (error, image) => { - if (error) throw error; - if(image == null) { - console.error('trouble loading image'); - return; - } - this.map!.addImage('right', image); - }); + this.map!.loadImage('sprite/2197.png').then(response => this.map!.addImage('upright', response.data)); + this.map!.loadImage('sprite/2198.png').then(response => this.map!.addImage('downright', response.data)); + this.map!.loadImage('sprite/27a1.png').then(response => this.map!.addImage('right', response.data)); } } diff --git a/src/main.ts b/src/main.ts index 22858ad..35d633e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,7 +1,6 @@ import { ButtonControl, ExternalLinkButton } from './button.js'; import { SaveControl } from './save.js'; -import { RouteControl } from './route.js'; import * as util from './util.js'; import * as browserImport from './browserImport.js'; @@ -37,8 +36,11 @@ export class MainControl implements IControl { hash: true, failIfMajorPerformanceCaveat: true, dragRotate: false, - customAttribution: "openmaptiles ©openstreetmap contributorsosrm", + attributionControl: false, }); + this.map.addControl(new maplibregl.AttributionControl({ + customAttribution: 'maplibre', //data attribution comes from the input file + })); this.map.addControl(this); //handles some click events this.map.addControl(new NavigationControl()); this.map.addControl(new ScaleControl({})); @@ -49,7 +51,6 @@ export class MainControl implements IControl { const buttonControl = new ButtonControl(this); this.map.addControl(buttonControl); this.map.addControl(new SaveControl(buttonControl)); - this.map.addControl(new RouteControl(buttonControl)); this.map.scrollZoom.setWheelZoomRate(4 / 450); //default is 1 / 450 this.map.on('load', (event: Event) => this.map.resize()); // https://github.com/mapbox/mapbox-gl-js/issues/8982 } diff --git a/src/route.ts b/src/route.ts index 818ad87..3653b66 100644 --- a/src/route.ts +++ b/src/route.ts @@ -1,6 +1,6 @@ import MapLibreGlDirections, { LoadingIndicatorControl } from "@maplibre/maplibre-gl-directions"; -import { ButtonControl } from './button.js'; + import { IControl, Map } from 'maplibre-gl'; @@ -10,44 +10,45 @@ const CYCLEMAPS_MAPBOX_PUBLIC_ACCESS_TOKEN = process.env.CYCLEMAPS_MAPBOX_PUBLIC export class RouteControl implements IControl { map: Map | undefined; directions: MapLibreGlDirections | undefined; - buttonControl: ButtonControl; dummyContainer: HTMLElement | undefined; - constructor(buttonControl: ButtonControl) { - this.buttonControl = buttonControl; + constructor() { } onAdd(map: Map) { this.map = map; this.dummyContainer = document.createElement('div'); + + const directions = new MapLibreGlDirections(this.map!, { + api: 'https://api.mapbox.com/directions/v5', + makePostRequest: true, + profile: 'mapbox/cycling', + requestOptions: { + access_token: CYCLEMAPS_MAPBOX_PUBLIC_ACCESS_TOKEN, + geometries: "polyline6", + }, + }); + this.directions = directions; - map.on('load', () => { - this.directions = new MapLibreGlDirections(map, { - api: 'https://api.mapbox.com/directions/v5/mapbox', - profile: 'cycling', - requestOptions: { - access_token: CYCLEMAPS_MAPBOX_PUBLIC_ACCESS_TOKEN, - }, - }); - - this.directions.on("fetchroutesend", (event) => { - const summary = event.data?.routes[0]; - const duration = ((summary?.duration as number) / 3600 * DURATION_RATIO).toFixed(1); - const distance = ((summary?.distance as number) / 1000).toFixed(0); - console.info(`${duration}h ${distance}km`); - }); - - /* - this.directions.on("removewaypoint", () => { - if (this.directions!.waypoints.length < 2) { - //reset time/distance - } - }); - */ - - this.directions.interactive = true; + directions.on("addwaypoint", (event) => { + console.info(`### on addwaypoint`); + }); + directions.on("fetchroutesend", (event) => { + const summary = event.data?.routes[0]; + const duration = ((summary?.duration as number) / 3600 * DURATION_RATIO).toFixed(1); + const distance = ((summary?.distance as number) / 1000).toFixed(0); + console.info(`${duration}h ${distance}km`); }); + directions.interactive = true; + + /* + directions.on("removewaypoint", () => { + if (this.directions!.waypoints.length < 2) { + //reset time/distance + } + }); + */ return this.dummyContainer; }