/*! For license information please see maplink-maps-3ff337cdafcb328cbdea.js.LICENSE.txt */
var MaplinkMap;(()=>{var t={594:(t,e,i)=>{i(795),i(276),i(477),i(504),i(646),i(727);const n=i(480).Z;t.exports=n},550:(t,e,i)=>{"use strict";i.d(e,{Z:()=>m});var n=i(645),r=i.n(n),o=i(667),s=i.n(o),a=i(529),l=i(574),c=i(504),h=r()((function(t){return t[1]})),u=s()(a.Z),p=s()(l.Z),d=s()(c.default);h.push([t.id,'/* required styles */\n\n.leaflet-pane,\n.leaflet-tile,\n.leaflet-marker-icon,\n.leaflet-marker-shadow,\n.leaflet-tile-container,\n.leaflet-pane > svg,\n.leaflet-pane > canvas,\n.leaflet-zoom-box,\n.leaflet-image-layer,\n.leaflet-layer {\n  position: absolute;\n  left: 0;\n  top: 0;\n}\n.leaflet-container {\n  overflow: hidden;\n}\n.leaflet-tile,\n.leaflet-marker-icon,\n.leaflet-marker-shadow {\n  -webkit-user-select: none;\n  -moz-user-select: none;\n  user-select: none;\n  -webkit-user-drag: none;\n}\n/* Safari renders non-retina tile on retina better with this, but Chrome is worse */\n.leaflet-safari .leaflet-tile {\n  image-rendering: -webkit-optimize-contrast;\n}\n/* hack that prevents hw layers "stretching" when loading new tiles */\n.leaflet-safari .leaflet-tile-container {\n  width: 1600px;\n  height: 1600px;\n  -webkit-transform-origin: 0 0;\n}\n.leaflet-marker-icon,\n.leaflet-marker-shadow {\n  display: block;\n}\n/* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */\n/* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */\n.leaflet-container .leaflet-overlay-pane svg,\n.leaflet-container .leaflet-marker-pane img,\n.leaflet-container .leaflet-shadow-pane img,\n.leaflet-container .leaflet-tile-pane img,\n.leaflet-container img.leaflet-image-layer {\n  max-width: none !important;\n}\n\n.leaflet-container.leaflet-touch-zoom {\n  -ms-touch-action: pan-x pan-y;\n  touch-action: pan-x pan-y;\n}\n.leaflet-container.leaflet-touch-drag {\n  -ms-touch-action: pinch-zoom;\n}\n.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom {\n  -ms-touch-action: none;\n  touch-action: none;\n}\n.leaflet-tile {\n  filter: inherit;\n  visibility: hidden;\n}\n.leaflet-tile-loaded {\n  visibility: inherit;\n}\n.leaflet-zoom-box {\n  width: 0;\n  height: 0;\n  -moz-box-sizing: border-box;\n  box-sizing: border-box;\n  z-index: 800;\n}\n/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */\n.leaflet-overlay-pane svg {\n  -moz-user-select: none;\n}\n\n.leaflet-pane {\n  z-index: 400;\n}\n\n.leaflet-tile-pane {\n  z-index: 200;\n}\n.leaflet-overlay-pane {\n  z-index: 400;\n}\n.leaflet-shadow-pane {\n  z-index: 500;\n}\n.leaflet-marker-pane {\n  z-index: 600;\n}\n.leaflet-tooltip-pane {\n  z-index: 650;\n}\n.leaflet-popup-pane {\n  z-index: 700;\n}\n\n.leaflet-map-pane canvas {\n  z-index: 100;\n}\n.leaflet-map-pane svg {\n  z-index: 200;\n}\n\n.leaflet-vml-shape {\n  width: 1px;\n  height: 1px;\n}\n.lvml {\n  behavior: url(#default#VML);\n  display: inline-block;\n  position: absolute;\n}\n\n/* control positioning */\n\n.leaflet-control {\n  position: relative;\n  z-index: 800;\n  pointer-events: visiblePainted; /* IE 9-10 doesn\'t have auto */\n  pointer-events: auto;\n}\n.leaflet-top,\n.leaflet-bottom {\n  position: absolute;\n  z-index: 1000;\n  pointer-events: none;\n}\n.leaflet-top {\n  top: 0;\n}\n.leaflet-right {\n  right: 0;\n}\n.leaflet-bottom {\n  bottom: 0;\n}\n.leaflet-left {\n  left: 0;\n}\n.leaflet-control {\n  float: left;\n  clear: both;\n}\n.leaflet-right .leaflet-control {\n  float: right;\n}\n.leaflet-top .leaflet-control {\n  margin-top: 10px;\n}\n.leaflet-bottom .leaflet-control {\n  margin-bottom: 10px;\n}\n.leaflet-left .leaflet-control {\n  margin-left: 10px;\n}\n.leaflet-right .leaflet-control {\n  margin-right: 10px;\n}\n\n/* zoom and fade animations */\n\n.leaflet-fade-anim .leaflet-tile {\n  will-change: opacity;\n}\n.leaflet-fade-anim .leaflet-popup {\n  opacity: 0;\n  -webkit-transition: opacity 0.2s linear;\n  -moz-transition: opacity 0.2s linear;\n  -o-transition: opacity 0.2s linear;\n  transition: opacity 0.2s linear;\n}\n.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {\n  opacity: 1;\n}\n.leaflet-zoom-animated {\n  -webkit-transform-origin: 0 0;\n  -ms-transform-origin: 0 0;\n  transform-origin: 0 0;\n}\n.leaflet-zoom-anim .leaflet-zoom-animated {\n  will-change: transform;\n}\n.leaflet-zoom-anim .leaflet-zoom-animated {\n  -webkit-transition: -webkit-transform 0.25s cubic-bezier(0, 0, 0.25, 1);\n  -moz-transition: -moz-transform 0.25s cubic-bezier(0, 0, 0.25, 1);\n  -o-transition: -o-transform 0.25s cubic-bezier(0, 0, 0.25, 1);\n  transition: transform 0.25s cubic-bezier(0, 0, 0.25, 1);\n}\n.leaflet-zoom-anim .leaflet-tile,\n.leaflet-pan-anim .leaflet-tile {\n  -webkit-transition: none;\n  -moz-transition: none;\n  -o-transition: none;\n  transition: none;\n}\n\n.leaflet-zoom-anim .leaflet-zoom-hide {\n  visibility: hidden;\n}\n\n/* cursors */\n\n.leaflet-interactive {\n  cursor: pointer;\n}\n.leaflet-grab {\n  cursor: -webkit-grab;\n  cursor: -moz-grab;\n}\n.leaflet-crosshair,\n.leaflet-crosshair .leaflet-interactive {\n  cursor: crosshair;\n}\n.leaflet-popup-pane,\n.leaflet-control {\n  cursor: auto;\n}\n.leaflet-dragging .leaflet-grab,\n.leaflet-dragging .leaflet-grab .leaflet-interactive,\n.leaflet-dragging .leaflet-marker-draggable {\n  cursor: move;\n  cursor: -webkit-grabbing;\n  cursor: -moz-grabbing;\n}\n\n/* marker & overlays interactivity */\n.leaflet-marker-icon,\n.leaflet-marker-shadow,\n.leaflet-image-layer,\n.leaflet-pane > svg path,\n.leaflet-tile-container {\n  pointer-events: none;\n}\n\n.leaflet-marker-icon.leaflet-interactive,\n.leaflet-image-layer.leaflet-interactive,\n.leaflet-pane > svg path.leaflet-interactive {\n  pointer-events: visiblePainted; /* IE 9-10 doesn\'t have auto */\n  pointer-events: auto;\n}\n\n/* visual tweaks */\n\n.leaflet-container {\n  background: #ddd;\n  outline: 0;\n}\n.leaflet-container a {\n  color: #0078a8;\n}\n.leaflet-container a.leaflet-active {\n  outline: 2px solid orange;\n}\n.leaflet-zoom-box {\n  border: 2px dotted #38f;\n  background: rgba(255, 255, 255, 0.5);\n}\n\n/* general typography */\n.leaflet-container {\n  font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;\n}\n\n/* general toolbar styles */\n\n.leaflet-bar {\n  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);\n  border-radius: 4px;\n}\n.leaflet-bar a,\n.leaflet-bar a:hover {\n  background-color: #fff;\n  border-bottom: 1px solid #ccc;\n  width: 26px;\n  height: 26px;\n  line-height: 26px;\n  display: block;\n  text-align: center;\n  text-decoration: none;\n  color: black;\n}\n.leaflet-bar a,\n.leaflet-control-layers-toggle {\n  background-position: 50% 50%;\n  background-repeat: no-repeat;\n  display: block;\n}\n.leaflet-bar a:hover {\n  background-color: #f4f4f4;\n}\n.leaflet-bar a:first-child {\n  border-top-left-radius: 4px;\n  border-top-right-radius: 4px;\n}\n.leaflet-bar a:last-child {\n  border-bottom-left-radius: 4px;\n  border-bottom-right-radius: 4px;\n  border-bottom: none;\n}\n.leaflet-bar a.leaflet-disabled {\n  cursor: default;\n  background-color: #f4f4f4;\n  color: #bbb;\n}\n\n.leaflet-touch .leaflet-bar a {\n  width: 30px;\n  height: 30px;\n  line-height: 30px;\n}\n\n/* zoom control */\n\n.leaflet-control-zoom-in,\n.leaflet-control-zoom-out {\n  font: bold 18px "Lucida Console", Monaco, monospace;\n  text-indent: 1px;\n}\n.leaflet-control-zoom-out {\n  font-size: 20px;\n}\n\n.leaflet-touch .leaflet-control-zoom-in {\n  font-size: 22px;\n}\n.leaflet-touch .leaflet-control-zoom-out {\n  font-size: 24px;\n}\n\n/* layers control */\n\n.leaflet-control-layers {\n  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);\n  background: #fff;\n  border-radius: 5px;\n}\n.leaflet-control-layers-toggle {\n  background-image: url('+u+");\n  width: 36px;\n  height: 36px;\n}\n.leaflet-retina .leaflet-control-layers-toggle {\n  background-image: url("+p+");\n  background-size: 26px 26px;\n}\n.leaflet-touch .leaflet-control-layers-toggle {\n  width: 44px;\n  height: 44px;\n}\n.leaflet-control-layers .leaflet-control-layers-list,\n.leaflet-control-layers-expanded .leaflet-control-layers-toggle {\n  display: none;\n}\n.leaflet-control-layers-expanded .leaflet-control-layers-list {\n  display: block;\n  position: relative;\n}\n.leaflet-control-layers-expanded {\n  padding: 6px 10px 6px 6px;\n  color: #333;\n  background: #fff;\n}\n.leaflet-control-layers-scrollbar {\n  overflow-y: scroll;\n  padding-right: 5px;\n}\n.leaflet-control-layers-selector {\n  margin-top: 2px;\n  position: relative;\n  top: 1px;\n}\n.leaflet-control-layers label {\n  display: block;\n}\n.leaflet-control-layers-separator {\n  height: 0;\n  border-top: 1px solid #ddd;\n  margin: 5px -10px 5px -6px;\n}\n\n/* Default icon URLs */\n.leaflet-default-icon-path {\n  background-image: url("+d+');\n}\n\n/* attribution and scale controls */\n\n.leaflet-container .leaflet-control-attribution {\n  background: #fff;\n  background: rgba(255, 255, 255, 0.7);\n  margin: 0;\n}\n.leaflet-control-attribution,\n.leaflet-control-scale-line {\n  padding: 0 5px;\n  color: #333;\n}\n.leaflet-control-attribution a {\n  text-decoration: none;\n}\n.leaflet-control-attribution a:hover {\n  text-decoration: underline;\n}\n.leaflet-container .leaflet-control-attribution,\n.leaflet-container .leaflet-control-scale {\n  font-size: 11px;\n}\n.leaflet-left .leaflet-control-scale {\n  margin-left: 5px;\n}\n.leaflet-bottom .leaflet-control-scale {\n  margin-bottom: 5px;\n}\n.leaflet-control-scale-line {\n  border: 2px solid #777;\n  border-top: none;\n  line-height: 1.1;\n  padding: 2px 5px 1px;\n  font-size: 11px;\n  white-space: nowrap;\n  overflow: hidden;\n  -moz-box-sizing: border-box;\n  box-sizing: border-box;\n\n  background: #fff;\n  background: rgba(255, 255, 255, 0.5);\n}\n.leaflet-control-scale-line:not(:first-child) {\n  border-top: 2px solid #777;\n  border-bottom: none;\n  margin-top: -2px;\n}\n.leaflet-control-scale-line:not(:first-child):not(:last-child) {\n  border-bottom: 2px solid #777;\n}\n\n.leaflet-touch .leaflet-control-attribution,\n.leaflet-touch .leaflet-control-layers,\n.leaflet-touch .leaflet-bar {\n  box-shadow: none;\n}\n.leaflet-touch .leaflet-control-layers,\n.leaflet-touch .leaflet-bar {\n  border: 2px solid rgba(0, 0, 0, 0.2);\n  background-clip: padding-box;\n}\n\n/* popup */\n\n.leaflet-popup {\n  position: absolute;\n  text-align: center;\n  margin-bottom: 20px;\n}\n.leaflet-popup-content-wrapper {\n  padding: 1px;\n  text-align: left;\n  border-radius: 12px;\n}\n.leaflet-popup-content {\n  margin: 13px 19px;\n  line-height: 1.4;\n}\n.leaflet-popup-content p {\n  margin: 18px 0;\n}\n.leaflet-popup-tip-container {\n  width: 40px;\n  height: 20px;\n  position: absolute;\n  left: 50%;\n  margin-left: -20px;\n  overflow: hidden;\n  pointer-events: none;\n}\n.leaflet-popup-tip {\n  width: 17px;\n  height: 17px;\n  padding: 1px;\n\n  margin: -10px auto 0;\n\n  -webkit-transform: rotate(45deg);\n  -moz-transform: rotate(45deg);\n  -ms-transform: rotate(45deg);\n  -o-transform: rotate(45deg);\n  transform: rotate(45deg);\n}\n.leaflet-popup-content-wrapper,\n.leaflet-popup-tip {\n  background: white;\n  color: #333;\n  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);\n}\n.leaflet-container a.leaflet-popup-close-button {\n  position: absolute;\n  top: 0;\n  right: 0;\n  padding: 4px 4px 0 0;\n  border: none;\n  text-align: center;\n  width: 18px;\n  height: 14px;\n  font: 16px/14px Tahoma, Verdana, sans-serif;\n  color: #c3c3c3;\n  text-decoration: none;\n  font-weight: bold;\n  background: transparent;\n}\n.leaflet-container a.leaflet-popup-close-button:hover {\n  color: #999;\n}\n.leaflet-popup-scrolled {\n  overflow: auto;\n  border-bottom: 1px solid #ddd;\n  border-top: 1px solid #ddd;\n}\n\n.leaflet-oldie .leaflet-popup-content-wrapper {\n  zoom: 1;\n}\n.leaflet-oldie .leaflet-popup-tip {\n  width: 24px;\n  margin: 0 auto;\n\n  -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";\n  filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);\n}\n.leaflet-oldie .leaflet-popup-tip-container {\n  margin-top: -1px;\n}\n\n.leaflet-oldie .leaflet-control-zoom,\n.leaflet-oldie .leaflet-control-layers,\n.leaflet-oldie .leaflet-popup-content-wrapper,\n.leaflet-oldie .leaflet-popup-tip {\n  border: 1px solid #999;\n}\n\n/* div icon */\n\n.leaflet-div-icon {\n  background: #fff;\n  border: 1px solid #666;\n}\n\n/* Tooltip */\n/* Base styles for the element that has a tooltip */\n.leaflet-tooltip {\n  position: absolute;\n  padding: 6px;\n  background-color: #fff;\n  border: 1px solid #fff;\n  border-radius: 3px;\n  color: #222;\n  white-space: nowrap;\n  -webkit-user-select: none;\n  -moz-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n  pointer-events: none;\n  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);\n}\n.leaflet-tooltip.leaflet-clickable {\n  cursor: pointer;\n  pointer-events: auto;\n}\n.leaflet-tooltip-top:before,\n.leaflet-tooltip-bottom:before,\n.leaflet-tooltip-left:before,\n.leaflet-tooltip-right:before {\n  position: absolute;\n  pointer-events: none;\n  border: 6px solid transparent;\n  background: transparent;\n  content: "";\n}\n\n/* Directions */\n\n.leaflet-tooltip-bottom {\n  margin-top: 6px;\n}\n.leaflet-tooltip-top {\n  margin-top: -6px;\n}\n.leaflet-tooltip-bottom:before,\n.leaflet-tooltip-top:before {\n  left: 50%;\n  margin-left: -6px;\n}\n.leaflet-tooltip-top:before {\n  bottom: 0;\n  margin-bottom: -12px;\n  border-top-color: #fff;\n}\n.leaflet-tooltip-bottom:before {\n  top: 0;\n  margin-top: -12px;\n  margin-left: -6px;\n  border-bottom-color: #fff;\n}\n.leaflet-tooltip-left {\n  margin-left: -6px;\n}\n.leaflet-tooltip-right {\n  margin-left: 6px;\n}\n.leaflet-tooltip-left:before,\n.leaflet-tooltip-right:before {\n  top: 50%;\n  margin-top: -6px;\n}\n.leaflet-tooltip-left:before {\n  right: 0;\n  margin-right: -12px;\n  border-left-color: #fff;\n}\n.leaflet-tooltip-right:before {\n  left: 0;\n  margin-left: -12px;\n  border-right-color: #fff;\n}\n.maplink-edit-icon {\n  border-radius: 50%;\n}\n',""]);const m=h},40:(t,e,i)=>{"use strict";i.d(e,{Z:()=>o});var n=i(645),r=i.n(n)()((function(t){return t[1]}));r.push([t.id,".maplibregl-map {\n  -webkit-tap-highlight-color: rgb(0 0 0/0);\n  font: 12px/20px Helvetica Neue, Arial, Helvetica, sans-serif;\n  overflow: hidden;\n  position: relative;\n}\n.maplibregl-canvas {\n  left: 0;\n  position: absolute;\n  top: 0;\n}\n.maplibregl-map:fullscreen {\n  height: 100%;\n  width: 100%;\n}\n.maplibregl-ctrl-group button.maplibregl-ctrl-compass {\n  touch-action: none;\n}\n.maplibregl-canvas-container.maplibregl-interactive,\n.maplibregl-ctrl-group button.maplibregl-ctrl-compass {\n  cursor: grab;\n  -moz-user-select: none;\n  -webkit-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n}\n.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer {\n  cursor: pointer;\n}\n.maplibregl-canvas-container.maplibregl-interactive:active,\n.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active {\n  cursor: grabbing;\n}\n.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,\n.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas {\n  touch-action: pan-x pan-y;\n}\n.maplibregl-canvas-container.maplibregl-touch-drag-pan,\n.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas {\n  touch-action: pinch-zoom;\n}\n.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,\n.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan\n  .maplibregl-canvas {\n  touch-action: none;\n}\n.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,\n.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures\n  .maplibregl-canvas {\n  touch-action: pan-x pan-y;\n}\n.maplibregl-ctrl-bottom-left,\n.maplibregl-ctrl-bottom-right,\n.maplibregl-ctrl-top-left,\n.maplibregl-ctrl-top-right {\n  pointer-events: none;\n  position: absolute;\n  z-index: 2;\n}\n.maplibregl-ctrl-top-left {\n  left: 0;\n  top: 0;\n}\n.maplibregl-ctrl-top-right {\n  right: 0;\n  top: 0;\n}\n.maplibregl-ctrl-bottom-left {\n  bottom: 0;\n  left: 0;\n}\n.maplibregl-ctrl-bottom-right {\n  bottom: 0;\n  right: 0;\n}\n.maplibregl-ctrl {\n  clear: both;\n  pointer-events: auto;\n  transform: translate(0);\n}\n.maplibregl-ctrl-top-left .maplibregl-ctrl {\n  float: left;\n  margin: 10px 0 0 10px;\n}\n.maplibregl-ctrl-top-right .maplibregl-ctrl {\n  float: right;\n  margin: 10px 10px 0 0;\n}\n.maplibregl-ctrl-bottom-left .maplibregl-ctrl {\n  float: left;\n  margin: 0 0 10px 10px;\n}\n.maplibregl-ctrl-bottom-right .maplibregl-ctrl {\n  float: right;\n  margin: 0 10px 10px 0;\n}\n.maplibregl-ctrl-group {\n  background: #fff;\n  border-radius: 4px;\n}\n.maplibregl-ctrl-group:not(:empty) {\n  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);\n}\n@media (-ms-high-contrast: active) {\n  .maplibregl-ctrl-group:not(:empty) {\n    box-shadow: 0 0 0 2px ButtonText;\n  }\n}\n.maplibregl-ctrl-group button {\n  background-color: transparent;\n  border: 0;\n  box-sizing: border-box;\n  cursor: pointer;\n  display: block;\n  height: 29px;\n  outline: none;\n  padding: 0;\n  width: 29px;\n}\n.maplibregl-ctrl-group button + button {\n  border-top: 1px solid #ddd;\n}\n.maplibregl-ctrl button .maplibregl-ctrl-icon {\n  background-position: 50%;\n  background-repeat: no-repeat;\n  display: block;\n  height: 100%;\n  width: 100%;\n}\n@media (-ms-high-contrast: active) {\n  .maplibregl-ctrl-icon {\n    background-color: transparent;\n  }\n  .maplibregl-ctrl-group button + button {\n    border-top: 1px solid ButtonText;\n  }\n}\n.maplibregl-ctrl button::-moz-focus-inner {\n  border: 0;\n  padding: 0;\n}\n.maplibregl-ctrl-attrib-button:focus,\n.maplibregl-ctrl-group button:focus {\n  box-shadow: 0 0 2px 2px #0096ff;\n}\n.maplibregl-ctrl button:disabled {\n  cursor: not-allowed;\n}\n.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon {\n  opacity: 0.25;\n}\n.maplibregl-ctrl button:not(:disabled):hover {\n  background-color: rgb(0 0 0/5%);\n}\n.maplibregl-ctrl-group button:focus:focus-visible {\n  box-shadow: 0 0 2px 2px #0096ff;\n}\n.maplibregl-ctrl-group button:focus:not(:focus-visible) {\n  box-shadow: none;\n}\n.maplibregl-ctrl-group button:focus:first-child {\n  border-radius: 4px 4px 0 0;\n}\n.maplibregl-ctrl-group button:focus:last-child {\n  border-radius: 0 0 4px 4px;\n}\n.maplibregl-ctrl-group button:focus:only-child {\n  border-radius: inherit;\n}\n.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon {\n  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\");\n}\n.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon {\n  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\");\n}\n@media (-ms-high-contrast: active) {\n  .maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon {\n    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\");\n  }\n  .maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon {\n    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\");\n  }\n}\n@media (-ms-high-contrast: black-on-white) {\n  .maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon {\n    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\");\n  }\n  .maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon {\n    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\");\n  }\n}\n.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon {\n  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\");\n}\n.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon {\n  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\");\n}\n@media (-ms-high-contrast: active) {\n  .maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon {\n    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\");\n  }\n  .maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon {\n    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\");\n  }\n}\n@media (-ms-high-contrast: black-on-white) {\n  .maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon {\n    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\");\n  }\n  .maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon {\n    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\");\n  }\n}\n.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon {\n  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\");\n}\n@media (-ms-high-contrast: active) {\n  .maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon {\n    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\");\n  }\n}\n@media (-ms-high-contrast: black-on-white) {\n  .maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon {\n    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\");\n  }\n}\n.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon {\n  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\");\n}\n.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon {\n  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\");\n}\n.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon {\n  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\");\n}\n.maplibregl-ctrl\n  button.maplibregl-ctrl-geolocate:disabled\n  .maplibregl-ctrl-icon {\n  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\");\n}\n.maplibregl-ctrl\n  button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active\n  .maplibregl-ctrl-icon {\n  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\");\n}\n.maplibregl-ctrl\n  button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error\n  .maplibregl-ctrl-icon {\n  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\");\n}\n.maplibregl-ctrl\n  button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background\n  .maplibregl-ctrl-icon {\n  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\");\n}\n.maplibregl-ctrl\n  button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error\n  .maplibregl-ctrl-icon {\n  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\");\n}\n.maplibregl-ctrl\n  button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting\n  .maplibregl-ctrl-icon {\n  animation: maplibregl-spin 2s linear infinite;\n}\n@media (-ms-high-contrast: active) {\n  .maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon {\n    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\");\n  }\n  .maplibregl-ctrl\n    button.maplibregl-ctrl-geolocate:disabled\n    .maplibregl-ctrl-icon {\n    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\");\n  }\n  .maplibregl-ctrl\n    button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active\n    .maplibregl-ctrl-icon {\n    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\");\n  }\n  .maplibregl-ctrl\n    button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error\n    .maplibregl-ctrl-icon {\n    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\");\n  }\n  .maplibregl-ctrl\n    button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background\n    .maplibregl-ctrl-icon {\n    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\");\n  }\n  .maplibregl-ctrl\n    button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error\n    .maplibregl-ctrl-icon {\n    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\");\n  }\n}\n@media (-ms-high-contrast: black-on-white) {\n  .maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon {\n    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\");\n  }\n  .maplibregl-ctrl\n    button.maplibregl-ctrl-geolocate:disabled\n    .maplibregl-ctrl-icon {\n    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\");\n  }\n}\n@keyframes maplibregl-spin {\n  0% {\n    transform: rotate(0deg);\n  }\n  to {\n    transform: rotate(1turn);\n  }\n}\na.maplibregl-ctrl-logo {\n  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\");\n  background-repeat: no-repeat;\n  cursor: pointer;\n  display: block;\n  height: 23px;\n  margin: 0 0 -4px -4px;\n  overflow: hidden;\n  width: 88px;\n}\na.maplibregl-ctrl-logo.maplibregl-compact {\n  width: 14px;\n}\n@media (-ms-high-contrast: active) {\n  a.maplibregl-ctrl-logo {\n    background-color: transparent;\n    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\");\n  }\n}\n@media (-ms-high-contrast: black-on-white) {\n  a.maplibregl-ctrl-logo {\n    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\");\n  }\n}\n.maplibregl-ctrl.maplibregl-ctrl-attrib {\n  background-color: hsla(0, 0%, 100%, 0.5);\n  margin: 0;\n  padding: 0 5px;\n}\n@media screen {\n  .maplibregl-ctrl-attrib.maplibregl-compact {\n    background-color: #fff;\n    border-radius: 12px;\n    box-sizing: content-box;\n    margin: 10px;\n    min-height: 20px;\n    padding: 2px 24px 2px 0;\n    position: relative;\n  }\n  .maplibregl-ctrl-attrib.maplibregl-compact-show {\n    padding: 2px 28px 2px 8px;\n    visibility: visible;\n  }\n  .maplibregl-ctrl-bottom-left\n    > .maplibregl-ctrl-attrib.maplibregl-compact-show,\n  .maplibregl-ctrl-top-left > .maplibregl-ctrl-attrib.maplibregl-compact-show {\n    border-radius: 12px;\n    padding: 2px 8px 2px 28px;\n  }\n  .maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner {\n    display: none;\n  }\n  .maplibregl-ctrl-attrib-button {\n    background-color: hsla(0, 0%, 100%, 0.5);\n    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\");\n    border: 0;\n    border-radius: 12px;\n    box-sizing: border-box;\n    cursor: pointer;\n    display: none;\n    height: 24px;\n    outline: none;\n    position: absolute;\n    right: 0;\n    top: 0;\n    width: 24px;\n  }\n  .maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button {\n    appearance: none;\n    list-style: none;\n  }\n  .maplibregl-ctrl-attrib\n    summary.maplibregl-ctrl-attrib-button::-webkit-details-marker {\n    display: none;\n  }\n  .maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,\n  .maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button {\n    left: 0;\n  }\n  .maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,\n  .maplibregl-ctrl-attrib.maplibregl-compact-show\n    .maplibregl-ctrl-attrib-inner {\n    display: block;\n  }\n  .maplibregl-ctrl-attrib.maplibregl-compact-show\n    .maplibregl-ctrl-attrib-button {\n    background-color: rgb(0 0 0/5%);\n  }\n  .maplibregl-ctrl-bottom-right\n    > .maplibregl-ctrl-attrib.maplibregl-compact:after {\n    bottom: 0;\n    right: 0;\n  }\n  .maplibregl-ctrl-top-right\n    > .maplibregl-ctrl-attrib.maplibregl-compact:after {\n    right: 0;\n    top: 0;\n  }\n  .maplibregl-ctrl-top-left > .maplibregl-ctrl-attrib.maplibregl-compact:after {\n    left: 0;\n    top: 0;\n  }\n  .maplibregl-ctrl-bottom-left\n    > .maplibregl-ctrl-attrib.maplibregl-compact:after {\n    bottom: 0;\n    left: 0;\n  }\n}\n@media screen and (-ms-high-contrast: active) {\n  .maplibregl-ctrl-attrib.maplibregl-compact:after {\n    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\");\n  }\n}\n@media screen and (-ms-high-contrast: black-on-white) {\n  .maplibregl-ctrl-attrib.maplibregl-compact:after {\n    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\");\n  }\n}\n.maplibregl-ctrl-attrib a {\n  color: rgba(0, 0, 0, 0.75);\n  text-decoration: none;\n}\n.maplibregl-ctrl-attrib a:hover {\n  color: inherit;\n  text-decoration: underline;\n}\n.maplibregl-attrib-empty {\n  display: none;\n}\n.maplibregl-ctrl-scale {\n  background-color: hsla(0, 0%, 100%, 0.75);\n  border: 2px solid #333;\n  border-top: #333;\n  box-sizing: border-box;\n  color: #333;\n  font-size: 10px;\n  padding: 0 5px;\n}\n.maplibregl-popup {\n  display: flex;\n  left: 0;\n  pointer-events: none;\n  position: absolute;\n  top: 0;\n  will-change: transform;\n}\n.maplibregl-popup-anchor-top,\n.maplibregl-popup-anchor-top-left,\n.maplibregl-popup-anchor-top-right {\n  flex-direction: column;\n}\n.maplibregl-popup-anchor-bottom,\n.maplibregl-popup-anchor-bottom-left,\n.maplibregl-popup-anchor-bottom-right {\n  flex-direction: column-reverse;\n}\n.maplibregl-popup-anchor-left {\n  flex-direction: row;\n}\n.maplibregl-popup-anchor-right {\n  flex-direction: row-reverse;\n}\n.maplibregl-popup-tip {\n  border: 10px solid transparent;\n  height: 0;\n  width: 0;\n  z-index: 1;\n}\n.maplibregl-popup-anchor-top .maplibregl-popup-tip {\n  align-self: center;\n  border-bottom-color: #fff;\n  border-top: none;\n}\n.maplibregl-popup-anchor-top-left .maplibregl-popup-tip {\n  align-self: flex-start;\n  border-bottom-color: #fff;\n  border-left: none;\n  border-top: none;\n}\n.maplibregl-popup-anchor-top-right .maplibregl-popup-tip {\n  align-self: flex-end;\n  border-bottom-color: #fff;\n  border-right: none;\n  border-top: none;\n}\n.maplibregl-popup-anchor-bottom .maplibregl-popup-tip {\n  align-self: center;\n  border-bottom: none;\n  border-top-color: #fff;\n}\n.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip {\n  align-self: flex-start;\n  border-bottom: none;\n  border-left: none;\n  border-top-color: #fff;\n}\n.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {\n  align-self: flex-end;\n  border-bottom: none;\n  border-right: none;\n  border-top-color: #fff;\n}\n.maplibregl-popup-anchor-left .maplibregl-popup-tip {\n  align-self: center;\n  border-left: none;\n  border-right-color: #fff;\n}\n.maplibregl-popup-anchor-right .maplibregl-popup-tip {\n  align-self: center;\n  border-left-color: #fff;\n  border-right: none;\n}\n.maplibregl-popup-close-button {\n  background-color: transparent;\n  border: 0;\n  border-radius: 0 3px 0 0;\n  cursor: pointer;\n  position: absolute;\n  right: 0;\n  top: 0;\n}\n.maplibregl-popup-close-button:hover {\n  background-color: rgb(0 0 0/5%);\n}\n.maplibregl-popup-content {\n  background: #fff;\n  border-radius: 3px;\n  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);\n  padding: 15px 10px;\n  pointer-events: auto;\n  position: relative;\n}\n.maplibregl-popup-anchor-top-left .maplibregl-popup-content {\n  border-top-left-radius: 0;\n}\n.maplibregl-popup-anchor-top-right .maplibregl-popup-content {\n  border-top-right-radius: 0;\n}\n.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content {\n  border-bottom-left-radius: 0;\n}\n.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content {\n  border-bottom-right-radius: 0;\n}\n.maplibregl-popup-track-pointer {\n  display: none;\n}\n.maplibregl-popup-track-pointer * {\n  pointer-events: none;\n  user-select: none;\n}\n.maplibregl-map:hover .maplibregl-popup-track-pointer {\n  display: flex;\n}\n.maplibregl-map:active .maplibregl-popup-track-pointer {\n  display: none;\n}\n.maplibregl-marker {\n  left: 0;\n  position: absolute;\n  top: 0;\n  will-change: transform;\n}\n.maplibregl-user-location-dot,\n.maplibregl-user-location-dot:before {\n  background-color: #1da1f2;\n  border-radius: 50%;\n  height: 15px;\n  width: 15px;\n}\n.maplibregl-user-location-dot:before {\n  animation: maplibregl-user-location-dot-pulse 2s infinite;\n  content: \"\";\n  position: absolute;\n}\n.maplibregl-user-location-dot:after {\n  border: 2px solid #fff;\n  border-radius: 50%;\n  box-shadow: 0 0 3px rgba(0, 0, 0, 0.35);\n  box-sizing: border-box;\n  content: \"\";\n  height: 19px;\n  left: -2px;\n  position: absolute;\n  top: -2px;\n  width: 19px;\n}\n@keyframes maplibregl-user-location-dot-pulse {\n  0% {\n    opacity: 1;\n    transform: scale(1);\n  }\n  70% {\n    opacity: 0;\n    transform: scale(3);\n  }\n  to {\n    opacity: 0;\n    transform: scale(1);\n  }\n}\n.maplibregl-user-location-dot-stale {\n  background-color: #aaa;\n}\n.maplibregl-user-location-dot-stale:after {\n  display: none;\n}\n.maplibregl-user-location-accuracy-circle {\n  background-color: #1da1f233;\n  border-radius: 100%;\n  height: 1px;\n  width: 1px;\n}\n.maplibregl-crosshair,\n.maplibregl-crosshair .maplibregl-interactive,\n.maplibregl-crosshair .maplibregl-interactive:active {\n  cursor: crosshair;\n}\n.maplibregl-boxzoom {\n  background: #fff;\n  border: 2px dotted #202020;\n  height: 0;\n  left: 0;\n  opacity: 0.5;\n  position: absolute;\n  top: 0;\n  width: 0;\n}\n.maplibregl-cooperative-gesture-screen {\n  align-items: center;\n  background: rgba(0, 0, 0, 0.4);\n  color: #fff;\n  display: flex;\n  font-size: 1.4em;\n  inset: 0;\n  justify-content: center;\n  line-height: 1.2;\n  opacity: 0;\n  padding: 1rem;\n  pointer-events: none;\n  position: absolute;\n  transition: opacity 1s ease 1s;\n  z-index: 99999;\n}\n.maplibregl-cooperative-gesture-screen.maplibregl-show {\n  opacity: 1;\n  transition: opacity 0.05s;\n}\n.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message {\n  display: none;\n}\n@media (hover: none), (width <= 480px) {\n  .maplibregl-cooperative-gesture-screen .maplibregl-desktop-message {\n    display: none;\n  }\n  .maplibregl-cooperative-gesture-screen .maplibregl-mobile-message {\n    display: block;\n  }\n}\n.maplibregl-pseudo-fullscreen {\n  height: 100% !important;\n  left: 0 !important;\n  position: fixed !important;\n  top: 0 !important;\n  width: 100% !important;\n  z-index: 99999;\n}\n",""]);const o=r},958:(t,e,i)=>{"use strict";i.d(e,{Z:()=>h});var n=i(645),r=i.n(n),o=i(667),s=i.n(o),a=i(463),l=r()((function(t){return t[1]})),c=s()(a.Z);l.push([t.id,".leaflet-bottom.leaflet-left {\n\tbackground-image: url("+c+");\n\theight: 30px;\n\twidth: 82px;\n\tbackground-size: 82px 30px;\n\tbackground-repeat: no-repeat;\n\tmargin-left: 5px;\n}",""]);const h=l},645:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var i=t(e);return e[2]?"@media ".concat(e[2]," {").concat(i,"}"):i})).join("")},e.i=function(t,i,n){"string"==typeof t&&(t=[[null,t,""]]);var r={};if(n)for(var o=0;o<this.length;o++){var s=this[o][0];null!=s&&(r[s]=!0)}for(var a=0;a<t.length;a++){var l=[].concat(t[a]);n&&r[l[0]]||(i&&(l[2]?l[2]="".concat(i," and ").concat(l[2]):l[2]=i),e.push(l))}},e}},667:t=>{"use strict";t.exports=function(t,e){return e||(e={}),"string"!=typeof(t=t&&t.__esModule?t.default:t)?t:(/^['"].*['"]$/.test(t)&&(t=t.slice(1,-1)),e.hash&&(t+=e.hash),/["'() \t\n]/.test(t)||e.needQuotes?'"'.concat(t.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):t)}},574:(t,e,i)=>{"use strict";i.d(e,{Z:()=>n});const n=i.p+"images/layers-2x.png"},529:(t,e,i)=>{"use strict";i.d(e,{Z:()=>n});const n=i.p+"images/layers.png"},463:(t,e,i)=>{"use strict";i.d(e,{Z:()=>n});const n=i.p+"images/maplink-logo.png"},646:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>n});const n=i.p+"images/marker-icon-2x.png"},504:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>n});const n=i.p+"images/marker-icon.png"},727:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>n});const n=i.p+"images/marker-shadow.png"},693:(t,e,i)=>{var n,r;n=[i(243)],void 0===(r=function(t){"use strict";return t.Polyline._flat=t.LineUtil.isFlat||t.Polyline._flat||function(e){return!t.Util.isArray(e[0])||"object"!=typeof e[0][0]&&void 0!==e[0][0]},t.GeometryUtil=t.extend(t.GeometryUtil||{},{distance:function(t,e,i){return t.latLngToLayerPoint(e).distanceTo(t.latLngToLayerPoint(i))},distanceSegment:function(e,i,n,r){var o=e.latLngToLayerPoint(i),s=e.latLngToLayerPoint(n),a=e.latLngToLayerPoint(r);return t.LineUtil.pointToSegmentDistance(o,s,a)},readableDistance:function(t,e){return"imperial"!==e?t>1e3?(t/1e3).toFixed(2)+" km":t.toFixed(1)+" m":(t*=1.09361)>1760?(t/1760).toFixed(2)+" miles":t.toFixed(1)+" yd"},belongsSegment:function(t,e,i,n){n=void 0===n?.2:n;var r=e.distanceTo(i);return(e.distanceTo(t)+t.distanceTo(i)-r)/r<n},length:function(e){var i=t.GeometryUtil.accumulatedLengths(e);return i.length>0?i[i.length-1]:0},accumulatedLengths:function(t){if("function"==typeof t.getLatLngs&&(t=t.getLatLngs()),0===t.length)return[];for(var e=0,i=[0],n=0,r=t.length-1;n<r;n++)e+=t[n].distanceTo(t[n+1]),i.push(e);return i},closestOnSegment:function(e,i,n,r){var o=e.getMaxZoom();o===1/0&&(o=e.getZoom());var s=e.project(i,o),a=e.project(n,o),l=e.project(r,o),c=t.LineUtil.closestPointOnSegment(s,a,l);return e.unproject(c,o)},closest:function(e,i,n,r){var o,s,a,l,c,h=1/0,u=null;if(i instanceof Array){if(i[0]instanceof Array&&"number"!=typeof i[0][0]){for(s=0;s<i.length;s++)(c=t.GeometryUtil.closest(e,i[s],n,r))&&c.distance<h&&(h=c.distance,u=c);return u}if(!(i[0]instanceof t.LatLng||"number"==typeof i[0][0]||"number"==typeof i[0].lat))return u;i=t.polyline(i)}if(!(i instanceof t.Polyline))return u;if(o=JSON.parse(JSON.stringify(i.getLatLngs().slice(0))),i instanceof t.Polygon){var p=function(e){if(t.Polyline._flat(e))e.push(e[0]);else for(var i=0;i<e.length;i++)p(e[i])};p(o)}if(t.Polyline._flat(o)){if(r){for(s=0,a=o.length;s<a;s++){var d=o[s];(l=t.GeometryUtil.distance(e,n,d))<h&&(h=l,(u=d).distance=l)}return u}for(s=0,a=o.length;s<a-1;s++){var m=o[s],f=o[s+1];(l=t.GeometryUtil.distanceSegment(e,n,m,f))<=h&&(h=l,(u=t.GeometryUtil.closestOnSegment(e,n,m,f)).distance=l)}return u}for(s=0;s<o.length;s++)(c=t.GeometryUtil.closest(e,o[s],n,r)).distance<h&&(h=c.distance,u=c);return u},closestLayer:function(e,i,n){for(var r=1/0,o=null,s=null,a=1/0,l=0,c=i.length;l<c;l++){var h=i[l];if(h instanceof t.LayerGroup){var u=t.GeometryUtil.closestLayer(e,h.getLayers(),n);u.distance<r&&(r=u.distance,o=u)}else"function"==typeof h.getLatLng?(s=h.getLatLng(),a=t.GeometryUtil.distance(e,n,s)):(s=t.GeometryUtil.closest(e,h,n))&&(a=s.distance),a<r&&(r=a,o={layer:h,latlng:s,distance:a})}return o},nClosestLayers:function(e,i,n,r){if((r="number"==typeof r?r:i.length)<1||i.length<1)return null;for(var o,s,a=[],l=0,c=i.length;l<c;l++){var h=i[l];if(h instanceof t.LayerGroup){var u=t.GeometryUtil.closestLayer(e,h.getLayers(),n);a.push(u)}else"function"==typeof h.getLatLng?(s=h.getLatLng(),o=t.GeometryUtil.distance(e,n,s)):(s=t.GeometryUtil.closest(e,h,n))&&(o=s.distance),a.push({layer:h,latlng:s,distance:o})}return a.sort((function(t,e){return t.distance-e.distance})),a.length>r?a.slice(0,r):a},layersWithin:function(e,i,n,r){r="number"==typeof r?r:1/0;for(var o=[],s=null,a=0,l=0,c=i.length;l<c;l++){var h=i[l];"function"==typeof h.getLatLng?(s=h.getLatLng(),a=t.GeometryUtil.distance(e,n,s)):(s=t.GeometryUtil.closest(e,h,n))&&(a=s.distance),s&&a<r&&o.push({layer:h,latlng:s,distance:a})}return o.sort((function(t,e){return t.distance-e.distance}))},closestLayerSnap:function(e,i,n,r,o){r="number"==typeof r?r:1/0,o="boolean"!=typeof o||o;var s=t.GeometryUtil.closestLayer(e,i,n);if(!s||s.distance>r)return null;if(o&&"function"==typeof s.layer.getLatLngs){var a=t.GeometryUtil.closest(e,s.layer,s.latlng,!0);a.distance<r&&(s.latlng=a,s.distance=t.GeometryUtil.distance(e,a,n))}return s},interpolateOnPointSegment:function(e,i,n){return t.point(e.x*(1-n)+n*i.x,e.y*(1-n)+n*i.y)},interpolateOnLine:function(e,i,n){var r=(i=i instanceof t.Polyline?i.getLatLngs():i).length;if(r<2)return null;if(0===(n=Math.max(Math.min(n,1),0)))return{latLng:i[0]instanceof t.LatLng?i[0]:t.latLng(i[0]),predecessor:-1};if(1==n)return{latLng:i[i.length-1]instanceof t.LatLng?i[i.length-1]:t.latLng(i[i.length-1]),predecessor:i.length-2};var o=e.getMaxZoom();o===1/0&&(o=e.getZoom());for(var s=[],a=0,l=0;l<r;l++)s[l]=e.project(i[l],o),l>0&&(a+=s[l-1].distanceTo(s[l]));var c=a*n,h=0,u=0;for(l=0;u<c;l++){var p=s[l],d=s[l+1];h=u,u+=p.distanceTo(d)}null==p&&null==d&&(p=s[0],d=s[1],l=1);var m=u-h!=0?(c-h)/(u-h):0,f=t.GeometryUtil.interpolateOnPointSegment(p,d,m);return{latLng:e.unproject(f,o),predecessor:l-1}},locateOnLine:function(e,i,n){var r=i.getLatLngs();if(n.equals(r[0]))return 0;if(n.equals(r[r.length-1]))return 1;for(var o=t.GeometryUtil.closest(e,i,n,!1),s=t.GeometryUtil.accumulatedLengths(r),a=s[s.length-1],l=0,c=!1,h=0,u=r.length-1;h<u;h++){var p=r[h],d=r[h+1];if(l=s[h],t.GeometryUtil.belongsSegment(o,p,d,.001)){l+=p.distanceTo(o),c=!0;break}}if(!c)throw"Could not interpolate "+n.toString()+" within "+i.toString();return l/a},reverse:function(e){return t.polyline(e.getLatLngs().slice(0).reverse())},extract:function(e,i,n,r){if(n>r)return t.GeometryUtil.extract(e,t.GeometryUtil.reverse(i),1-n,1-r);n=Math.max(Math.min(n,1),0),r=Math.max(Math.min(r,1),0);var o=i.getLatLngs(),s=t.GeometryUtil.interpolateOnLine(e,i,n),a=t.GeometryUtil.interpolateOnLine(e,i,r);if(n==r)return[t.GeometryUtil.interpolateOnLine(e,i,r).latLng];-1==s.predecessor&&(s.predecessor=0),-1==a.predecessor&&(a.predecessor=0);var l=o.slice(s.predecessor+1,a.predecessor+1);return l.unshift(s.latLng),l.push(a.latLng),l},isBefore:function(t,e){if(!e)return!1;var i=t.getLatLngs(),n=e.getLatLngs();return i[i.length-1].equals(n[0])},isAfter:function(t,e){if(!e)return!1;var i=t.getLatLngs(),n=e.getLatLngs();return i[0].equals(n[n.length-1])},startsAtExtremity:function(t,e){if(!e)return!1;var i=t.getLatLngs(),n=e.getLatLngs(),r=i[0];return r.equals(n[0])||r.equals(n[n.length-1])},computeAngle:function(t,e){return 180*Math.atan2(e.y-t.y,e.x-t.x)/Math.PI},computeSlope:function(t,e){var i=(e.y-t.y)/(e.x-t.x);return{a:i,b:t.y-i*t.x}},rotatePoint:function(e,i,n,r){var o=e.getMaxZoom();o===1/0&&(o=e.getZoom());var s=n*Math.PI/180,a=e.project(i,o),l=e.project(r,o),c=Math.cos(s)*(a.x-l.x)-Math.sin(s)*(a.y-l.y)+l.x,h=Math.sin(s)*(a.x-l.x)+Math.cos(s)*(a.y-l.y)+l.y;return e.unproject(new t.Point(c,h),o)},bearing:function(t,e){var i=Math.PI/180,n=t.lat*i,r=e.lat*i,o=t.lng*i,s=e.lng*i,a=Math.sin(s-o)*Math.cos(r),l=Math.cos(n)*Math.sin(r)-Math.sin(n)*Math.cos(r)*Math.cos(s-o),c=(180*Math.atan2(a,l)/Math.PI+360)%360;return c>=180?c-360:c},destination:function(e,i,n){i=(i+360)%360;var r=Math.PI/180,o=180/Math.PI,s=6378137,a=e.lng*r,l=e.lat*r,c=i*r,h=Math.sin(l),u=Math.cos(l),p=Math.cos(n/s),d=Math.sin(n/s),m=Math.asin(h*p+u*d*Math.cos(c)),f=a+Math.atan2(Math.sin(c)*d*u,p-h*Math.sin(m));return f=(f*=o)>180?f-360:f<-180?f+360:f,t.latLng([m*o,f])},angle:function(t,e,i){var n=t.latLngToContainerPoint(e),r=t.latLngToContainerPoint(i),o=180*Math.atan2(r.y-n.y,r.x-n.x)/Math.PI+90;return o+(o<0?360:0)},destinationOnSegment:function(e,i,n,r){var o=t.GeometryUtil.angle(e,i,n),s=t.GeometryUtil.destination(i,o,r);return t.GeometryUtil.closestOnSegment(e,s,i,n)}}),t.GeometryUtil}.apply(e,n))||(t.exports=r)},243:function(t,e){!function(t){"use strict";function e(t){var e,i,n,r;for(i=1,n=arguments.length;i<n;i++)for(e in r=arguments[i])t[e]=r[e];return t}var i=Object.create||function(){function t(){}return function(e){return t.prototype=e,new t}}();function n(t,e){var i=Array.prototype.slice;if(t.bind)return t.bind.apply(t,i.call(arguments,1));var n=i.call(arguments,2);return function(){return t.apply(e,n.length?n.concat(i.call(arguments)):arguments)}}var r=0;function o(t){return t._leaflet_id=t._leaflet_id||++r,t._leaflet_id}function s(t,e,i){var n,r,o,s;return s=function(){n=!1,r&&(o.apply(i,r),r=!1)},o=function(){n?r=arguments:(t.apply(i,arguments),setTimeout(s,e),n=!0)},o}function a(t,e,i){var n=e[1],r=e[0],o=n-r;return t===n&&i?t:((t-r)%o+o)%o+r}function l(){return!1}function c(t,e){var i=Math.pow(10,void 0===e?6:e);return Math.round(t*i)/i}function h(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function u(t){return h(t).split(/\s+/)}function p(t,e){for(var n in Object.prototype.hasOwnProperty.call(t,"options")||(t.options=t.options?i(t.options):{}),e)t.options[n]=e[n];return t.options}function d(t,e,i){var n=[];for(var r in t)n.push(encodeURIComponent(i?r.toUpperCase():r)+"="+encodeURIComponent(t[r]));return(e&&-1!==e.indexOf("?")?"&":"?")+n.join("&")}var m=/\{ *([\w_-]+) *\}/g;function f(t,e){return t.replace(m,(function(t,i){var n=e[i];if(void 0===n)throw new Error("No value provided for variable "+t);return"function"==typeof n&&(n=n(e)),n}))}var g=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function _(t,e){for(var i=0;i<t.length;i++)if(t[i]===e)return i;return-1}var y="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function v(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}var x=0;function b(t){var e=+new Date,i=Math.max(0,16-(e-x));return x=e+i,window.setTimeout(t,i)}var w=window.requestAnimationFrame||v("RequestAnimationFrame")||b,T=window.cancelAnimationFrame||v("CancelAnimationFrame")||v("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)};function E(t,e,i){if(!i||w!==b)return w.call(window,n(t,e));t.call(e)}function S(t){t&&T.call(window,t)}var P={extend:e,create:i,bind:n,lastId:r,stamp:o,throttle:s,wrapNum:a,falseFn:l,formatNum:c,trim:h,splitWords:u,setOptions:p,getParamString:d,template:f,isArray:g,indexOf:_,emptyImageUrl:y,requestFn:w,cancelFn:T,requestAnimFrame:E,cancelAnimFrame:S};function z(){}z.extend=function(t){var n=function(){this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},r=n.__super__=this.prototype,o=i(r);for(var s in o.constructor=n,n.prototype=o,this)Object.prototype.hasOwnProperty.call(this,s)&&"prototype"!==s&&"__super__"!==s&&(n[s]=this[s]);return t.statics&&(e(n,t.statics),delete t.statics),t.includes&&(function(t){if("undefined"!=typeof L&&L&&L.Mixin){t=g(t)?t:[t];for(var e=0;e<t.length;e++)t[e]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",(new Error).stack)}}(t.includes),e.apply(null,[o].concat(t.includes)),delete t.includes),o.options&&(t.options=e(i(o.options),t.options)),e(o,t),o._initHooks=[],o.callInitHooks=function(){if(!this._initHooksCalled){r.callInitHooks&&r.callInitHooks.call(this),this._initHooksCalled=!0;for(var t=0,e=o._initHooks.length;t<e;t++)o._initHooks[t].call(this)}},n},z.include=function(t){return e(this.prototype,t),this},z.mergeOptions=function(t){return e(this.prototype.options,t),this},z.addInitHook=function(t){var e=Array.prototype.slice.call(arguments,1),i="function"==typeof t?t:function(){this[t].apply(this,e)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(i),this};var C={on:function(t,e,i){if("object"==typeof t)for(var n in t)this._on(n,t[n],e);else for(var r=0,o=(t=u(t)).length;r<o;r++)this._on(t[r],e,i);return this},off:function(t,e,i){if(t)if("object"==typeof t)for(var n in t)this._off(n,t[n],e);else for(var r=0,o=(t=u(t)).length;r<o;r++)this._off(t[r],e,i);else delete this._events;return this},_on:function(t,e,i){this._events=this._events||{};var n=this._events[t];n||(n=[],this._events[t]=n),i===this&&(i=void 0);for(var r={fn:e,ctx:i},o=n,s=0,a=o.length;s<a;s++)if(o[s].fn===e&&o[s].ctx===i)return;o.push(r)},_off:function(t,e,i){var n,r,o;if(this._events&&(n=this._events[t]))if(e){if(i===this&&(i=void 0),n)for(r=0,o=n.length;r<o;r++){var s=n[r];if(s.ctx===i&&s.fn===e)return s.fn=l,this._firingCount&&(this._events[t]=n=n.slice()),void n.splice(r,1)}}else{for(r=0,o=n.length;r<o;r++)n[r].fn=l;delete this._events[t]}},fire:function(t,i,n){if(!this.listens(t,n))return this;var r=e({},i,{type:t,target:this,sourceTarget:i&&i.sourceTarget||this});if(this._events){var o=this._events[t];if(o){this._firingCount=this._firingCount+1||1;for(var s=0,a=o.length;s<a;s++){var l=o[s];l.fn.call(l.ctx||this,r)}this._firingCount--}}return n&&this._propagateEvent(r),this},listens:function(t,e){var i=this._events&&this._events[t];if(i&&i.length)return!0;if(e)for(var n in this._eventParents)if(this._eventParents[n].listens(t,e))return!0;return!1},once:function(t,e,i){if("object"==typeof t){for(var r in t)this.once(r,t[r],e);return this}var o=n((function(){this.off(t,e,i).off(t,o,i)}),this);return this.on(t,e,i).on(t,o,i)},addEventParent:function(t){return this._eventParents=this._eventParents||{},this._eventParents[o(t)]=t,this},removeEventParent:function(t){return this._eventParents&&delete this._eventParents[o(t)],this},_propagateEvent:function(t){for(var i in this._eventParents)this._eventParents[i].fire(t.type,e({layer:t.target,propagatedFrom:t.target},t),!0)}};C.addEventListener=C.on,C.removeEventListener=C.clearAllEventListeners=C.off,C.addOneTimeEventListener=C.once,C.fireEvent=C.fire,C.hasEventListeners=C.listens;var M=z.extend(C);function I(t,e,i){this.x=i?Math.round(t):t,this.y=i?Math.round(e):e}var A=Math.trunc||function(t){return t>0?Math.floor(t):Math.ceil(t)};function k(t,e,i){return t instanceof I?t:g(t)?new I(t[0],t[1]):null==t?t:"object"==typeof t&&"x"in t&&"y"in t?new I(t.x,t.y):new I(t,e,i)}function D(t,e){if(t)for(var i=e?[t,e]:t,n=0,r=i.length;n<r;n++)this.extend(i[n])}function B(t,e){return!t||t instanceof D?t:new D(t,e)}function R(t,e){if(t)for(var i=e?[t,e]:t,n=0,r=i.length;n<r;n++)this.extend(i[n])}function F(t,e){return t instanceof R?t:new R(t,e)}function O(t,e,i){if(isNaN(t)||isNaN(e))throw new Error("Invalid LatLng object: ("+t+", "+e+")");this.lat=+t,this.lng=+e,void 0!==i&&(this.alt=+i)}function U(t,e,i){return t instanceof O?t:g(t)&&"object"!=typeof t[0]?3===t.length?new O(t[0],t[1],t[2]):2===t.length?new O(t[0],t[1]):null:null==t?t:"object"==typeof t&&"lat"in t?new O(t.lat,"lng"in t?t.lng:t.lon,t.alt):void 0===e?null:new O(t,e,i)}I.prototype={clone:function(){return new I(this.x,this.y)},add:function(t){return this.clone()._add(k(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(k(t))},_subtract:function(t){return this.x-=t.x,this.y-=t.y,this},divideBy:function(t){return this.clone()._divideBy(t)},_divideBy:function(t){return this.x/=t,this.y/=t,this},multiplyBy:function(t){return this.clone()._multiplyBy(t)},_multiplyBy:function(t){return this.x*=t,this.y*=t,this},scaleBy:function(t){return new I(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new I(this.x/t.x,this.y/t.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=A(this.x),this.y=A(this.y),this},distanceTo:function(t){var e=(t=k(t)).x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)},equals:function(t){return(t=k(t)).x===this.x&&t.y===this.y},contains:function(t){return t=k(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+c(this.x)+", "+c(this.y)+")"}},D.prototype={extend:function(t){return t=k(t),this.min||this.max?(this.min.x=Math.min(t.x,this.min.x),this.max.x=Math.max(t.x,this.max.x),this.min.y=Math.min(t.y,this.min.y),this.max.y=Math.max(t.y,this.max.y)):(this.min=t.clone(),this.max=t.clone()),this},getCenter:function(t){return new I((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},getBottomLeft:function(){return new I(this.min.x,this.max.y)},getTopRight:function(){return new I(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(t){var e,i;return(t="number"==typeof t[0]||t instanceof I?k(t):B(t))instanceof D?(e=t.min,i=t.max):e=i=t,e.x>=this.min.x&&i.x<=this.max.x&&e.y>=this.min.y&&i.y<=this.max.y},intersects:function(t){t=B(t);var e=this.min,i=this.max,n=t.min,r=t.max,o=r.x>=e.x&&n.x<=i.x,s=r.y>=e.y&&n.y<=i.y;return o&&s},overlaps:function(t){t=B(t);var e=this.min,i=this.max,n=t.min,r=t.max,o=r.x>e.x&&n.x<i.x,s=r.y>e.y&&n.y<i.y;return o&&s},isValid:function(){return!(!this.min||!this.max)}},R.prototype={extend:function(t){var e,i,n=this._southWest,r=this._northEast;if(t instanceof O)e=t,i=t;else{if(!(t instanceof R))return t?this.extend(U(t)||F(t)):this;if(e=t._southWest,i=t._northEast,!e||!i)return this}return n||r?(n.lat=Math.min(e.lat,n.lat),n.lng=Math.min(e.lng,n.lng),r.lat=Math.max(i.lat,r.lat),r.lng=Math.max(i.lng,r.lng)):(this._southWest=new O(e.lat,e.lng),this._northEast=new O(i.lat,i.lng)),this},pad:function(t){var e=this._southWest,i=this._northEast,n=Math.abs(e.lat-i.lat)*t,r=Math.abs(e.lng-i.lng)*t;return new R(new O(e.lat-n,e.lng-r),new O(i.lat+n,i.lng+r))},getCenter:function(){return new O((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new O(this.getNorth(),this.getWest())},getSouthEast:function(){return new O(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(t){t="number"==typeof t[0]||t instanceof O||"lat"in t?U(t):F(t);var e,i,n=this._southWest,r=this._northEast;return t instanceof R?(e=t.getSouthWest(),i=t.getNorthEast()):e=i=t,e.lat>=n.lat&&i.lat<=r.lat&&e.lng>=n.lng&&i.lng<=r.lng},intersects:function(t){t=F(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),r=t.getNorthEast(),o=r.lat>=e.lat&&n.lat<=i.lat,s=r.lng>=e.lng&&n.lng<=i.lng;return o&&s},overlaps:function(t){t=F(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),r=t.getNorthEast(),o=r.lat>e.lat&&n.lat<i.lat,s=r.lng>e.lng&&n.lng<i.lng;return o&&s},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(t,e){return!!t&&(t=F(t),this._southWest.equals(t.getSouthWest(),e)&&this._northEast.equals(t.getNorthEast(),e))},isValid:function(){return!(!this._southWest||!this._northEast)}},O.prototype={equals:function(t,e){return!!t&&(t=U(t),Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng))<=(void 0===e?1e-9:e))},toString:function(t){return"LatLng("+c(this.lat,t)+", "+c(this.lng,t)+")"},distanceTo:function(t){return Z.distance(this,U(t))},wrap:function(){return Z.wrapLatLng(this)},toBounds:function(t){var e=180*t/40075017,i=e/Math.cos(Math.PI/180*this.lat);return F([this.lat-e,this.lng-i],[this.lat+e,this.lng+i])},clone:function(){return new O(this.lat,this.lng,this.alt)}};var V,N={latLngToPoint:function(t,e){var i=this.projection.project(t),n=this.scale(e);return this.transformation._transform(i,n)},pointToLatLng:function(t,e){var i=this.scale(e),n=this.transformation.untransform(t,i);return this.projection.unproject(n)},project:function(t){return this.projection.project(t)},unproject:function(t){return this.projection.unproject(t)},scale:function(t){return 256*Math.pow(2,t)},zoom:function(t){return Math.log(t/256)/Math.LN2},getProjectedBounds:function(t){if(this.infinite)return null;var e=this.projection.bounds,i=this.scale(t);return new D(this.transformation.transform(e.min,i),this.transformation.transform(e.max,i))},infinite:!1,wrapLatLng:function(t){var e=this.wrapLng?a(t.lng,this.wrapLng,!0):t.lng;return new O(this.wrapLat?a(t.lat,this.wrapLat,!0):t.lat,e,t.alt)},wrapLatLngBounds:function(t){var e=t.getCenter(),i=this.wrapLatLng(e),n=e.lat-i.lat,r=e.lng-i.lng;if(0===n&&0===r)return t;var o=t.getSouthWest(),s=t.getNorthEast();return new R(new O(o.lat-n,o.lng-r),new O(s.lat-n,s.lng-r))}},Z=e({},N,{wrapLng:[-180,180],R:6371e3,distance:function(t,e){var i=Math.PI/180,n=t.lat*i,r=e.lat*i,o=Math.sin((e.lat-t.lat)*i/2),s=Math.sin((e.lng-t.lng)*i/2),a=o*o+Math.cos(n)*Math.cos(r)*s*s,l=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));return this.R*l}}),j=6378137,q={R:j,MAX_LATITUDE:85.0511287798,project:function(t){var e=Math.PI/180,i=this.MAX_LATITUDE,n=Math.max(Math.min(i,t.lat),-i),r=Math.sin(n*e);return new I(this.R*t.lng*e,this.R*Math.log((1+r)/(1-r))/2)},unproject:function(t){var e=180/Math.PI;return new O((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*e,t.x*e/this.R)},bounds:(V=j*Math.PI,new D([-V,-V],[V,V]))};function $(t,e,i,n){if(g(t))return this._a=t[0],this._b=t[1],this._c=t[2],void(this._d=t[3]);this._a=t,this._b=e,this._c=i,this._d=n}function G(t,e,i,n){return new $(t,e,i,n)}$.prototype={transform:function(t,e){return this._transform(t.clone(),e)},_transform:function(t,e){return e=e||1,t.x=e*(this._a*t.x+this._b),t.y=e*(this._c*t.y+this._d),t},untransform:function(t,e){return e=e||1,new I((t.x/e-this._b)/this._a,(t.y/e-this._d)/this._c)}};var H=e({},Z,{code:"EPSG:3857",projection:q,transformation:function(){var t=.5/(Math.PI*q.R);return G(t,.5,-t,.5)}()}),W=e({},H,{code:"EPSG:900913"});function X(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function K(t,e){var i,n,r,o,s,a,l="";for(i=0,r=t.length;i<r;i++){for(n=0,o=(s=t[i]).length;n<o;n++)l+=(n?"L":"M")+(a=s[n]).x+" "+a.y;l+=e?Ct?"z":"x":""}return l||"M0 0"}var Y=document.documentElement.style,J="ActiveXObject"in window,Q=J&&!document.addEventListener,tt="msLaunchUri"in navigator&&!("documentMode"in document),et=It("webkit"),it=It("android"),nt=It("android 2")||It("android 3"),rt=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),ot=it&&It("Google")&&rt<537&&!("AudioNode"in window),st=!!window.opera,at=!tt&&It("chrome"),lt=It("gecko")&&!et&&!st&&!J,ct=!at&&It("safari"),ht=It("phantom"),ut="OTransition"in Y,pt=0===navigator.platform.indexOf("Win"),dt=J&&"transition"in Y,mt="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!nt,ft="MozPerspective"in Y,gt=!window.L_DISABLE_3D&&(dt||mt||ft)&&!ut&&!ht,_t="undefined"!=typeof orientation||It("mobile"),yt=_t&&et,vt=_t&&mt,xt=!window.PointerEvent&&window.MSPointerEvent,bt=!(!window.PointerEvent&&!xt),wt=!window.L_NO_TOUCH&&(bt||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch),Tt=_t&&st,Et=_t&&lt,St=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,Pt=function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassiveEventSupport",l,e),window.removeEventListener("testPassiveEventSupport",l,e)}catch(t){}return t}(),zt=!!document.createElement("canvas").getContext,Ct=!(!document.createElementNS||!X("svg").createSVGRect),Mt=!Ct&&function(){try{var t=document.createElement("div");t.innerHTML='<v:shape adj="1"/>';var e=t.firstChild;return e.style.behavior="url(#default#VML)",e&&"object"==typeof e.adj}catch(t){return!1}}();function It(t){return navigator.userAgent.toLowerCase().indexOf(t)>=0}var At={ie:J,ielt9:Q,edge:tt,webkit:et,android:it,android23:nt,androidStock:ot,opera:st,chrome:at,gecko:lt,safari:ct,phantom:ht,opera12:ut,win:pt,ie3d:dt,webkit3d:mt,gecko3d:ft,any3d:gt,mobile:_t,mobileWebkit:yt,mobileWebkit3d:vt,msPointer:xt,pointer:bt,touch:wt,mobileOpera:Tt,mobileGecko:Et,retina:St,passiveEvents:Pt,canvas:zt,svg:Ct,vml:Mt},kt=xt?"MSPointerDown":"pointerdown",Lt=xt?"MSPointerMove":"pointermove",Dt=xt?"MSPointerUp":"pointerup",Bt=xt?"MSPointerCancel":"pointercancel",Rt={},Ft=!1;function Ot(t,e,i,r){return"touchstart"===e?function(t,e,i){var r=n((function(t){t.MSPOINTER_TYPE_TOUCH&&t.pointerType===t.MSPOINTER_TYPE_TOUCH&&Be(t),Zt(t,e)}));t["_leaflet_touchstart"+i]=r,t.addEventListener(kt,r,!1),Ft||(document.addEventListener(kt,Ut,!0),document.addEventListener(Lt,Vt,!0),document.addEventListener(Dt,Nt,!0),document.addEventListener(Bt,Nt,!0),Ft=!0)}(t,i,r):"touchmove"===e?function(t,e,i){var n=function(t){t.pointerType===(t.MSPOINTER_TYPE_MOUSE||"mouse")&&0===t.buttons||Zt(t,e)};t["_leaflet_touchmove"+i]=n,t.addEventListener(Lt,n,!1)}(t,i,r):"touchend"===e&&function(t,e,i){var n=function(t){Zt(t,e)};t["_leaflet_touchend"+i]=n,t.addEventListener(Dt,n,!1),t.addEventListener(Bt,n,!1)}(t,i,r),this}function Ut(t){Rt[t.pointerId]=t}function Vt(t){Rt[t.pointerId]&&(Rt[t.pointerId]=t)}function Nt(t){delete Rt[t.pointerId]}function Zt(t,e){for(var i in t.touches=[],Rt)t.touches.push(Rt[i]);t.changedTouches=[t],e(t)}var jt=xt?"MSPointerDown":bt?"pointerdown":"touchstart",qt=xt?"MSPointerUp":bt?"pointerup":"touchend",$t="_leaflet_";var Gt,Ht,Wt,Xt,Kt,Yt=de(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),Jt=de(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Qt="webkitTransition"===Jt||"OTransition"===Jt?Jt+"End":"transitionend";function te(t){return"string"==typeof t?document.getElementById(t):t}function ee(t,e){var i=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!i||"auto"===i)&&document.defaultView){var n=document.defaultView.getComputedStyle(t,null);i=n?n[e]:null}return"auto"===i?null:i}function ie(t,e,i){var n=document.createElement(t);return n.className=e||"",i&&i.appendChild(n),n}function ne(t){var e=t.parentNode;e&&e.removeChild(t)}function re(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function oe(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function se(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function ae(t,e){if(void 0!==t.classList)return t.classList.contains(e);var i=ue(t);return i.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(i)}function le(t,e){if(void 0!==t.classList)for(var i=u(e),n=0,r=i.length;n<r;n++)t.classList.add(i[n]);else if(!ae(t,e)){var o=ue(t);he(t,(o?o+" ":"")+e)}}function ce(t,e){void 0!==t.classList?t.classList.remove(e):he(t,h((" "+ue(t)+" ").replace(" "+e+" "," ")))}function he(t,e){void 0===t.className.baseVal?t.className=e:t.className.baseVal=e}function ue(t){return t.correspondingElement&&(t=t.correspondingElement),void 0===t.className.baseVal?t.className:t.className.baseVal}function pe(t,e){"opacity"in t.style?t.style.opacity=e:"filter"in t.style&&function(t,e){var i=!1,n="DXImageTransform.Microsoft.Alpha";try{i=t.filters.item(n)}catch(t){if(1===e)return}e=Math.round(100*e),i?(i.Enabled=100!==e,i.Opacity=e):t.style.filter+=" progid:"+n+"(opacity="+e+")"}(t,e)}function de(t){for(var e=document.documentElement.style,i=0;i<t.length;i++)if(t[i]in e)return t[i];return!1}function me(t,e,i){var n=e||new I(0,0);t.style[Yt]=(dt?"translate("+n.x+"px,"+n.y+"px)":"translate3d("+n.x+"px,"+n.y+"px,0)")+(i?" scale("+i+")":"")}function fe(t,e){t._leaflet_pos=e,gt?me(t,e):(t.style.left=e.x+"px",t.style.top=e.y+"px")}function ge(t){return t._leaflet_pos||new I(0,0)}if("onselectstart"in document)Gt=function(){Se(window,"selectstart",Be)},Ht=function(){ze(window,"selectstart",Be)};else{var _e=de(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);Gt=function(){if(_e){var t=document.documentElement.style;Wt=t[_e],t[_e]="none"}},Ht=function(){_e&&(document.documentElement.style[_e]=Wt,Wt=void 0)}}function ye(){Se(window,"dragstart",Be)}function ve(){ze(window,"dragstart",Be)}function xe(t){for(;-1===t.tabIndex;)t=t.parentNode;t.style&&(be(),Xt=t,Kt=t.style.outline,t.style.outline="none",Se(window,"keydown",be))}function be(){Xt&&(Xt.style.outline=Kt,Xt=void 0,Kt=void 0,ze(window,"keydown",be))}function we(t){do{t=t.parentNode}while(!(t.offsetWidth&&t.offsetHeight||t===document.body));return t}function Te(t){var e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}var Ee={TRANSFORM:Yt,TRANSITION:Jt,TRANSITION_END:Qt,get:te,getStyle:ee,create:ie,remove:ne,empty:re,toFront:oe,toBack:se,hasClass:ae,addClass:le,removeClass:ce,setClass:he,getClass:ue,setOpacity:pe,testProp:de,setTransform:me,setPosition:fe,getPosition:ge,disableTextSelection:Gt,enableTextSelection:Ht,disableImageDrag:ye,enableImageDrag:ve,preventOutline:xe,restoreOutline:be,getSizedParentNode:we,getScale:Te};function Se(t,e,i,n){if("object"==typeof e)for(var r in e)Ie(t,r,e[r],i);else for(var o=0,s=(e=u(e)).length;o<s;o++)Ie(t,e[o],i,n);return this}var Pe="_leaflet_events";function ze(t,e,i,n){if("object"==typeof e)for(var r in e)Ae(t,r,e[r],i);else if(e)for(var o=0,s=(e=u(e)).length;o<s;o++)Ae(t,e[o],i,n);else{for(var a in t[Pe])Ae(t,a,t[Pe][a]);delete t[Pe]}return this}function Ce(){if(bt)return!(tt||ct)}var Me={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function Ie(t,e,i,n){var r=e+o(i)+(n?"_"+o(n):"");if(t[Pe]&&t[Pe][r])return this;var s=function(e){return i.call(n||t,e||window.event)},a=s;bt&&0===e.indexOf("touch")?Ot(t,e,s,r):wt&&"dblclick"===e&&!Ce()?function(t,e,i){var n,r,o=!1;function s(t){if(bt){if(!t.isPrimary)return;if("mouse"===t.pointerType)return}else if(t.touches.length>1)return;var e=Date.now(),i=e-(n||e);r=t.touches?t.touches[0]:t,o=i>0&&i<=250,n=e}function a(t){if(o&&!r.cancelBubble){if(bt){if("mouse"===t.pointerType)return;var i,s,a={};for(s in r)i=r[s],a[s]=i&&i.bind?i.bind(r):i;r=a}r.type="dblclick",r.button=0,e(r),n=null}}t[$t+jt+i]=s,t[$t+qt+i]=a,t[$t+"dblclick"+i]=e,t.addEventListener(jt,s,!!Pt&&{passive:!1}),t.addEventListener(qt,a,!!Pt&&{passive:!1}),t.addEventListener("dblclick",e,!1)}(t,s,r):"addEventListener"in t?"touchstart"===e||"touchmove"===e||"wheel"===e||"mousewheel"===e?t.addEventListener(Me[e]||e,s,!!Pt&&{passive:!1}):"mouseenter"===e||"mouseleave"===e?(s=function(e){e=e||window.event,je(t,e)&&a(e)},t.addEventListener(Me[e],s,!1)):t.addEventListener(e,a,!1):"attachEvent"in t&&t.attachEvent("on"+e,s),t[Pe]=t[Pe]||{},t[Pe][r]=s}function Ae(t,e,i,n){var r=e+o(i)+(n?"_"+o(n):""),s=t[Pe]&&t[Pe][r];if(!s)return this;bt&&0===e.indexOf("touch")?function(t,e,i){var n=t["_leaflet_"+e+i];"touchstart"===e?t.removeEventListener(kt,n,!1):"touchmove"===e?t.removeEventListener(Lt,n,!1):"touchend"===e&&(t.removeEventListener(Dt,n,!1),t.removeEventListener(Bt,n,!1))}(t,e,r):wt&&"dblclick"===e&&!Ce()?function(t,e){var i=t[$t+jt+e],n=t[$t+qt+e],r=t[$t+"dblclick"+e];t.removeEventListener(jt,i,!!Pt&&{passive:!1}),t.removeEventListener(qt,n,!!Pt&&{passive:!1}),t.removeEventListener("dblclick",r,!1)}(t,r):"removeEventListener"in t?t.removeEventListener(Me[e]||e,s,!1):"detachEvent"in t&&t.detachEvent("on"+e,s),t[Pe][r]=null}function ke(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,Ze(t),this}function Le(t){return Ie(t,"wheel",ke),this}function De(t){return Se(t,"mousedown touchstart dblclick",ke),Ie(t,"click",Ne),this}function Be(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function Re(t){return Be(t),ke(t),this}function Fe(t,e){if(!e)return new I(t.clientX,t.clientY);var i=Te(e),n=i.boundingClientRect;return new I((t.clientX-n.left)/i.x-e.clientLeft,(t.clientY-n.top)/i.y-e.clientTop)}var Oe=pt&&at?2*window.devicePixelRatio:lt?window.devicePixelRatio:1;function Ue(t){return tt?t.wheelDeltaY/2:t.deltaY&&0===t.deltaMode?-t.deltaY/Oe:t.deltaY&&1===t.deltaMode?20*-t.deltaY:t.deltaY&&2===t.deltaMode?60*-t.deltaY:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?20*-t.detail:t.detail?t.detail/-32765*60:0}var Ve={};function Ne(t){Ve[t.type]=!0}function Ze(t){var e=Ve[t.type];return Ve[t.type]=!1,e}function je(t,e){var i=e.relatedTarget;if(!i)return!0;try{for(;i&&i!==t;)i=i.parentNode}catch(t){return!1}return i!==t}var qe={on:Se,off:ze,stopPropagation:ke,disableScrollPropagation:Le,disableClickPropagation:De,preventDefault:Be,stop:Re,getMousePosition:Fe,getWheelDelta:Ue,fakeStop:Ne,skipped:Ze,isExternalTarget:je,addListener:Se,removeListener:ze},$e=M.extend({run:function(t,e,i,n){this.stop(),this._el=t,this._inProgress=!0,this._duration=i||.25,this._easeOutPower=1/Math.max(n||.5,.2),this._startPos=ge(t),this._offset=e.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=E(this._animate,this),this._step()},_step:function(t){var e=+new Date-this._startTime,i=1e3*this._duration;e<i?this._runFrame(this._easeOut(e/i),t):(this._runFrame(1),this._complete())},_runFrame:function(t,e){var i=this._startPos.add(this._offset.multiplyBy(t));e&&i._round(),fe(this._el,i),this.fire("step")},_complete:function(){S(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(t){return 1-Math.pow(1-t,this._easeOutPower)}}),Ge=M.extend({options:{crs:H,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(t,e){e=p(this,e),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(t),this._initLayout(),this._onResize=n(this._onResize,this),this._initEvents(),e.maxBounds&&this.setMaxBounds(e.maxBounds),void 0!==e.zoom&&(this._zoom=this._limitZoom(e.zoom)),e.center&&void 0!==e.zoom&&this.setView(U(e.center),e.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=Jt&&gt&&!Tt&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),Se(this._proxy,Qt,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(t,i,n){return i=void 0===i?this._zoom:this._limitZoom(i),t=this._limitCenter(U(t),i,this.options.maxBounds),n=n||{},this._stop(),this._loaded&&!n.reset&&!0!==n&&(void 0!==n.animate&&(n.zoom=e({animate:n.animate},n.zoom),n.pan=e({animate:n.animate,duration:n.duration},n.pan)),this._zoom!==i?this._tryAnimatedZoom&&this._tryAnimatedZoom(t,i,n.zoom):this._tryAnimatedPan(t,n.pan))?(clearTimeout(this._sizeTimer),this):(this._resetView(t,i),this)},setZoom:function(t,e){return this._loaded?this.setView(this.getCenter(),t,{zoom:e}):(this._zoom=t,this)},zoomIn:function(t,e){return t=t||(gt?this.options.zoomDelta:1),this.setZoom(this._zoom+t,e)},zoomOut:function(t,e){return t=t||(gt?this.options.zoomDelta:1),this.setZoom(this._zoom-t,e)},setZoomAround:function(t,e,i){var n=this.getZoomScale(e),r=this.getSize().divideBy(2),o=(t instanceof I?t:this.latLngToContainerPoint(t)).subtract(r).multiplyBy(1-1/n),s=this.containerPointToLatLng(r.add(o));return this.setView(s,e,{zoom:i})},_getBoundsCenterZoom:function(t,e){e=e||{},t=t.getBounds?t.getBounds():F(t);var i=k(e.paddingTopLeft||e.padding||[0,0]),n=k(e.paddingBottomRight||e.padding||[0,0]),r=this.getBoundsZoom(t,!1,i.add(n));if((r="number"==typeof e.maxZoom?Math.min(e.maxZoom,r):r)===1/0)return{center:t.getCenter(),zoom:r};var o=n.subtract(i).divideBy(2),s=this.project(t.getSouthWest(),r),a=this.project(t.getNorthEast(),r);return{center:this.unproject(s.add(a).divideBy(2).add(o),r),zoom:r}},fitBounds:function(t,e){if(!(t=F(t)).isValid())throw new Error("Bounds are not valid.");var i=this._getBoundsCenterZoom(t,e);return this.setView(i.center,i.zoom,e)},fitWorld:function(t){return this.fitBounds([[-90,-180],[90,180]],t)},panTo:function(t,e){return this.setView(t,this._zoom,{pan:e})},panBy:function(t,e){if(e=e||{},!(t=k(t).round()).x&&!t.y)return this.fire("moveend");if(!0!==e.animate&&!this.getSize().contains(t))return this._resetView(this.unproject(this.project(this.getCenter()).add(t)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new $e,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),e.noMoveStart||this.fire("movestart"),!1!==e.animate){le(this._mapPane,"leaflet-pan-anim");var i=this._getMapPanePos().subtract(t).round();this._panAnim.run(this._mapPane,i,e.duration||.25,e.easeLinearity)}else this._rawPanBy(t),this.fire("move").fire("moveend");return this},flyTo:function(t,e,i){if(!1===(i=i||{}).animate||!gt)return this.setView(t,e,i);this._stop();var n=this.project(this.getCenter()),r=this.project(t),o=this.getSize(),s=this._zoom;t=U(t),e=void 0===e?s:e;var a=Math.max(o.x,o.y),l=a*this.getZoomScale(s,e),c=r.distanceTo(n)||1,h=1.42,u=2.0164;function p(t){var e=(l*l-a*a+(t?-1:1)*u*u*c*c)/(2*(t?l:a)*u*c),i=Math.sqrt(e*e+1)-e;return i<1e-9?-18:Math.log(i)}function d(t){return(Math.exp(t)-Math.exp(-t))/2}function m(t){return(Math.exp(t)+Math.exp(-t))/2}var f=p(0);function g(t){return a*(m(f)*(d(e=f+h*t)/m(e))-d(f))/u;var e}var _=Date.now(),y=(p(1)-f)/h,v=i.duration?1e3*i.duration:1e3*y*.8;return this._moveStart(!0,i.noMoveStart),function i(){var o=(Date.now()-_)/v,l=function(t){return 1-Math.pow(1-t,1.5)}(o)*y;o<=1?(this._flyToFrame=E(i,this),this._move(this.unproject(n.add(r.subtract(n).multiplyBy(g(l)/c)),s),this.getScaleZoom(a/function(t){return a*(m(f)/m(f+h*t))}(l),s),{flyTo:!0})):this._move(t,e)._moveEnd(!0)}.call(this),this},flyToBounds:function(t,e){var i=this._getBoundsCenterZoom(t,e);return this.flyTo(i.center,i.zoom,e)},setMaxBounds:function(t){return(t=F(t)).isValid()?(this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this.options.maxBounds=t,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this.off("moveend",this._panInsideMaxBounds))},setMinZoom:function(t){var e=this.options.minZoom;return this.options.minZoom=t,this._loaded&&e!==t&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(t):this},setMaxZoom:function(t){var e=this.options.maxZoom;return this.options.maxZoom=t,this._loaded&&e!==t&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,e){this._enforcingBounds=!0;var i=this.getCenter(),n=this._limitCenter(i,this._zoom,F(t));return i.equals(n)||this.panTo(n,e),this._enforcingBounds=!1,this},panInside:function(t,e){var i=k((e=e||{}).paddingTopLeft||e.padding||[0,0]),n=k(e.paddingBottomRight||e.padding||[0,0]),r=this.getCenter(),o=this.project(r),s=this.project(t),a=this.getPixelBounds(),l=a.getSize().divideBy(2),c=B([a.min.add(i),a.max.subtract(n)]);if(!c.contains(s)){this._enforcingBounds=!0;var h=o.subtract(s),u=k(s.x+h.x,s.y+h.y);(s.x<c.min.x||s.x>c.max.x)&&(u.x=o.x-h.x,h.x>0?u.x+=l.x-i.x:u.x-=l.x-n.x),(s.y<c.min.y||s.y>c.max.y)&&(u.y=o.y-h.y,h.y>0?u.y+=l.y-i.y:u.y-=l.y-n.y),this.panTo(this.unproject(u),e),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=e({animate:!1,pan:!0},!0===t?{animate:!0}:t);var i=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var r=this.getSize(),o=i.divideBy(2).round(),s=r.divideBy(2).round(),a=o.subtract(s);return a.x||a.y?(t.animate&&t.pan?this.panBy(a):(t.pan&&this._rawPanBy(a),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(n(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:i,newSize:r})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=e({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var i=n(this._handleGeolocationResponse,this),r=n(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(i,r,t):navigator.geolocation.getCurrentPosition(i,r,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var e=t.code,i=t.message||(1===e?"permission denied":2===e?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+i+"."})},_handleGeolocationResponse:function(t){var e=new O(t.coords.latitude,t.coords.longitude),i=e.toBounds(2*t.coords.accuracy),n=this._locateOptions;if(n.setView){var r=this.getBoundsZoom(i);this.setView(e,n.maxZoom?Math.min(r,n.maxZoom):r)}var o={latlng:e,bounds:i,timestamp:t.timestamp};for(var s in t.coords)"number"==typeof t.coords[s]&&(o[s]=t.coords[s]);this.fire("locationfound",o)},addHandler:function(t,e){if(!e)return this;var i=this[t]=new e(this);return this._handlers.push(i),this.options[t]&&i.enable(),this},remove:function(){if(this._initEvents(!0),this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}var t;for(t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),ne(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(S(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)ne(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){var i=ie("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),e||this._mapPane);return t&&(this._panes[t]=i),i},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter:this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new R(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,i){t=F(t),i=k(i||[0,0]);var n=this.getZoom()||0,r=this.getMinZoom(),o=this.getMaxZoom(),s=t.getNorthWest(),a=t.getSouthEast(),l=this.getSize().subtract(i),c=B(this.project(a,n),this.project(s,n)).getSize(),h=gt?this.options.zoomSnap:1,u=l.x/c.x,p=l.y/c.y,d=e?Math.max(u,p):Math.min(u,p);return n=this.getScaleZoom(d,n),h&&(n=Math.round(n/(h/100))*(h/100),n=e?Math.ceil(n/h)*h:Math.floor(n/h)*h),Math.max(r,Math.min(o,n))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new I(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){var i=this._getTopLeftPoint(t,e);return new D(i,i.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var i=this.options.crs;return e=void 0===e?this._zoom:e,i.scale(t)/i.scale(e)},getScaleZoom:function(t,e){var i=this.options.crs;e=void 0===e?this._zoom:e;var n=i.zoom(t*i.scale(e));return isNaN(n)?1/0:n},project:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.latLngToPoint(U(t),e)},unproject:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.pointToLatLng(k(t),e)},layerPointToLatLng:function(t){var e=k(t).add(this.getPixelOrigin());return this.unproject(e)},latLngToLayerPoint:function(t){return this.project(U(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(U(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(F(t))},distance:function(t,e){return this.options.crs.distance(U(t),U(e))},containerPointToLayerPoint:function(t){return k(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return k(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var e=this.containerPointToLayerPoint(k(t));return this.layerPointToLatLng(e)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(U(t)))},mouseEventToContainerPoint:function(t){return Fe(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){var e=this._container=te(t);if(!e)throw new Error("Map container not found.");if(e._leaflet_id)throw new Error("Map container is already initialized.");Se(e,"scroll",this._onScroll,this),this._containerId=o(e)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&gt,le(t,"leaflet-container"+(wt?" leaflet-touch":"")+(St?" leaflet-retina":"")+(Q?" leaflet-oldie":"")+(ct?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var e=ee(t,"position");"absolute"!==e&&"relative"!==e&&"fixed"!==e&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),fe(this._mapPane,new I(0,0)),this.createPane("tilePane"),this.createPane("shadowPane"),this.createPane("overlayPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(le(t.markerPane,"leaflet-zoom-hide"),le(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e){fe(this._mapPane,new I(0,0));var i=!this._loaded;this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset");var n=this._zoom!==e;this._moveStart(n,!1)._move(t,e)._moveEnd(n),this.fire("viewreset"),i&&this.fire("load")},_moveStart:function(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this},_move:function(t,e,i){void 0===e&&(e=this._zoom);var n=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),(n||i&&i.pinch)&&this.fire("zoom",i),this.fire("move",i)},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return S(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){fe(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={},this._targets[o(this._container)]=this;var e=t?ze:Se;e(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&e(window,"resize",this._onResize,this),gt&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){S(this._resizeRequest),this._resizeRequest=E((function(){this.invalidateSize({debounceMoveend:!0})}),this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,e){for(var i,n=[],r="mouseout"===e||"mouseover"===e,s=t.target||t.srcElement,a=!1;s;){if((i=this._targets[o(s)])&&("click"===e||"preclick"===e)&&!t._simulated&&this._draggableMoved(i)){a=!0;break}if(i&&i.listens(e,!0)){if(r&&!je(s,t))break;if(n.push(i),r)break}if(s===this._container)break;s=s.parentNode}return n.length||a||r||!je(s,t)||(n=[this]),n},_handleDOMEvent:function(t){if(this._loaded&&!Ze(t)){var e=t.type;"mousedown"!==e&&"keypress"!==e&&"keyup"!==e&&"keydown"!==e||xe(t.target||t.srcElement),this._fireDOMEvent(t,e)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,i,n){if("click"===t.type){var r=e({},t);r.type="preclick",this._fireDOMEvent(r,r.type,n)}if(!t._stopped&&(n=(n||[]).concat(this._findEventTargets(t,i))).length){var o=n[0];"contextmenu"===i&&o.listens(i,!0)&&Be(t);var s={originalEvent:t};if("keypress"!==t.type&&"keydown"!==t.type&&"keyup"!==t.type){var a=o.getLatLng&&(!o._radius||o._radius<=10);s.containerPoint=a?this.latLngToContainerPoint(o.getLatLng()):this.mouseEventToContainerPoint(t),s.layerPoint=this.containerPointToLayerPoint(s.containerPoint),s.latlng=a?o.getLatLng():this.layerPointToLatLng(s.layerPoint)}for(var l=0;l<n.length;l++)if(n[l].fire(i,s,!0),s.originalEvent._stopped||!1===n[l].options.bubblingMouseEvents&&-1!==_(this._mouseEvents,i))return}},_draggableMoved:function(t){return(t=t.dragging&&t.dragging.enabled()?t:this).dragging&&t.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var t=0,e=this._handlers.length;t<e;t++)this._handlers[t].disable()},whenReady:function(t,e){return this._loaded?t.call(e||this,{target:this}):this.on("load",t,e),this},_getMapPanePos:function(){return ge(this._mapPane)||new I(0,0)},_moved:function(){var t=this._getMapPanePos();return t&&!t.equals([0,0])},_getTopLeftPoint:function(t,e){return(t&&void 0!==e?this._getNewPixelOrigin(t,e):this.getPixelOrigin()).subtract(this._getMapPanePos())},_getNewPixelOrigin:function(t,e){var i=this.getSize()._divideBy(2);return this.project(t,e)._subtract(i)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(t,e,i){var n=this._getNewPixelOrigin(i,e);return this.project(t,e)._subtract(n)},_latLngBoundsToNewLayerBounds:function(t,e,i){var n=this._getNewPixelOrigin(i,e);return B([this.project(t.getSouthWest(),e)._subtract(n),this.project(t.getNorthWest(),e)._subtract(n),this.project(t.getSouthEast(),e)._subtract(n),this.project(t.getNorthEast(),e)._subtract(n)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(t){return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint())},_limitCenter:function(t,e,i){if(!i)return t;var n=this.project(t,e),r=this.getSize().divideBy(2),o=new D(n.subtract(r),n.add(r)),s=this._getBoundsOffset(o,i,e);return s.round().equals([0,0])?t:this.unproject(n.add(s),e)},_limitOffset:function(t,e){if(!e)return t;var i=this.getPixelBounds(),n=new D(i.min.add(t),i.max.add(t));return t.add(this._getBoundsOffset(n,e))},_getBoundsOffset:function(t,e,i){var n=B(this.project(e.getNorthEast(),i),this.project(e.getSouthWest(),i)),r=n.min.subtract(t.min),o=n.max.subtract(t.max);return new I(this._rebound(r.x,-o.x),this._rebound(r.y,-o.y))},_rebound:function(t,e){return t+e>0?Math.round(t-e)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(e))},_limitZoom:function(t){var e=this.getMinZoom(),i=this.getMaxZoom(),n=gt?this.options.zoomSnap:1;return n&&(t=Math.round(t/n)*n),Math.max(e,Math.min(i,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){ce(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,e){var i=this._getCenterOffset(t)._trunc();return!(!0!==(e&&e.animate)&&!this.getSize().contains(i)||(this.panBy(i,e),0))},_createAnimProxy:function(){var t=this._proxy=ie("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",(function(t){var e=Yt,i=this._proxy.style[e];me(this._proxy,this.project(t.center,t.zoom),this.getZoomScale(t.zoom,1)),i===this._proxy.style[e]&&this._animatingZoom&&this._onZoomTransitionEnd()}),this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){ne(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var t=this.getCenter(),e=this.getZoom();me(this._proxy,this.project(t,e),this.getZoomScale(e,1))},_catchTransitionEnd:function(t){this._animatingZoom&&t.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(t,e,i){if(this._animatingZoom)return!0;if(i=i||{},!this._zoomAnimated||!1===i.animate||this._nothingToAnimate()||Math.abs(e-this._zoom)>this.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(e),r=this._getCenterOffset(t)._divideBy(1-1/n);return!(!0!==i.animate&&!this.getSize().contains(r)||(E((function(){this._moveStart(!0,!1)._animateZoom(t,e,!0)}),this),0))},_animateZoom:function(t,e,i,r){this._mapPane&&(i&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,le(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:r}),setTimeout(n(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&ce(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom),E((function(){this._moveEnd(!0)}),this))}});var He=z.extend({options:{position:"topright"},initialize:function(t){p(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var e=this._map;return e&&e.removeControl(this),this.options.position=t,e&&e.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var e=this._container=this.onAdd(t),i=this.getPosition(),n=t._controlCorners[i];return le(e,"leaflet-control"),-1!==i.indexOf("bottom")?n.insertBefore(e,n.firstChild):n.appendChild(e),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(ne(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(t){this._map&&t&&t.screenX>0&&t.screenY>0&&this._map.getContainer().focus()}}),We=function(t){return new He(t)};Ge.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){var t=this._controlCorners={},e="leaflet-",i=this._controlContainer=ie("div",e+"control-container",this._container);function n(n,r){var o=e+n+" "+e+r;t[n+r]=ie("div",o,i)}n("top","left"),n("top","right"),n("bottom","left"),n("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)ne(this._controlCorners[t]);ne(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var Xe=He.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,e,i,n){return i<n?-1:n<i?1:0}},initialize:function(t,e,i){for(var n in p(this,i),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,t)this._addLayer(t[n],n);for(n in e)this._addLayer(e[n],n,!0)},onAdd:function(t){this._initLayout(),this._update(),this._map=t,t.on("zoomend",this._checkDisabledLayers,this);for(var e=0;e<this._layers.length;e++)this._layers[e].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(t){return He.prototype.addTo.call(this,t),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var t=0;t<this._layers.length;t++)this._layers[t].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(t,e){return this._addLayer(t,e),this._map?this._update():this},addOverlay:function(t,e){return this._addLayer(t,e,!0),this._map?this._update():this},removeLayer:function(t){t.off("add remove",this._onLayerChange,this);var e=this._getLayer(o(t));return e&&this._layers.splice(this._layers.indexOf(e),1),this._map?this._update():this},expand:function(){le(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var t=this._map.getSize().y-(this._container.offsetTop+50);return t<this._section.clientHeight?(le(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=t+"px"):ce(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return ce(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var t="leaflet-control-layers",e=this._container=ie("div",t),i=this.options.collapsed;e.setAttribute("aria-haspopup",!0),De(e),Le(e);var n=this._section=ie("section",t+"-list");i&&(this._map.on("click",this.collapse,this),it||Se(e,{mouseenter:this.expand,mouseleave:this.collapse},this));var r=this._layersLink=ie("a",t+"-toggle",e);r.href="#",r.title="Layers",wt?(Se(r,"click",Re),Se(r,"click",this.expand,this)):Se(r,"focus",this.expand,this),i||this.expand(),this._baseLayersList=ie("div",t+"-base",n),this._separator=ie("div",t+"-separator",n),this._overlaysList=ie("div",t+"-overlays",n),e.appendChild(n)},_getLayer:function(t){for(var e=0;e<this._layers.length;e++)if(this._layers[e]&&o(this._layers[e].layer)===t)return this._layers[e]},_addLayer:function(t,e,i){this._map&&t.on("add remove",this._onLayerChange,this),this._layers.push({layer:t,name:e,overlay:i}),this.options.sortLayers&&this._layers.sort(n((function(t,e){return this.options.sortFunction(t.layer,e.layer,t.name,e.name)}),this)),this.options.autoZIndex&&t.setZIndex&&(this._lastZIndex++,t.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;re(this._baseLayersList),re(this._overlaysList),this._layerControlInputs=[];var t,e,i,n,r=0;for(i=0;i<this._layers.length;i++)n=this._layers[i],this._addItem(n),e=e||n.overlay,t=t||!n.overlay,r+=n.overlay?0:1;return this.options.hideSingleBase&&(t=t&&r>1,this._baseLayersList.style.display=t?"":"none"),this._separator.style.display=e&&t?"":"none",this},_onLayerChange:function(t){this._handlingClick||this._update();var e=this._getLayer(o(t.target)),i=e.overlay?"add"===t.type?"overlayadd":"overlayremove":"add"===t.type?"baselayerchange":null;i&&this._map.fire(i,e)},_createRadioElement:function(t,e){var i='<input type="radio" class="leaflet-control-layers-selector" name="'+t+'"'+(e?' checked="checked"':"")+"/>",n=document.createElement("div");return n.innerHTML=i,n.firstChild},_addItem:function(t){var e,i=document.createElement("label"),n=this._map.hasLayer(t.layer);t.overlay?((e=document.createElement("input")).type="checkbox",e.className="leaflet-control-layers-selector",e.defaultChecked=n):e=this._createRadioElement("leaflet-base-layers_"+o(this),n),this._layerControlInputs.push(e),e.layerId=o(t.layer),Se(e,"click",this._onInputClick,this);var r=document.createElement("span");r.innerHTML=" "+t.name;var s=document.createElement("div");return i.appendChild(s),s.appendChild(e),s.appendChild(r),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(i),this._checkDisabledLayers(),i},_onInputClick:function(){var t,e,i=this._layerControlInputs,n=[],r=[];this._handlingClick=!0;for(var o=i.length-1;o>=0;o--)t=i[o],e=this._getLayer(t.layerId).layer,t.checked?n.push(e):t.checked||r.push(e);for(o=0;o<r.length;o++)this._map.hasLayer(r[o])&&this._map.removeLayer(r[o]);for(o=0;o<n.length;o++)this._map.hasLayer(n[o])||this._map.addLayer(n[o]);this._handlingClick=!1,this._refocusOnMap()},_checkDisabledLayers:function(){for(var t,e,i=this._layerControlInputs,n=this._map.getZoom(),r=i.length-1;r>=0;r--)t=i[r],e=this._getLayer(t.layerId).layer,t.disabled=void 0!==e.options.minZoom&&n<e.options.minZoom||void 0!==e.options.maxZoom&&n>e.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expand:function(){return this.expand()},_collapse:function(){return this.collapse()}}),Ke=He.extend({options:{position:"topleft",zoomInText:"+",zoomInTitle:"Zoom in",zoomOutText:"&#x2212;",zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",i=ie("div",e+" leaflet-bar"),n=this.options;return this._zoomInButton=this._createButton(n.zoomInText,n.zoomInTitle,e+"-in",i,this._zoomIn),this._zoomOutButton=this._createButton(n.zoomOutText,n.zoomOutTitle,e+"-out",i,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),i},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(t.shiftKey?3:1))},_zoomOut:function(t){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,e,i,n,r){var o=ie("a",i,n);return o.innerHTML=t,o.href="#",o.title=e,o.setAttribute("role","button"),o.setAttribute("aria-label",e),De(o),Se(o,"click",Re),Se(o,"click",r,this),Se(o,"click",this._refocusOnMap,this),o},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";ce(this._zoomInButton,e),ce(this._zoomOutButton,e),(this._disabled||t._zoom===t.getMinZoom())&&le(this._zoomOutButton,e),(this._disabled||t._zoom===t.getMaxZoom())&&le(this._zoomInButton,e)}});Ge.mergeOptions({zoomControl:!0}),Ge.addInitHook((function(){this.options.zoomControl&&(this.zoomControl=new Ke,this.addControl(this.zoomControl))}));var Ye=He.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e="leaflet-control-scale",i=ie("div",e),n=this.options;return this._addScales(n,e+"-line",i),t.on(n.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),i},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,i){t.metric&&(this._mScale=ie("div",e,i)),t.imperial&&(this._iScale=ie("div",e,i))},_update:function(){var t=this._map,e=t.getSize().y/2,i=t.distance(t.containerPointToLatLng([0,e]),t.containerPointToLatLng([this.options.maxWidth,e]));this._updateScales(i)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var e=this._getRoundNum(t),i=e<1e3?e+" m":e/1e3+" km";this._updateScale(this._mScale,i,e/t)},_updateImperial:function(t){var e,i,n,r=3.2808399*t;r>5280?(e=r/5280,i=this._getRoundNum(e),this._updateScale(this._iScale,i+" mi",i/e)):(n=this._getRoundNum(r),this._updateScale(this._iScale,n+" ft",n/r))},_updateScale:function(t,e,i){t.style.width=Math.round(this.options.maxWidth*i)+"px",t.innerHTML=e},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1),i=t/e;return e*(i>=10?10:i>=5?5:i>=3?3:i>=2?2:1)}}),Je=He.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>'},initialize:function(t){p(this,t),this._attributions={}},onAdd:function(t){for(var e in t.attributionControl=this,this._container=ie("div","leaflet-control-attribution"),De(this._container),t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());return this._update(),this._container},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t?(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update(),this):this},removeAttribution:function(t){return t?(this._attributions[t]&&(this._attributions[t]--,this._update()),this):this},_update:function(){if(this._map){var t=[];for(var e in this._attributions)this._attributions[e]&&t.push(e);var i=[];this.options.prefix&&i.push(this.options.prefix),t.length&&i.push(t.join(", ")),this._container.innerHTML=i.join(" | ")}}});Ge.mergeOptions({attributionControl:!0}),Ge.addInitHook((function(){this.options.attributionControl&&(new Je).addTo(this)}));He.Layers=Xe,He.Zoom=Ke,He.Scale=Ye,He.Attribution=Je,We.layers=function(t,e,i){return new Xe(t,e,i)},We.zoom=function(t){return new Ke(t)},We.scale=function(t){return new Ye(t)},We.attribution=function(t){return new Je(t)};var Qe=z.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});Qe.addTo=function(t,e){return t.addHandler(e,this),this};var ti,ei={Events:C},ii=wt?"touchstart mousedown":"mousedown",ni={mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"},ri={mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"},oi=M.extend({options:{clickTolerance:3},initialize:function(t,e,i,n){p(this,n),this._element=t,this._dragStartTarget=e||t,this._preventOutline=i},enable:function(){this._enabled||(Se(this._dragStartTarget,ii,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(oi._dragging===this&&this.finishDrag(),ze(this._dragStartTarget,ii,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(!t._simulated&&this._enabled&&(this._moved=!1,!ae(this._element,"leaflet-zoom-anim")&&!(oi._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||(oi._dragging=this,this._preventOutline&&xe(this._element),ye(),Gt(),this._moving)))){this.fire("down");var e=t.touches?t.touches[0]:t,i=we(this._element);this._startPoint=new I(e.clientX,e.clientY),this._parentScale=Te(i),Se(document,ri[t.type],this._onMove,this),Se(document,ni[t.type],this._onUp,this)}},_onMove:function(t){if(!t._simulated&&this._enabled)if(t.touches&&t.touches.length>1)this._moved=!0;else{var e=t.touches&&1===t.touches.length?t.touches[0]:t,i=new I(e.clientX,e.clientY)._subtract(this._startPoint);(i.x||i.y)&&(Math.abs(i.x)+Math.abs(i.y)<this.options.clickTolerance||(i.x/=this._parentScale.x,i.y/=this._parentScale.y,Be(t),this._moved||(this.fire("dragstart"),this._moved=!0,this._startPos=ge(this._element).subtract(i),le(document.body,"leaflet-dragging"),this._lastTarget=t.target||t.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),le(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(i),this._moving=!0,S(this._animRequest),this._lastEvent=t,this._animRequest=E(this._updatePosition,this,!0)))}},_updatePosition:function(){var t={originalEvent:this._lastEvent};this.fire("predrag",t),fe(this._element,this._newPos),this.fire("drag",t)},_onUp:function(t){!t._simulated&&this._enabled&&this.finishDrag()},finishDrag:function(){for(var t in ce(document.body,"leaflet-dragging"),this._lastTarget&&(ce(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),ri)ze(document,ri[t],this._onMove,this),ze(document,ni[t],this._onUp,this);ve(),Ht(),this._moved&&this._moving&&(S(this._animRequest),this.fire("dragend",{distance:this._newPos.distanceTo(this._startPos)})),this._moving=!1,oi._dragging=!1}});function si(t,e){if(!e||!t.length)return t.slice();var i=e*e;return function(t,e){var i=t.length,n=new(typeof Uint8Array!=void 0+""?Uint8Array:Array)(i);n[0]=n[i-1]=1,li(t,n,e,0,i-1);var r,o=[];for(r=0;r<i;r++)n[r]&&o.push(t[r]);return o}(t=function(t,e){for(var i=[t[0]],n=1,r=0,o=t.length;n<o;n++)pi(t[n],t[r])>e&&(i.push(t[n]),r=n);return r<o-1&&i.push(t[o-1]),i}(t,i),i)}function ai(t,e,i){return Math.sqrt(di(t,e,i,!0))}function li(t,e,i,n,r){var o,s,a,l=0;for(s=n+1;s<=r-1;s++)(a=di(t[s],t[n],t[r],!0))>l&&(o=s,l=a);l>i&&(e[o]=1,li(t,e,i,n,o),li(t,e,i,o,r))}function ci(t,e,i,n,r){var o,s,a,l=n?ti:ui(t,i),c=ui(e,i);for(ti=c;;){if(!(l|c))return[t,e];if(l&c)return!1;a=ui(s=hi(t,e,o=l||c,i,r),i),o===l?(t=s,l=a):(e=s,c=a)}}function hi(t,e,i,n,r){var o,s,a=e.x-t.x,l=e.y-t.y,c=n.min,h=n.max;return 8&i?(o=t.x+a*(h.y-t.y)/l,s=h.y):4&i?(o=t.x+a*(c.y-t.y)/l,s=c.y):2&i?(o=h.x,s=t.y+l*(h.x-t.x)/a):1&i&&(o=c.x,s=t.y+l*(c.x-t.x)/a),new I(o,s,r)}function ui(t,e){var i=0;return t.x<e.min.x?i|=1:t.x>e.max.x&&(i|=2),t.y<e.min.y?i|=4:t.y>e.max.y&&(i|=8),i}function pi(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n}function di(t,e,i,n){var r,o=e.x,s=e.y,a=i.x-o,l=i.y-s,c=a*a+l*l;return c>0&&((r=((t.x-o)*a+(t.y-s)*l)/c)>1?(o=i.x,s=i.y):r>0&&(o+=a*r,s+=l*r)),a=t.x-o,l=t.y-s,n?a*a+l*l:new I(o,s)}function mi(t){return!g(t[0])||"object"!=typeof t[0][0]&&void 0!==t[0][0]}function fi(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),mi(t)}var gi={simplify:si,pointToSegmentDistance:ai,closestPointOnSegment:function(t,e,i){return di(t,e,i)},clipSegment:ci,_getEdgeIntersection:hi,_getBitCode:ui,_sqClosestPointOnSegment:di,isFlat:mi,_flat:fi};function _i(t,e,i){var n,r,o,s,a,l,c,h,u,p=[1,4,2,8];for(r=0,c=t.length;r<c;r++)t[r]._code=ui(t[r],e);for(s=0;s<4;s++){for(h=p[s],n=[],r=0,o=(c=t.length)-1;r<c;o=r++)a=t[r],l=t[o],a._code&h?l._code&h||((u=hi(l,a,h,e,i))._code=ui(u,e),n.push(u)):(l._code&h&&((u=hi(l,a,h,e,i))._code=ui(u,e),n.push(u)),n.push(a));t=n}return t}var yi={clipPolygon:_i},vi={project:function(t){return new I(t.lng,t.lat)},unproject:function(t){return new O(t.y,t.x)},bounds:new D([-180,-90],[180,90])},xi={R:6378137,R_MINOR:6356752.314245179,bounds:new D([-20037508.34279,-15496570.73972],[20037508.34279,18764656.23138]),project:function(t){var e=Math.PI/180,i=this.R,n=t.lat*e,r=this.R_MINOR/i,o=Math.sqrt(1-r*r),s=o*Math.sin(n),a=Math.tan(Math.PI/4-n/2)/Math.pow((1-s)/(1+s),o/2);return n=-i*Math.log(Math.max(a,1e-10)),new I(t.lng*e*i,n)},unproject:function(t){for(var e,i=180/Math.PI,n=this.R,r=this.R_MINOR/n,o=Math.sqrt(1-r*r),s=Math.exp(-t.y/n),a=Math.PI/2-2*Math.atan(s),l=0,c=.1;l<15&&Math.abs(c)>1e-7;l++)e=o*Math.sin(a),e=Math.pow((1-e)/(1+e),o/2),a+=c=Math.PI/2-2*Math.atan(s*e)-a;return new O(a*i,t.x*i/n)}},bi={LonLat:vi,Mercator:xi,SphericalMercator:q},wi=e({},Z,{code:"EPSG:3395",projection:xi,transformation:function(){var t=.5/(Math.PI*xi.R);return G(t,.5,-t,.5)}()}),Ti=e({},Z,{code:"EPSG:4326",projection:vi,transformation:G(1/180,1,-1/180,.5)}),Ei=e({},N,{projection:vi,transformation:G(1,0,-1,0),scale:function(t){return Math.pow(2,t)},zoom:function(t){return Math.log(t)/Math.LN2},distance:function(t,e){var i=e.lng-t.lng,n=e.lat-t.lat;return Math.sqrt(i*i+n*n)},infinite:!0});N.Earth=Z,N.EPSG3395=wi,N.EPSG3857=H,N.EPSG900913=W,N.EPSG4326=Ti,N.Simple=Ei;var Si=M.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(t){return t.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(t){return t&&t.removeLayer(this),this},getPane:function(t){return this._map.getPane(t?this.options[t]||t:this.options.pane)},addInteractiveTarget:function(t){return this._map._targets[o(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[o(t)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(t){var e=t.target;if(e.hasLayer(this)){if(this._map=e,this._zoomAnimated=e._zoomAnimated,this.getEvents){var i=this.getEvents();e.on(i,this),this.once("remove",(function(){e.off(i,this)}),this)}this.onAdd(e),this.getAttribution&&e.attributionControl&&e.attributionControl.addAttribution(this.getAttribution()),this.fire("add"),e.fire("layeradd",{layer:this})}}});Ge.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var e=o(t);return this._layers[e]||(this._layers[e]=t,t._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t)),this},removeLayer:function(t){var e=o(t);return this._layers[e]?(this._loaded&&t.onRemove(this),t.getAttribution&&this.attributionControl&&this.attributionControl.removeAttribution(t.getAttribution()),delete this._layers[e],this._loaded&&(this.fire("layerremove",{layer:t}),t.fire("remove")),t._map=t._mapToAdd=null,this):this},hasLayer:function(t){return!!t&&o(t)in this._layers},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},_addLayers:function(t){for(var e=0,i=(t=t?g(t)?t:[t]:[]).length;e<i;e++)this.addLayer(t[e])},_addZoomLimit:function(t){!isNaN(t.options.maxZoom)&&isNaN(t.options.minZoom)||(this._zoomBoundLayers[o(t)]=t,this._updateZoomLevels())},_removeZoomLimit:function(t){var e=o(t);this._zoomBoundLayers[e]&&(delete this._zoomBoundLayers[e],this._updateZoomLevels())},_updateZoomLevels:function(){var t=1/0,e=-1/0,i=this._getZoomSpan();for(var n in this._zoomBoundLayers){var r=this._zoomBoundLayers[n].options;t=void 0===r.minZoom?t:Math.min(t,r.minZoom),e=void 0===r.maxZoom?e:Math.max(e,r.maxZoom)}this._layersMaxZoom=e===-1/0?void 0:e,this._layersMinZoom=t===1/0?void 0:t,i!==this._getZoomSpan()&&this.fire("zoomlevelschange"),void 0===this.options.maxZoom&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var Pi=Si.extend({initialize:function(t,e){var i,n;if(p(this,e),this._layers={},t)for(i=0,n=t.length;i<n;i++)this.addLayer(t[i])},addLayer:function(t){var e=this.getLayerId(t);return this._layers[e]=t,this._map&&this._map.addLayer(t),this},removeLayer:function(t){var e=t in this._layers?t:this.getLayerId(t);return this._map&&this._layers[e]&&this._map.removeLayer(this._layers[e]),delete this._layers[e],this},hasLayer:function(t){return!!t&&("number"==typeof t?t:this.getLayerId(t))in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(t){var e,i,n=Array.prototype.slice.call(arguments,1);for(e in this._layers)(i=this._layers[e])[t]&&i[t].apply(i,n);return this},onAdd:function(t){this.eachLayer(t.addLayer,t)},onRemove:function(t){this.eachLayer(t.removeLayer,t)},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},getLayer:function(t){return this._layers[t]},getLayers:function(){var t=[];return this.eachLayer(t.push,t),t},setZIndex:function(t){return this.invoke("setZIndex",t)},getLayerId:function(t){return o(t)}}),zi=Pi.extend({addLayer:function(t){return this.hasLayer(t)?this:(t.addEventParent(this),Pi.prototype.addLayer.call(this,t),this.fire("layeradd",{layer:t}))},removeLayer:function(t){return this.hasLayer(t)?(t in this._layers&&(t=this._layers[t]),t.removeEventParent(this),Pi.prototype.removeLayer.call(this,t),this.fire("layerremove",{layer:t})):this},setStyle:function(t){return this.invoke("setStyle",t)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var t=new R;for(var e in this._layers){var i=this._layers[e];t.extend(i.getBounds?i.getBounds():i.getLatLng())}return t}}),Ci=z.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0]},initialize:function(t){p(this,t)},createIcon:function(t){return this._createIcon("icon",t)},createShadow:function(t){return this._createIcon("shadow",t)},_createIcon:function(t,e){var i=this._getIconUrl(t);if(!i){if("icon"===t)throw new Error("iconUrl not set in Icon options (see the docs).");return null}var n=this._createImg(i,e&&"IMG"===e.tagName?e:null);return this._setIconStyles(n,t),n},_setIconStyles:function(t,e){var i=this.options,n=i[e+"Size"];"number"==typeof n&&(n=[n,n]);var r=k(n),o=k("shadow"===e&&i.shadowAnchor||i.iconAnchor||r&&r.divideBy(2,!0));t.className="leaflet-marker-"+e+" "+(i.className||""),o&&(t.style.marginLeft=-o.x+"px",t.style.marginTop=-o.y+"px"),r&&(t.style.width=r.x+"px",t.style.height=r.y+"px")},_createImg:function(t,e){return(e=e||document.createElement("img")).src=t,e},_getIconUrl:function(t){return St&&this.options[t+"RetinaUrl"]||this.options[t+"Url"]}});var Mi=Ci.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(t){return Mi.imagePath||(Mi.imagePath=this._detectIconPath()),(this.options.imagePath||Mi.imagePath)+Ci.prototype._getIconUrl.call(this,t)},_detectIconPath:function(){var t=ie("div","leaflet-default-icon-path",document.body),e=ee(t,"background-image")||ee(t,"backgroundImage");return document.body.removeChild(t),null===e||0!==e.indexOf("url")?"":e.replace(/^url\(["']?/,"").replace(/marker-icon\.png["']?\)$/,"")}}),Ii=Qe.extend({initialize:function(t){this._marker=t},addHooks:function(){var t=this._marker._icon;this._draggable||(this._draggable=new oi(t,t,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),le(t,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&ce(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(t){var e=this._marker,i=e._map,n=this._marker.options.autoPanSpeed,r=this._marker.options.autoPanPadding,o=ge(e._icon),s=i.getPixelBounds(),a=i.getPixelOrigin(),l=B(s.min._subtract(a).add(r),s.max._subtract(a).subtract(r));if(!l.contains(o)){var c=k((Math.max(l.max.x,o.x)-l.max.x)/(s.max.x-l.max.x)-(Math.min(l.min.x,o.x)-l.min.x)/(s.min.x-l.min.x),(Math.max(l.max.y,o.y)-l.max.y)/(s.max.y-l.max.y)-(Math.min(l.min.y,o.y)-l.min.y)/(s.min.y-l.min.y)).multiplyBy(n);i.panBy(c,{animate:!1}),this._draggable._newPos._add(c),this._draggable._startPos._add(c),fe(e._icon,this._draggable._newPos),this._onDrag(t),this._panRequest=E(this._adjustPan.bind(this,t))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire("movestart").fire("dragstart")},_onPreDrag:function(t){this._marker.options.autoPan&&(S(this._panRequest),this._panRequest=E(this._adjustPan.bind(this,t)))},_onDrag:function(t){var e=this._marker,i=e._shadow,n=ge(e._icon),r=e._map.layerPointToLatLng(n);i&&fe(i,n),e._latlng=r,t.latlng=r,t.oldLatLng=this._oldLatLng,e.fire("move",t).fire("drag",t)},_onDragEnd:function(t){S(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",t)}}),Ai=Si.extend({options:{icon:new Mi,interactive:!0,keyboard:!0,title:"",alt:"",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(t,e){p(this,e),this._latlng=U(t)},onAdd:function(t){this._zoomAnimated=this._zoomAnimated&&t.options.markerZoomAnimation,this._zoomAnimated&&t.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(t){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&t.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(t){var e=this._latlng;return this._latlng=U(t),this.update(),this.fire("move",{oldLatLng:e,latlng:this._latlng})},setZIndexOffset:function(t){return this.options.zIndexOffset=t,this.update()},getIcon:function(){return this.options.icon},setIcon:function(t){return this.options.icon=t,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var t=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(t)}return this},_initIcon:function(){var t=this.options,e="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),i=t.icon.createIcon(this._icon),n=!1;i!==this._icon&&(this._icon&&this._removeIcon(),n=!0,t.title&&(i.title=t.title),"IMG"===i.tagName&&(i.alt=t.alt||"")),le(i,e),t.keyboard&&(i.tabIndex="0"),this._icon=i,t.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex});var r=t.icon.createShadow(this._shadow),o=!1;r!==this._shadow&&(this._removeShadow(),o=!0),r&&(le(r,e),r.alt=""),this._shadow=r,t.opacity<1&&this._updateOpacity(),n&&this.getPane().appendChild(this._icon),this._initInteraction(),r&&o&&this.getPane(t.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),ne(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&ne(this._shadow),this._shadow=null},_setPos:function(t){this._icon&&fe(this._icon,t),this._shadow&&fe(this._shadow,t),this._zIndex=t.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(t){this._icon&&(this._icon.style.zIndex=this._zIndex+t)},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center).round();this._setPos(e)},_initInteraction:function(){if(this.options.interactive&&(le(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),Ii)){var t=this.options.draggable;this.dragging&&(t=this.dragging.enabled(),this.dragging.disable()),this.dragging=new Ii(this),t&&this.dragging.enable()}},setOpacity:function(t){return this.options.opacity=t,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var t=this.options.opacity;this._icon&&pe(this._icon,t),this._shadow&&pe(this._shadow,t)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});var ki=Si.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(t){this._renderer=t.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(t){return p(this,t),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&t&&Object.prototype.hasOwnProperty.call(t,"weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+this._renderer.options.tolerance}}),Li=ki.extend({options:{fill:!0,radius:10},initialize:function(t,e){p(this,e),this._latlng=U(t),this._radius=this.options.radius},setLatLng:function(t){var e=this._latlng;return this._latlng=U(t),this.redraw(),this.fire("move",{oldLatLng:e,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(t){return this.options.radius=this._radius=t,this.redraw()},getRadius:function(){return this._radius},setStyle:function(t){var e=t&&t.radius||this._radius;return ki.prototype.setStyle.call(this,t),this.setRadius(e),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var t=this._radius,e=this._radiusY||t,i=this._clickTolerance(),n=[t+i,e+i];this._pxBounds=new D(this._point.subtract(n),this._point.add(n))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(t){return t.distanceTo(this._point)<=this._radius+this._clickTolerance()}});var Di=Li.extend({initialize:function(t,i,n){if("number"==typeof i&&(i=e({},n,{radius:i})),p(this,i),this._latlng=U(t),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(t){return this._mRadius=t,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var t=[this._radius,this._radiusY||this._radius];return new R(this._map.layerPointToLatLng(this._point.subtract(t)),this._map.layerPointToLatLng(this._point.add(t)))},setStyle:ki.prototype.setStyle,_project:function(){var t=this._latlng.lng,e=this._latlng.lat,i=this._map,n=i.options.crs;if(n.distance===Z.distance){var r=Math.PI/180,o=this._mRadius/Z.R/r,s=i.project([e+o,t]),a=i.project([e-o,t]),l=s.add(a).divideBy(2),c=i.unproject(l).lat,h=Math.acos((Math.cos(o*r)-Math.sin(e*r)*Math.sin(c*r))/(Math.cos(e*r)*Math.cos(c*r)))/r;(isNaN(h)||0===h)&&(h=o/Math.cos(Math.PI/180*e)),this._point=l.subtract(i.getPixelOrigin()),this._radius=isNaN(h)?0:l.x-i.project([c,t-h]).x,this._radiusY=l.y-s.y}else{var u=n.unproject(n.project(this._latlng).subtract([this._mRadius,0]));this._point=i.latLngToLayerPoint(this._latlng),this._radius=this._point.x-i.latLngToLayerPoint(u).x}this._updateBounds()}});var Bi=ki.extend({options:{smoothFactor:1,noClip:!1},initialize:function(t,e){p(this,e),this._setLatLngs(t)},getLatLngs:function(){return this._latlngs},setLatLngs:function(t){return this._setLatLngs(t),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(t){for(var e,i,n=1/0,r=null,o=di,s=0,a=this._parts.length;s<a;s++)for(var l=this._parts[s],c=1,h=l.length;c<h;c++){var u=o(t,e=l[c-1],i=l[c],!0);u<n&&(n=u,r=o(t,e,i))}return r&&(r.distance=Math.sqrt(n)),r},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");var t,e,i,n,r,o,s,a=this._rings[0],l=a.length;if(!l)return null;for(t=0,e=0;t<l-1;t++)e+=a[t].distanceTo(a[t+1])/2;if(0===e)return this._map.layerPointToLatLng(a[0]);for(t=0,n=0;t<l-1;t++)if(r=a[t],o=a[t+1],(n+=i=r.distanceTo(o))>e)return s=(n-e)/i,this._map.layerPointToLatLng([o.x-s*(o.x-r.x),o.y-s*(o.y-r.y)])},getBounds:function(){return this._bounds},addLatLng:function(t,e){return e=e||this._defaultShape(),t=U(t),e.push(t),this._bounds.extend(t),this.redraw()},_setLatLngs:function(t){this._bounds=new R,this._latlngs=this._convertLatLngs(t)},_defaultShape:function(){return mi(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(t){for(var e=[],i=mi(t),n=0,r=t.length;n<r;n++)i?(e[n]=U(t[n]),this._bounds.extend(e[n])):e[n]=this._convertLatLngs(t[n]);return e},_project:function(){var t=new D;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,t),this._bounds.isValid()&&t.isValid()&&(this._rawPxBounds=t,this._updateBounds())},_updateBounds:function(){var t=this._clickTolerance(),e=new I(t,t);this._pxBounds=new D([this._rawPxBounds.min.subtract(e),this._rawPxBounds.max.add(e)])},_projectLatlngs:function(t,e,i){var n,r,o=t[0]instanceof O,s=t.length;if(o){for(r=[],n=0;n<s;n++)r[n]=this._map.latLngToLayerPoint(t[n]),i.extend(r[n]);e.push(r)}else for(n=0;n<s;n++)this._projectLatlngs(t[n],e,i)},_clipPoints:function(){var t=this._renderer._bounds;if(this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else{var e,i,n,r,o,s,a,l=this._parts;for(e=0,n=0,r=this._rings.length;e<r;e++)for(i=0,o=(a=this._rings[e]).length;i<o-1;i++)(s=ci(a[i],a[i+1],t,i,!0))&&(l[n]=l[n]||[],l[n].push(s[0]),s[1]===a[i+1]&&i!==o-2||(l[n].push(s[1]),n++))}},_simplifyPoints:function(){for(var t=this._parts,e=this.options.smoothFactor,i=0,n=t.length;i<n;i++)t[i]=si(t[i],e)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(t,e){var i,n,r,o,s,a,l=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(i=0,o=this._parts.length;i<o;i++)for(n=0,r=(s=(a=this._parts[i]).length)-1;n<s;r=n++)if((e||0!==n)&&ai(t,a[r],a[n])<=l)return!0;return!1}});Bi._flat=fi;var Ri=Bi.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");var t,e,i,n,r,o,s,a,l,c=this._rings[0],h=c.length;if(!h)return null;for(o=s=a=0,t=0,e=h-1;t<h;e=t++)i=c[t],n=c[e],r=i.y*n.x-n.y*i.x,s+=(i.x+n.x)*r,a+=(i.y+n.y)*r,o+=3*r;return l=0===o?c[0]:[s/o,a/o],this._map.layerPointToLatLng(l)},_convertLatLngs:function(t){var e=Bi.prototype._convertLatLngs.call(this,t),i=e.length;return i>=2&&e[0]instanceof O&&e[0].equals(e[i-1])&&e.pop(),e},_setLatLngs:function(t){Bi.prototype._setLatLngs.call(this,t),mi(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return mi(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,e=this.options.weight,i=new I(e,e);if(t=new D(t.min.subtract(i),t.max.add(i)),this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else for(var n,r=0,o=this._rings.length;r<o;r++)(n=_i(this._rings[r],t,!0)).length&&this._parts.push(n)},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(t){var e,i,n,r,o,s,a,l,c=!1;if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(r=0,a=this._parts.length;r<a;r++)for(o=0,s=(l=(e=this._parts[r]).length)-1;o<l;s=o++)i=e[o],n=e[s],i.y>t.y!=n.y>t.y&&t.x<(n.x-i.x)*(t.y-i.y)/(n.y-i.y)+i.x&&(c=!c);return c||Bi.prototype._containsPoint.call(this,t,!0)}});var Fi=zi.extend({initialize:function(t,e){p(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e,i,n,r=g(t)?t:t.features;if(r){for(e=0,i=r.length;e<i;e++)((n=r[e]).geometries||n.geometry||n.features||n.coordinates)&&this.addData(n);return this}var o=this.options;if(o.filter&&!o.filter(t))return this;var s=Oi(t,o);return s?(s.feature=$i(t),s.defaultOptions=s.options,this.resetStyle(s),o.onEachFeature&&o.onEachFeature(t,s),this.addLayer(s)):this},resetStyle:function(t){return void 0===t?this.eachLayer(this.resetStyle,this):(t.options=e({},t.defaultOptions),this._setLayerStyle(t,this.options.style),this)},setStyle:function(t){return this.eachLayer((function(e){this._setLayerStyle(e,t)}),this)},_setLayerStyle:function(t,e){t.setStyle&&("function"==typeof e&&(e=e(t.feature)),t.setStyle(e))}});function Oi(t,e){var i,n,r,o,s="Feature"===t.type?t.geometry:t,a=s?s.coordinates:null,l=[],c=e&&e.pointToLayer,h=e&&e.coordsToLatLng||Vi;if(!a&&!s)return null;switch(s.type){case"Point":return Ui(c,t,i=h(a),e);case"MultiPoint":for(r=0,o=a.length;r<o;r++)i=h(a[r]),l.push(Ui(c,t,i,e));return new zi(l);case"LineString":case"MultiLineString":return n=Ni(a,"LineString"===s.type?0:1,h),new Bi(n,e);case"Polygon":case"MultiPolygon":return n=Ni(a,"Polygon"===s.type?1:2,h),new Ri(n,e);case"GeometryCollection":for(r=0,o=s.geometries.length;r<o;r++){var u=Oi({geometry:s.geometries[r],type:"Feature",properties:t.properties},e);u&&l.push(u)}return new zi(l);default:throw new Error("Invalid GeoJSON object.")}}function Ui(t,e,i,n){return t?t(e,i):new Ai(i,n&&n.markersInheritOptions&&n)}function Vi(t){return new O(t[1],t[0],t[2])}function Ni(t,e,i){for(var n,r=[],o=0,s=t.length;o<s;o++)n=e?Ni(t[o],e-1,i):(i||Vi)(t[o]),r.push(n);return r}function Zi(t,e){return e="number"==typeof e?e:6,void 0!==t.alt?[c(t.lng,e),c(t.lat,e),c(t.alt,e)]:[c(t.lng,e),c(t.lat,e)]}function ji(t,e,i,n){for(var r=[],o=0,s=t.length;o<s;o++)r.push(e?ji(t[o],e-1,i,n):Zi(t[o],n));return!e&&i&&r.push(r[0]),r}function qi(t,i){return t.feature?e({},t.feature,{geometry:i}):$i(i)}function $i(t){return"Feature"===t.type||"FeatureCollection"===t.type?t:{type:"Feature",properties:{},geometry:t}}var Gi={toGeoJSON:function(t){return qi(this,{type:"Point",coordinates:Zi(this.getLatLng(),t)})}};function Hi(t,e){return new Fi(t,e)}Ai.include(Gi),Di.include(Gi),Li.include(Gi),Bi.include({toGeoJSON:function(t){var e=!mi(this._latlngs);return qi(this,{type:(e?"Multi":"")+"LineString",coordinates:ji(this._latlngs,e?1:0,!1,t)})}}),Ri.include({toGeoJSON:function(t){var e=!mi(this._latlngs),i=e&&!mi(this._latlngs[0]),n=ji(this._latlngs,i?2:e?1:0,!0,t);return e||(n=[n]),qi(this,{type:(i?"Multi":"")+"Polygon",coordinates:n})}}),Pi.include({toMultiPoint:function(t){var e=[];return this.eachLayer((function(i){e.push(i.toGeoJSON(t).geometry.coordinates)})),qi(this,{type:"MultiPoint",coordinates:e})},toGeoJSON:function(t){var e=this.feature&&this.feature.geometry&&this.feature.geometry.type;if("MultiPoint"===e)return this.toMultiPoint(t);var i="GeometryCollection"===e,n=[];return this.eachLayer((function(e){if(e.toGeoJSON){var r=e.toGeoJSON(t);if(i)n.push(r.geometry);else{var o=$i(r);"FeatureCollection"===o.type?n.push.apply(n,o.features):n.push(o)}}})),i?qi(this,{geometries:n,type:"GeometryCollection"}):{type:"FeatureCollection",features:n}}});var Wi=Hi,Xi=Si.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(t,e,i){this._url=t,this._bounds=F(e),p(this,i)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(le(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){ne(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(t){return this.options.opacity=t,this._image&&this._updateOpacity(),this},setStyle:function(t){return t.opacity&&this.setOpacity(t.opacity),this},bringToFront:function(){return this._map&&oe(this._image),this},bringToBack:function(){return this._map&&se(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=F(t),this._map&&this._reset(),this},getEvents:function(){var t={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var t="IMG"===this._url.tagName,e=this._image=t?this._url:ie("img");le(e,"leaflet-image-layer"),this._zoomAnimated&&le(e,"leaflet-zoom-animated"),this.options.className&&le(e,this.options.className),e.onselectstart=l,e.onmousemove=l,e.onload=n(this.fire,this,"load"),e.onerror=n(this._overlayOnError,this,"error"),(this.options.crossOrigin||""===this.options.crossOrigin)&&(e.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),t?this._url=e.src:(e.src=this._url,e.alt=this.options.alt)},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),i=this._map._latLngBoundsToNewLayerBounds(this._bounds,t.zoom,t.center).min;me(this._image,i,e)},_reset:function(){var t=this._image,e=new D(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),i=e.getSize();fe(t,e.min),t.style.width=i.x+"px",t.style.height=i.y+"px"},_updateOpacity:function(){pe(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var t=this.options.errorOverlayUrl;t&&this._url!==t&&(this._url=t,this._image.src=t)}}),Ki=Xi.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1},_initImage:function(){var t="VIDEO"===this._url.tagName,e=this._image=t?this._url:ie("video");if(le(e,"leaflet-image-layer"),this._zoomAnimated&&le(e,"leaflet-zoom-animated"),this.options.className&&le(e,this.options.className),e.onselectstart=l,e.onmousemove=l,e.onloadeddata=n(this.fire,this,"load"),t){for(var i=e.getElementsByTagName("source"),r=[],o=0;o<i.length;o++)r.push(i[o].src);this._url=i.length>0?r:[e.src]}else{g(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(e.style,"objectFit")&&(e.style.objectFit="fill"),e.autoplay=!!this.options.autoplay,e.loop=!!this.options.loop,e.muted=!!this.options.muted;for(var s=0;s<this._url.length;s++){var a=ie("source");a.src=this._url[s],e.appendChild(a)}}}});var Yi=Xi.extend({_initImage:function(){var t=this._image=this._url;le(t,"leaflet-image-layer"),this._zoomAnimated&&le(t,"leaflet-zoom-animated"),this.options.className&&le(t,this.options.className),t.onselectstart=l,t.onmousemove=l}});var Ji=Si.extend({options:{offset:[0,7],className:"",pane:"popupPane"},initialize:function(t,e){p(this,t),this._source=e},onAdd:function(t){this._zoomAnimated=t._zoomAnimated,this._container||this._initLayout(),t._fadeAnimated&&pe(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),t._fadeAnimated&&pe(this._container,1),this.bringToFront()},onRemove:function(t){t._fadeAnimated?(pe(this._container,0),this._removeTimeout=setTimeout(n(ne,void 0,this._container),200)):ne(this._container)},getLatLng:function(){return this._latlng},setLatLng:function(t){return this._latlng=U(t),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(t){return this._content=t,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var t={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&oe(this._container),this},bringToBack:function(){return this._map&&se(this._container),this},_prepareOpen:function(t,e,i){if(e instanceof Si||(i=e,e=t),e instanceof zi)for(var n in t._layers){e=t._layers[n];break}if(!i)if(e.getCenter)i=e.getCenter();else{if(!e.getLatLng)throw new Error("Unable to get source layer LatLng.");i=e.getLatLng()}return this._source=e,this.update(),i},_updateContent:function(){if(this._content){var t=this._contentNode,e="function"==typeof this._content?this._content(this._source||this):this._content;if("string"==typeof e)t.innerHTML=e;else{for(;t.hasChildNodes();)t.removeChild(t.firstChild);t.appendChild(e)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var t=this._map.latLngToLayerPoint(this._latlng),e=k(this.options.offset),i=this._getAnchor();this._zoomAnimated?fe(this._container,t.add(i)):e=e.add(t).add(i);var n=this._containerBottom=-e.y,r=this._containerLeft=-Math.round(this._containerWidth/2)+e.x;this._container.style.bottom=n+"px",this._container.style.left=r+"px"}},_getAnchor:function(){return[0,0]}}),Qi=Ji.extend({options:{maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(t){return t.openPopup(this),this},onAdd:function(t){Ji.prototype.onAdd.call(this,t),t.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof ki||this._source.on("preclick",ke))},onRemove:function(t){Ji.prototype.onRemove.call(this,t),t.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof ki||this._source.off("preclick",ke))},getEvents:function(){var t=Ji.prototype.getEvents.call(this);return(void 0!==this.options.closeOnClick?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(t.preclick=this._close),this.options.keepInView&&(t.moveend=this._adjustPan),t},_close:function(){this._map&&this._map.closePopup(this)},_initLayout:function(){var t="leaflet-popup",e=this._container=ie("div",t+" "+(this.options.className||"")+" leaflet-zoom-animated"),i=this._wrapper=ie("div",t+"-content-wrapper",e);if(this._contentNode=ie("div",t+"-content",i),De(e),Le(this._contentNode),Se(e,"contextmenu",ke),this._tipContainer=ie("div",t+"-tip-container",e),this._tip=ie("div",t+"-tip",this._tipContainer),this.options.closeButton){var n=this._closeButton=ie("a",t+"-close-button",e);n.href="#close",n.innerHTML="&#215;",Se(n,"click",this._onCloseButtonClick,this)}},_updateLayout:function(){var t=this._contentNode,e=t.style;e.width="",e.whiteSpace="nowrap";var i=t.offsetWidth;i=Math.min(i,this.options.maxWidth),i=Math.max(i,this.options.minWidth),e.width=i+1+"px",e.whiteSpace="",e.height="";var n=t.offsetHeight,r=this.options.maxHeight,o="leaflet-popup-scrolled";r&&n>r?(e.height=r+"px",le(t,o)):ce(t,o),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),i=this._getAnchor();fe(this._container,e.add(i))},_adjustPan:function(){if(this.options.autoPan){this._map._panAnim&&this._map._panAnim.stop();var t=this._map,e=parseInt(ee(this._container,"marginBottom"),10)||0,i=this._container.offsetHeight+e,n=this._containerWidth,r=new I(this._containerLeft,-i-this._containerBottom);r._add(ge(this._container));var o=t.layerPointToContainerPoint(r),s=k(this.options.autoPanPadding),a=k(this.options.autoPanPaddingTopLeft||s),l=k(this.options.autoPanPaddingBottomRight||s),c=t.getSize(),h=0,u=0;o.x+n+l.x>c.x&&(h=o.x+n-c.x+l.x),o.x-h-a.x<0&&(h=o.x-a.x),o.y+i+l.y>c.y&&(u=o.y+i-c.y+l.y),o.y-u-a.y<0&&(u=o.y-a.y),(h||u)&&t.fire("autopanstart").panBy([h,u])}},_onCloseButtonClick:function(t){this._close(),Re(t)},_getAnchor:function(){return k(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}});Ge.mergeOptions({closePopupOnClick:!0}),Ge.include({openPopup:function(t,e,i){return t instanceof Qi||(t=new Qi(i).setContent(t)),e&&t.setLatLng(e),this.hasLayer(t)?this:(this._popup&&this._popup.options.autoClose&&this.closePopup(),this._popup=t,this.addLayer(t))},closePopup:function(t){return t&&t!==this._popup||(t=this._popup,this._popup=null),t&&this.removeLayer(t),this}}),Si.include({bindPopup:function(t,e){return t instanceof Qi?(p(t,e),this._popup=t,t._source=this):(this._popup&&!e||(this._popup=new Qi(e,this)),this._popup.setContent(t)),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t,e){return this._popup&&this._map&&(e=this._popup._prepareOpen(this,t,e),this._map.openPopup(this._popup,e)),this},closePopup:function(){return this._popup&&this._popup._close(),this},togglePopup:function(t){return this._popup&&(this._popup._map?this.closePopup():this.openPopup(t)),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var e=t.layer||t.target;this._popup&&this._map&&(Re(t),e instanceof ki?this.openPopup(t.layer||t.target,t.latlng):this._map.hasLayer(this._popup)&&this._popup._source===e?this.closePopup():this.openPopup(e,t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}});var tn=Ji.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,interactive:!1,opacity:.9},onAdd:function(t){Ji.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&this._source.fire("tooltipopen",{tooltip:this},!0)},onRemove:function(t){Ji.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&this._source.fire("tooltipclose",{tooltip:this},!0)},getEvents:function(){var t=Ji.prototype.getEvents.call(this);return wt&&!this.options.permanent&&(t.preclick=this._close),t},_close:function(){this._map&&this._map.closeTooltip(this)},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=ie("div",t)},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e,i,n=this._map,r=this._container,o=n.latLngToContainerPoint(n.getCenter()),s=n.layerPointToContainerPoint(t),a=this.options.direction,l=r.offsetWidth,c=r.offsetHeight,h=k(this.options.offset),u=this._getAnchor();"top"===a?(e=l/2,i=c):"bottom"===a?(e=l/2,i=0):"center"===a?(e=l/2,i=c/2):"right"===a?(e=0,i=c/2):"left"===a?(e=l,i=c/2):s.x<o.x?(a="right",e=0,i=c/2):(a="left",e=l+2*(h.x+u.x),i=c/2),t=t.subtract(k(e,i,!0)).add(h).add(u),ce(r,"leaflet-tooltip-right"),ce(r,"leaflet-tooltip-left"),ce(r,"leaflet-tooltip-top"),ce(r,"leaflet-tooltip-bottom"),le(r,"leaflet-tooltip-"+a),fe(r,t)},_updatePosition:function(){var t=this._map.latLngToLayerPoint(this._latlng);this._setPosition(t)},setOpacity:function(t){this.options.opacity=t,this._container&&pe(this._container,t)},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center);this._setPosition(e)},_getAnchor:function(){return k(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}});Ge.include({openTooltip:function(t,e,i){return t instanceof tn||(t=new tn(i).setContent(t)),e&&t.setLatLng(e),this.hasLayer(t)?this:this.addLayer(t)},closeTooltip:function(t){return t&&this.removeLayer(t),this}}),Si.include({bindTooltip:function(t,e){return t instanceof tn?(p(t,e),this._tooltip=t,t._source=this):(this._tooltip&&!e||(this._tooltip=new tn(e,this)),this._tooltip.setContent(t)),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(t){if(t||!this._tooltipHandlersAdded){var e=t?"off":"on",i={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?i.add=this._openTooltip:(i.mouseover=this._openTooltip,i.mouseout=this.closeTooltip,this._tooltip.options.sticky&&(i.mousemove=this._moveTooltip),wt&&(i.click=this._openTooltip)),this[e](i),this._tooltipHandlersAdded=!t}},openTooltip:function(t,e){return this._tooltip&&this._map&&(e=this._tooltip._prepareOpen(this,t,e),this._map.openTooltip(this._tooltip,e),this._tooltip.options.interactive&&this._tooltip._container&&(le(this._tooltip._container,"leaflet-clickable"),this.addInteractiveTarget(this._tooltip._container))),this},closeTooltip:function(){return this._tooltip&&(this._tooltip._close(),this._tooltip.options.interactive&&this._tooltip._container&&(ce(this._tooltip._container,"leaflet-clickable"),this.removeInteractiveTarget(this._tooltip._container))),this},toggleTooltip:function(t){return this._tooltip&&(this._tooltip._map?this.closeTooltip():this.openTooltip(t)),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(t){return this._tooltip&&this._tooltip.setContent(t),this},getTooltip:function(){return this._tooltip},_openTooltip:function(t){var e=t.layer||t.target;this._tooltip&&this._map&&this.openTooltip(e,this._tooltip.options.sticky?t.latlng:void 0)},_moveTooltip:function(t){var e,i,n=t.latlng;this._tooltip.options.sticky&&t.originalEvent&&(e=this._map.mouseEventToContainerPoint(t.originalEvent),i=this._map.containerPointToLayerPoint(e),n=this._map.layerPointToLatLng(i)),this._tooltip.setLatLng(n)}});var en=Ci.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(t){var e=t&&"DIV"===t.tagName?t:document.createElement("div"),i=this.options;if(i.html instanceof Element?(re(e),e.appendChild(i.html)):e.innerHTML=!1!==i.html?i.html:"",i.bgPos){var n=k(i.bgPos);e.style.backgroundPosition=-n.x+"px "+-n.y+"px"}return this._setIconStyles(e,"icon"),e},createShadow:function(){return null}});Ci.Default=Mi;var nn=Si.extend({options:{tileSize:256,opacity:1,updateWhenIdle:_t,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(t){p(this,t)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView(),this._update()},beforeAdd:function(t){t._addZoomLimit(this)},onRemove:function(t){this._removeAllTiles(),ne(this._container),t._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(oe(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(se(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(t){return this.options.opacity=t,this._updateOpacity(),this},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){return this._map&&(this._removeAllTiles(),this._update()),this},getEvents:function(){var t={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=s(this._onMoveEnd,this.options.updateInterval,this)),t.move=this._onMove),this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},createTile:function(){return document.createElement("div")},getTileSize:function(){var t=this.options.tileSize;return t instanceof I?t:new I(t,t)},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(t){for(var e,i=this.getPane().children,n=-t(-1/0,1/0),r=0,o=i.length;r<o;r++)e=i[r].style.zIndex,i[r]!==this._container&&e&&(n=t(n,+e));isFinite(n)&&(this.options.zIndex=n+t(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!Q){pe(this._container,this.options.opacity);var t=+new Date,e=!1,i=!1;for(var n in this._tiles){var r=this._tiles[n];if(r.current&&r.loaded){var o=Math.min(1,(t-r.loaded)/200);pe(r.el,o),o<1?e=!0:(r.active?i=!0:this._onOpaqueTile(r),r.active=!0)}}i&&!this._noPrune&&this._pruneTiles(),e&&(S(this._fadeFrame),this._fadeFrame=E(this._updateOpacity,this))}},_onOpaqueTile:l,_initContainer:function(){this._container||(this._container=ie("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var t=this._tileZoom,e=this.options.maxZoom;if(void 0!==t){for(var i in this._levels)i=Number(i),this._levels[i].el.children.length||i===t?(this._levels[i].el.style.zIndex=e-Math.abs(t-i),this._onUpdateLevel(i)):(ne(this._levels[i].el),this._removeTilesAtZoom(i),this._onRemoveLevel(i),delete this._levels[i]);var n=this._levels[t],r=this._map;return n||((n=this._levels[t]={}).el=ie("div","leaflet-tile-container leaflet-zoom-animated",this._container),n.el.style.zIndex=e,n.origin=r.project(r.unproject(r.getPixelOrigin()),t).round(),n.zoom=t,this._setZoomTransform(n,r.getCenter(),r.getZoom()),n.el.offsetWidth,this._onCreateLevel(n)),this._level=n,n}},_onUpdateLevel:l,_onRemoveLevel:l,_onCreateLevel:l,_pruneTiles:function(){if(this._map){var t,e,i=this._map.getZoom();if(i>this.options.maxZoom||i<this.options.minZoom)this._removeAllTiles();else{for(t in this._tiles)(e=this._tiles[t]).retain=e.current;for(t in this._tiles)if((e=this._tiles[t]).current&&!e.active){var n=e.coords;this._retainParent(n.x,n.y,n.z,n.z-5)||this._retainChildren(n.x,n.y,n.z,n.z+2)}for(t in this._tiles)this._tiles[t].retain||this._removeTile(t)}}},_removeTilesAtZoom:function(t){for(var e in this._tiles)this._tiles[e].coords.z===t&&this._removeTile(e)},_removeAllTiles:function(){for(var t in this._tiles)this._removeTile(t)},_invalidateAll:function(){for(var t in this._levels)ne(this._levels[t].el),this._onRemoveLevel(Number(t)),delete this._levels[t];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(t,e,i,n){var r=Math.floor(t/2),o=Math.floor(e/2),s=i-1,a=new I(+r,+o);a.z=+s;var l=this._tileCoordsToKey(a),c=this._tiles[l];return c&&c.active?(c.retain=!0,!0):(c&&c.loaded&&(c.retain=!0),s>n&&this._retainParent(r,o,s,n))},_retainChildren:function(t,e,i,n){for(var r=2*t;r<2*t+2;r++)for(var o=2*e;o<2*e+2;o++){var s=new I(r,o);s.z=i+1;var a=this._tileCoordsToKey(s),l=this._tiles[a];l&&l.active?l.retain=!0:(l&&l.loaded&&(l.retain=!0),i+1<n&&this._retainChildren(r,o,i+1,n))}},_resetView:function(t){var e=t&&(t.pinch||t.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),e,e)},_animateZoom:function(t){this._setView(t.center,t.zoom,!0,t.noUpdate)},_clampZoom:function(t){var e=this.options;return void 0!==e.minNativeZoom&&t<e.minNativeZoom?e.minNativeZoom:void 0!==e.maxNativeZoom&&e.maxNativeZoom<t?e.maxNativeZoom:t},_setView:function(t,e,i,n){var r=Math.round(e);r=void 0!==this.options.maxZoom&&r>this.options.maxZoom||void 0!==this.options.minZoom&&r<this.options.minZoom?void 0:this._clampZoom(r);var o=this.options.updateWhenZooming&&r!==this._tileZoom;n&&!o||(this._tileZoom=r,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),void 0!==r&&this._update(t),i||this._pruneTiles(),this._noPrune=!!i),this._setZoomTransforms(t,e)},_setZoomTransforms:function(t,e){for(var i in this._levels)this._setZoomTransform(this._levels[i],t,e)},_setZoomTransform:function(t,e,i){var n=this._map.getZoomScale(i,t.zoom),r=t.origin.multiplyBy(n).subtract(this._map._getNewPixelOrigin(e,i)).round();gt?me(t.el,r,n):fe(t.el,r)},_resetGrid:function(){var t=this._map,e=t.options.crs,i=this._tileSize=this.getTileSize(),n=this._tileZoom,r=this._map.getPixelWorldBounds(this._tileZoom);r&&(this._globalTileRange=this._pxBoundsToTileRange(r)),this._wrapX=e.wrapLng&&!this.options.noWrap&&[Math.floor(t.project([0,e.wrapLng[0]],n).x/i.x),Math.ceil(t.project([0,e.wrapLng[1]],n).x/i.y)],this._wrapY=e.wrapLat&&!this.options.noWrap&&[Math.floor(t.project([e.wrapLat[0],0],n).y/i.x),Math.ceil(t.project([e.wrapLat[1],0],n).y/i.y)]},_onMoveEnd:function(){this._map&&!this._map._animatingZoom&&this._update()},_getTiledPixelBounds:function(t){var e=this._map,i=e._animatingZoom?Math.max(e._animateToZoom,e.getZoom()):e.getZoom(),n=e.getZoomScale(i,this._tileZoom),r=e.project(t,this._tileZoom).floor(),o=e.getSize().divideBy(2*n);return new D(r.subtract(o),r.add(o))},_update:function(t){var e=this._map;if(e){var i=this._clampZoom(e.getZoom());if(void 0===t&&(t=e.getCenter()),void 0!==this._tileZoom){var n=this._getTiledPixelBounds(t),r=this._pxBoundsToTileRange(n),o=r.getCenter(),s=[],a=this.options.keepBuffer,l=new D(r.getBottomLeft().subtract([a,-a]),r.getTopRight().add([a,-a]));if(!(isFinite(r.min.x)&&isFinite(r.min.y)&&isFinite(r.max.x)&&isFinite(r.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var c in this._tiles){var h=this._tiles[c].coords;h.z===this._tileZoom&&l.contains(new I(h.x,h.y))||(this._tiles[c].current=!1)}if(Math.abs(i-this._tileZoom)>1)this._setView(t,i);else{for(var u=r.min.y;u<=r.max.y;u++)for(var p=r.min.x;p<=r.max.x;p++){var d=new I(p,u);if(d.z=this._tileZoom,this._isValidTile(d)){var m=this._tiles[this._tileCoordsToKey(d)];m?m.current=!0:s.push(d)}}if(s.sort((function(t,e){return t.distanceTo(o)-e.distanceTo(o)})),0!==s.length){this._loading||(this._loading=!0,this.fire("loading"));var f=document.createDocumentFragment();for(p=0;p<s.length;p++)this._addTile(s[p],f);this._level.el.appendChild(f)}}}}},_isValidTile:function(t){var e=this._map.options.crs;if(!e.infinite){var i=this._globalTileRange;if(!e.wrapLng&&(t.x<i.min.x||t.x>i.max.x)||!e.wrapLat&&(t.y<i.min.y||t.y>i.max.y))return!1}if(!this.options.bounds)return!0;var n=this._tileCoordsToBounds(t);return F(this.options.bounds).overlaps(n)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,i=this.getTileSize(),n=t.scaleBy(i),r=n.add(i);return[e.unproject(n,t.z),e.unproject(r,t.z)]},_tileCoordsToBounds:function(t){var e=this._tileCoordsToNwSe(t),i=new R(e[0],e[1]);return this.options.noWrap||(i=this._map.wrapLatLngBounds(i)),i},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var e=t.split(":"),i=new I(+e[0],+e[1]);return i.z=+e[2],i},_removeTile:function(t){var e=this._tiles[t];e&&(ne(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){le(t,"leaflet-tile");var e=this.getTileSize();t.style.width=e.x+"px",t.style.height=e.y+"px",t.onselectstart=l,t.onmousemove=l,Q&&this.options.opacity<1&&pe(t,this.options.opacity),it&&!nt&&(t.style.WebkitBackfaceVisibility="hidden")},_addTile:function(t,e){var i=this._getTilePos(t),r=this._tileCoordsToKey(t),o=this.createTile(this._wrapCoords(t),n(this._tileReady,this,t));this._initTile(o),this.createTile.length<2&&E(n(this._tileReady,this,t,null,o)),fe(o,i),this._tiles[r]={el:o,coords:t,current:!0},e.appendChild(o),this.fire("tileloadstart",{tile:o,coords:t})},_tileReady:function(t,e,i){e&&this.fire("tileerror",{error:e,tile:i,coords:t});var r=this._tileCoordsToKey(t);(i=this._tiles[r])&&(i.loaded=+new Date,this._map._fadeAnimated?(pe(i.el,0),S(this._fadeFrame),this._fadeFrame=E(this._updateOpacity,this)):(i.active=!0,this._pruneTiles()),e||(le(i.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:i.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),Q||!this._map._fadeAnimated?E(this._pruneTiles,this):setTimeout(n(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new I(this._wrapX?a(t.x,this._wrapX):t.x,this._wrapY?a(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new D(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});var rn=nn.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1},initialize:function(t,e){this._url=t,(e=p(this,e)).detectRetina&&St&&e.maxZoom>0&&(e.tileSize=Math.floor(e.tileSize/2),e.zoomReverse?(e.zoomOffset--,e.minZoom++):(e.zoomOffset++,e.maxZoom--),e.minZoom=Math.max(0,e.minZoom)),"string"==typeof e.subdomains&&(e.subdomains=e.subdomains.split("")),it||this.on("tileunload",this._onTileRemove)},setUrl:function(t,e){return this._url===t&&void 0===e&&(e=!0),this._url=t,e||this.redraw(),this},createTile:function(t,e){var i=document.createElement("img");return Se(i,"load",n(this._tileOnLoad,this,e,i)),Se(i,"error",n(this._tileOnError,this,e,i)),(this.options.crossOrigin||""===this.options.crossOrigin)&&(i.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),i.alt="",i.setAttribute("role","presentation"),i.src=this.getTileUrl(t),i},getTileUrl:function(t){var i={r:St?"@2x":"",s:this._getSubdomain(t),x:t.x,y:t.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var n=this._globalTileRange.max.y-t.y;this.options.tms&&(i.y=n),i["-y"]=n}return f(this._url,e(i,this.options))},_tileOnLoad:function(t,e){Q?setTimeout(n(t,this,null,e),0):t(null,e)},_tileOnError:function(t,e,i){var n=this.options.errorTileUrl;n&&e.getAttribute("src")!==n&&(e.src=n),t(i,e)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,e=this.options.maxZoom;return this.options.zoomReverse&&(t=e-t),t+this.options.zoomOffset},_getSubdomain:function(t){var e=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[e]},_abortLoading:function(){var t,e;for(t in this._tiles)this._tiles[t].coords.z!==this._tileZoom&&((e=this._tiles[t].el).onload=l,e.onerror=l,e.complete||(e.src=y,ne(e),delete this._tiles[t]))},_removeTile:function(t){var e=this._tiles[t];if(e)return ot||e.el.setAttribute("src",y),nn.prototype._removeTile.call(this,t)},_tileReady:function(t,e,i){if(this._map&&(!i||i.getAttribute("src")!==y))return nn.prototype._tileReady.call(this,t,e,i)}});function on(t,e){return new rn(t,e)}var sn=rn.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(t,i){this._url=t;var n=e({},this.defaultWmsParams);for(var r in i)r in this.options||(n[r]=i[r]);var o=(i=p(this,i)).detectRetina&&St?2:1,s=this.getTileSize();n.width=s.x*o,n.height=s.y*o,this.wmsParams=n},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var e=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[e]=this._crs.code,rn.prototype.onAdd.call(this,t)},getTileUrl:function(t){var e=this._tileCoordsToNwSe(t),i=this._crs,n=B(i.project(e[0]),i.project(e[1])),r=n.min,o=n.max,s=(this._wmsVersion>=1.3&&this._crs===Ti?[r.y,r.x,o.y,o.x]:[r.x,r.y,o.x,o.y]).join(","),a=rn.prototype.getTileUrl.call(this,t);return a+d(this.wmsParams,a,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+s},setParams:function(t,i){return e(this.wmsParams,t),i||this.redraw(),this}});rn.WMS=sn,on.wms=function(t,e){return new sn(t,e)};var an=Si.extend({options:{padding:.1,tolerance:0},initialize:function(t){p(this,t),o(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),this._zoomAnimated&&le(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var t={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(t.zoomanim=this._onAnimZoom),t},_onAnimZoom:function(t){this._updateTransform(t.center,t.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(t,e){var i=this._map.getZoomScale(e,this._zoom),n=ge(this._container),r=this._map.getSize().multiplyBy(.5+this.options.padding),o=this._map.project(this._center,e),s=this._map.project(t,e).subtract(o),a=r.multiplyBy(-i).add(n).add(r).subtract(s);gt?me(this._container,a,i):fe(this._container,a)},_reset:function(){for(var t in this._update(),this._updateTransform(this._center,this._zoom),this._layers)this._layers[t]._reset()},_onZoomEnd:function(){for(var t in this._layers)this._layers[t]._project()},_updatePaths:function(){for(var t in this._layers)this._layers[t]._update()},_update:function(){var t=this.options.padding,e=this._map.getSize(),i=this._map.containerPointToLayerPoint(e.multiplyBy(-t)).round();this._bounds=new D(i,i.add(e.multiplyBy(1+2*t)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),ln=an.extend({getEvents:function(){var t=an.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){an.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");Se(t,"mousemove",this._onMouseMove,this),Se(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),Se(t,"mouseout",this._handleMouseOut,this),this._ctx=t.getContext("2d")},_destroyContainer:function(){S(this._redrawRequest),delete this._ctx,ne(this._container),ze(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){for(var t in this._redrawBounds=null,this._layers)this._layers[t]._update();this._redraw()}},_update:function(){if(!this._map._animatingZoom||!this._bounds){an.prototype._update.call(this);var t=this._bounds,e=this._container,i=t.getSize(),n=St?2:1;fe(e,t.min),e.width=n*i.x,e.height=n*i.y,e.style.width=i.x+"px",e.style.height=i.y+"px",St&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){an.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[o(t)]=t;var e=t._order={layer:t,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=e),this._drawLast=e,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(t){this._requestRedraw(t)},_removePath:function(t){var e=t._order,i=e.next,n=e.prev;i?i.prev=n:this._drawLast=n,n?n.next=i:this._drawFirst=i,delete t._order,delete this._layers[o(t)],this._requestRedraw(t)},_updatePath:function(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t)},_updateStyle:function(t){this._updateDashArray(t),this._requestRedraw(t)},_updateDashArray:function(t){if("string"==typeof t.options.dashArray){var e,i,n=t.options.dashArray.split(/[, ]+/),r=[];for(i=0;i<n.length;i++){if(e=Number(n[i]),isNaN(e))return;r.push(e)}t.options._dashArray=r}else t.options._dashArray=t.options.dashArray},_requestRedraw:function(t){this._map&&(this._extendRedrawBounds(t),this._redrawRequest=this._redrawRequest||E(this._redraw,this))},_extendRedrawBounds:function(t){if(t._pxBounds){var e=(t.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new D,this._redrawBounds.extend(t._pxBounds.min.subtract([e,e])),this._redrawBounds.extend(t._pxBounds.max.add([e,e]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var t=this._redrawBounds;if(t){var e=t.getSize();this._ctx.clearRect(t.min.x,t.min.y,e.x,e.y)}else this._ctx.save(),this._ctx.setTransform(1,0,0,1,0,0),this._ctx.clearRect(0,0,this._container.width,this._container.height),this._ctx.restore()},_draw:function(){var t,e=this._redrawBounds;if(this._ctx.save(),e){var i=e.getSize();this._ctx.beginPath(),this._ctx.rect(e.min.x,e.min.y,i.x,i.y),this._ctx.clip()}this._drawing=!0;for(var n=this._drawFirst;n;n=n.next)t=n.layer,(!e||t._pxBounds&&t._pxBounds.intersects(e))&&t._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(t,e){if(this._drawing){var i,n,r,o,s=t._parts,a=s.length,l=this._ctx;if(a){for(l.beginPath(),i=0;i<a;i++){for(n=0,r=s[i].length;n<r;n++)o=s[i][n],l[n?"lineTo":"moveTo"](o.x,o.y);e&&l.closePath()}this._fillStroke(l,t)}}},_updateCircle:function(t){if(this._drawing&&!t._empty()){var e=t._point,i=this._ctx,n=Math.max(Math.round(t._radius),1),r=(Math.max(Math.round(t._radiusY),1)||n)/n;1!==r&&(i.save(),i.scale(1,r)),i.beginPath(),i.arc(e.x,e.y/r,n,0,2*Math.PI,!1),1!==r&&i.restore(),this._fillStroke(i,t)}},_fillStroke:function(t,e){var i=e.options;i.fill&&(t.globalAlpha=i.fillOpacity,t.fillStyle=i.fillColor||i.color,t.fill(i.fillRule||"evenodd")),i.stroke&&0!==i.weight&&(t.setLineDash&&t.setLineDash(e.options&&e.options._dashArray||[]),t.globalAlpha=i.opacity,t.lineWidth=i.weight,t.strokeStyle=i.color,t.lineCap=i.lineCap,t.lineJoin=i.lineJoin,t.stroke())},_onClick:function(t){for(var e,i,n=this._map.mouseEventToLayerPoint(t),r=this._drawFirst;r;r=r.next)(e=r.layer).options.interactive&&e._containsPoint(n)&&("click"!==t.type&&"preclick"===t.type||!this._map._draggableMoved(e))&&(i=e);i&&(Ne(t),this._fireEvent([i],t))},_onMouseMove:function(t){if(this._map&&!this._map.dragging.moving()&&!this._map._animatingZoom){var e=this._map.mouseEventToLayerPoint(t);this._handleMouseHover(t,e)}},_handleMouseOut:function(t){var e=this._hoveredLayer;e&&(ce(this._container,"leaflet-interactive"),this._fireEvent([e],t,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(t,e){if(!this._mouseHoverThrottled){for(var i,r,o=this._drawFirst;o;o=o.next)(i=o.layer).options.interactive&&i._containsPoint(e)&&(r=i);r!==this._hoveredLayer&&(this._handleMouseOut(t),r&&(le(this._container,"leaflet-interactive"),this._fireEvent([r],t,"mouseover"),this._hoveredLayer=r)),this._hoveredLayer&&this._fireEvent([this._hoveredLayer],t),this._mouseHoverThrottled=!0,setTimeout(n((function(){this._mouseHoverThrottled=!1}),this),32)}},_fireEvent:function(t,e,i){this._map._fireDOMEvent(e,i||e.type,t)},_bringToFront:function(t){var e=t._order;if(e){var i=e.next,n=e.prev;i&&(i.prev=n,n?n.next=i:i&&(this._drawFirst=i),e.prev=this._drawLast,this._drawLast.next=e,e.next=null,this._drawLast=e,this._requestRedraw(t))}},_bringToBack:function(t){var e=t._order;if(e){var i=e.next,n=e.prev;n&&(n.next=i,i?i.prev=n:n&&(this._drawLast=n),e.prev=null,e.next=this._drawFirst,this._drawFirst.prev=e,this._drawFirst=e,this._requestRedraw(t))}}});function cn(t){return zt?new ln(t):null}var hn=function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(t){return document.createElement("<lvml:"+t+' class="lvml">')}}catch(t){return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),un={_initContainer:function(){this._container=ie("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(an.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var e=t._container=hn("shape");le(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",t._path=hn("path"),e.appendChild(t._path),this._updateStyle(t),this._layers[o(t)]=t},_addPath:function(t){var e=t._container;this._container.appendChild(e),t.options.interactive&&t.addInteractiveTarget(e)},_removePath:function(t){var e=t._container;ne(e),t.removeInteractiveTarget(e),delete this._layers[o(t)]},_updateStyle:function(t){var e=t._stroke,i=t._fill,n=t.options,r=t._container;r.stroked=!!n.stroke,r.filled=!!n.fill,n.stroke?(e||(e=t._stroke=hn("stroke")),r.appendChild(e),e.weight=n.weight+"px",e.color=n.color,e.opacity=n.opacity,n.dashArray?e.dashStyle=g(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):e.dashStyle="",e.endcap=n.lineCap.replace("butt","flat"),e.joinstyle=n.lineJoin):e&&(r.removeChild(e),t._stroke=null),n.fill?(i||(i=t._fill=hn("fill")),r.appendChild(i),i.color=n.fillColor||n.color,i.opacity=n.fillOpacity):i&&(r.removeChild(i),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),i=Math.round(t._radius),n=Math.round(t._radiusY||i);this._setPath(t,t._empty()?"M0 0":"AL "+e.x+","+e.y+" "+i+","+n+" 0,23592600")},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){oe(t._container)},_bringToBack:function(t){se(t._container)}},pn=Mt?hn:X,dn=an.extend({getEvents:function(){var t=an.prototype.getEvents.call(this);return t.zoomstart=this._onZoomStart,t},_initContainer:function(){this._container=pn("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=pn("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ne(this._container),ze(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_onZoomStart:function(){this._update()},_update:function(){if(!this._map._animatingZoom||!this._bounds){an.prototype._update.call(this);var t=this._bounds,e=t.getSize(),i=this._container;this._svgSize&&this._svgSize.equals(e)||(this._svgSize=e,i.setAttribute("width",e.x),i.setAttribute("height",e.y)),fe(i,t.min),i.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update")}},_initPath:function(t){var e=t._path=pn("path");t.options.className&&le(e,t.options.className),t.options.interactive&&le(e,"leaflet-interactive"),this._updateStyle(t),this._layers[o(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){ne(t._path),t.removeInteractiveTarget(t._path),delete this._layers[o(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path,i=t.options;e&&(i.stroke?(e.setAttribute("stroke",i.color),e.setAttribute("stroke-opacity",i.opacity),e.setAttribute("stroke-width",i.weight),e.setAttribute("stroke-linecap",i.lineCap),e.setAttribute("stroke-linejoin",i.lineJoin),i.dashArray?e.setAttribute("stroke-dasharray",i.dashArray):e.removeAttribute("stroke-dasharray"),i.dashOffset?e.setAttribute("stroke-dashoffset",i.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),i.fill?(e.setAttribute("fill",i.fillColor||i.color),e.setAttribute("fill-opacity",i.fillOpacity),e.setAttribute("fill-rule",i.fillRule||"evenodd")):e.setAttribute("fill","none"))},_updatePoly:function(t,e){this._setPath(t,K(t._parts,e))},_updateCircle:function(t){var e=t._point,i=Math.max(Math.round(t._radius),1),n="a"+i+","+(Math.max(Math.round(t._radiusY),1)||i)+" 0 1,0 ",r=t._empty()?"M0 0":"M"+(e.x-i)+","+e.y+n+2*i+",0 "+n+2*-i+",0 ";this._setPath(t,r)},_setPath:function(t,e){t._path.setAttribute("d",e)},_bringToFront:function(t){oe(t._path)},_bringToBack:function(t){se(t._path)}});function mn(t){return Ct||Mt?new dn(t):null}Mt&&dn.include(un),Ge.include({getRenderer:function(t){var e=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return e||(e=this._renderer=this._createRenderer()),this.hasLayer(e)||this.addLayer(e),e},_getPaneRenderer:function(t){if("overlayPane"===t||void 0===t)return!1;var e=this._paneRenderers[t];return void 0===e&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e},_createRenderer:function(t){return this.options.preferCanvas&&cn(t)||mn(t)}});var fn=Ri.extend({initialize:function(t,e){Ri.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=F(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});dn.create=pn,dn.pointsToPath=K,Fi.geometryToLayer=Oi,Fi.coordsToLatLng=Vi,Fi.coordsToLatLngs=Ni,Fi.latLngToCoords=Zi,Fi.latLngsToCoords=ji,Fi.getFeature=qi,Fi.asFeature=$i,Ge.mergeOptions({boxZoom:!0});var gn=Qe.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){Se(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){ze(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ne(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),Gt(),ye(),this._startPoint=this._map.mouseEventToContainerPoint(t),Se(document,{contextmenu:Re,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=ie("div","leaflet-zoom-box",this._container),le(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var e=new D(this._point,this._startPoint),i=e.getSize();fe(this._box,e.min),this._box.style.width=i.x+"px",this._box.style.height=i.y+"px"},_finish:function(){this._moved&&(ne(this._box),ce(this._container,"leaflet-crosshair")),Ht(),ve(),ze(document,{contextmenu:Re,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if((1===t.which||1===t.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(n(this._resetState,this),0);var e=new R(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(e).fire("boxzoomend",{boxZoomBounds:e})}},_onKeyDown:function(t){27===t.keyCode&&this._finish()}});Ge.addInitHook("addHandler","boxZoom",gn),Ge.mergeOptions({doubleClickZoom:!0});var _n=Qe.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var e=this._map,i=e.getZoom(),n=e.options.zoomDelta,r=t.originalEvent.shiftKey?i-n:i+n;"center"===e.options.doubleClickZoom?e.setZoom(r):e.setZoomAround(t.containerPoint,r)}});Ge.addInitHook("addHandler","doubleClickZoom",_n),Ge.mergeOptions({dragging:!0,inertia:!nt,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var yn=Qe.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new oi(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}le(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){ce(this._map._container,"leaflet-grab"),ce(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var e=F(this._map.options.maxBounds);this._offsetLimit=B(this._map.latLngToContainerPoint(e.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(e.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var e=this._lastTime=+new Date,i=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(i),this._times.push(e),this._prunePositions(e)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;this._positions.length>1&&t-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var t=this._map.getSize().divideBy(2),e=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=e.subtract(t).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(t,e){return t-(t-e)*this._viscosity},_onPreDragLimit:function(){if(this._viscosity&&this._offsetLimit){var t=this._draggable._newPos.subtract(this._draggable._startPos),e=this._offsetLimit;t.x<e.min.x&&(t.x=this._viscousLimit(t.x,e.min.x)),t.y<e.min.y&&(t.y=this._viscousLimit(t.y,e.min.y)),t.x>e.max.x&&(t.x=this._viscousLimit(t.x,e.max.x)),t.y>e.max.y&&(t.y=this._viscousLimit(t.y,e.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,e=Math.round(t/2),i=this._initialWorldOffset,n=this._draggable._newPos.x,r=(n-e+i)%t+e-i,o=(n+e+i)%t-e-i,s=Math.abs(r+i)<Math.abs(o+i)?r:o;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=s},_onDragEnd:function(t){var e=this._map,i=e.options,n=!i.inertia||this._times.length<2;if(e.fire("dragend",t),n)e.fire("moveend");else{this._prunePositions(+new Date);var r=this._lastPos.subtract(this._positions[0]),o=(this._lastTime-this._times[0])/1e3,s=i.easeLinearity,a=r.multiplyBy(s/o),l=a.distanceTo([0,0]),c=Math.min(i.inertiaMaxSpeed,l),h=a.multiplyBy(c/l),u=c/(i.inertiaDeceleration*s),p=h.multiplyBy(-u/2).round();p.x||p.y?(p=e._limitOffset(p,e.options.maxBounds),E((function(){e.panBy(p,{duration:u,easeLinearity:s,noMoveStart:!0,animate:!0})}))):e.fire("moveend")}}});Ge.addInitHook("addHandler","dragging",yn),Ge.mergeOptions({keyboard:!0,keyboardPanDelta:80});var vn=Qe.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(t){this._map=t,this._setPanDelta(t.options.keyboardPanDelta),this._setZoomDelta(t.options.zoomDelta)},addHooks:function(){var t=this._map._container;t.tabIndex<=0&&(t.tabIndex="0"),Se(t,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),ze(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var t=document.body,e=document.documentElement,i=t.scrollTop||e.scrollTop,n=t.scrollLeft||e.scrollLeft;this._map._container.focus(),window.scrollTo(n,i)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(t){var e,i,n=this._panKeys={},r=this.keyCodes;for(e=0,i=r.left.length;e<i;e++)n[r.left[e]]=[-1*t,0];for(e=0,i=r.right.length;e<i;e++)n[r.right[e]]=[t,0];for(e=0,i=r.down.length;e<i;e++)n[r.down[e]]=[0,t];for(e=0,i=r.up.length;e<i;e++)n[r.up[e]]=[0,-1*t]},_setZoomDelta:function(t){var e,i,n=this._zoomKeys={},r=this.keyCodes;for(e=0,i=r.zoomIn.length;e<i;e++)n[r.zoomIn[e]]=t;for(e=0,i=r.zoomOut.length;e<i;e++)n[r.zoomOut[e]]=-t},_addHooks:function(){Se(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){ze(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e,i=t.keyCode,n=this._map;if(i in this._panKeys)n._panAnim&&n._panAnim._inProgress||(e=this._panKeys[i],t.shiftKey&&(e=k(e).multiplyBy(3)),n.panBy(e),n.options.maxBounds&&n.panInsideBounds(n.options.maxBounds));else if(i in this._zoomKeys)n.setZoom(n.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[i]);else{if(27!==i||!n._popup||!n._popup.options.closeOnEscapeKey)return;n.closePopup()}Re(t)}}});Ge.addInitHook("addHandler","keyboard",vn),Ge.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var xn=Qe.extend({addHooks:function(){Se(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){ze(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(t){var e=Ue(t),i=this._map.options.wheelDebounceTime;this._delta+=e,this._lastMousePos=this._map.mouseEventToContainerPoint(t),this._startTime||(this._startTime=+new Date);var r=Math.max(i-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(n(this._performZoom,this),r),Re(t)},_performZoom:function(){var t=this._map,e=t.getZoom(),i=this._map.options.zoomSnap||0;t._stop();var n=this._delta/(4*this._map.options.wheelPxPerZoomLevel),r=4*Math.log(2/(1+Math.exp(-Math.abs(n))))/Math.LN2,o=i?Math.ceil(r/i)*i:r,s=t._limitZoom(e+(this._delta>0?o:-o))-e;this._delta=0,this._startTime=null,s&&("center"===t.options.scrollWheelZoom?t.setZoom(e+s):t.setZoomAround(this._lastMousePos,e+s))}});Ge.addInitHook("addHandler","scrollWheelZoom",xn),Ge.mergeOptions({tap:!0,tapTolerance:15});var bn=Qe.extend({addHooks:function(){Se(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){ze(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(t.touches){if(Be(t),this._fireClick=!0,t.touches.length>1)return this._fireClick=!1,void clearTimeout(this._holdTimeout);var e=t.touches[0],i=e.target;this._startPos=this._newPos=new I(e.clientX,e.clientY),i.tagName&&"a"===i.tagName.toLowerCase()&&le(i,"leaflet-active"),this._holdTimeout=setTimeout(n((function(){this._isTapValid()&&(this._fireClick=!1,this._onUp(),this._simulateEvent("contextmenu",e))}),this),1e3),this._simulateEvent("mousedown",e),Se(document,{touchmove:this._onMove,touchend:this._onUp},this)}},_onUp:function(t){if(clearTimeout(this._holdTimeout),ze(document,{touchmove:this._onMove,touchend:this._onUp},this),this._fireClick&&t&&t.changedTouches){var e=t.changedTouches[0],i=e.target;i&&i.tagName&&"a"===i.tagName.toLowerCase()&&ce(i,"leaflet-active"),this._simulateEvent("mouseup",e),this._isTapValid()&&this._simulateEvent("click",e)}},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_onMove:function(t){var e=t.touches[0];this._newPos=new I(e.clientX,e.clientY),this._simulateEvent("mousemove",e)},_simulateEvent:function(t,e){var i=document.createEvent("MouseEvents");i._simulated=!0,e.target._simulatedClick=!0,i.initMouseEvent(t,!0,!0,window,1,e.screenX,e.screenY,e.clientX,e.clientY,!1,!1,!1,!1,0,null),e.target.dispatchEvent(i)}});!wt||bt&&!ct||Ge.addInitHook("addHandler","tap",bn),Ge.mergeOptions({touchZoom:wt&&!nt,bounceAtZoomLimits:!0});var wn=Qe.extend({addHooks:function(){le(this._map._container,"leaflet-touch-zoom"),Se(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){ce(this._map._container,"leaflet-touch-zoom"),ze(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var e=this._map;if(t.touches&&2===t.touches.length&&!e._animatingZoom&&!this._zooming){var i=e.mouseEventToContainerPoint(t.touches[0]),n=e.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=e.getSize()._divideBy(2),this._startLatLng=e.containerPointToLatLng(this._centerPoint),"center"!==e.options.touchZoom&&(this._pinchStartLatLng=e.containerPointToLatLng(i.add(n)._divideBy(2))),this._startDist=i.distanceTo(n),this._startZoom=e.getZoom(),this._moved=!1,this._zooming=!0,e._stop(),Se(document,"touchmove",this._onTouchMove,this),Se(document,"touchend",this._onTouchEnd,this),Be(t)}},_onTouchMove:function(t){if(t.touches&&2===t.touches.length&&this._zooming){var e=this._map,i=e.mouseEventToContainerPoint(t.touches[0]),r=e.mouseEventToContainerPoint(t.touches[1]),o=i.distanceTo(r)/this._startDist;if(this._zoom=e.getScaleZoom(o,this._startZoom),!e.options.bounceAtZoomLimits&&(this._zoom<e.getMinZoom()&&o<1||this._zoom>e.getMaxZoom()&&o>1)&&(this._zoom=e._limitZoom(this._zoom)),"center"===e.options.touchZoom){if(this._center=this._startLatLng,1===o)return}else{var s=i._add(r)._divideBy(2)._subtract(this._centerPoint);if(1===o&&0===s.x&&0===s.y)return;this._center=e.unproject(e.project(this._pinchStartLatLng,this._zoom).subtract(s),this._zoom)}this._moved||(e._moveStart(!0,!1),this._moved=!0),S(this._animRequest);var a=n(e._move,e,this._center,this._zoom,{pinch:!0,round:!1});this._animRequest=E(a,this,!0),Be(t)}},_onTouchEnd:function(){this._moved&&this._zooming?(this._zooming=!1,S(this._animRequest),ze(document,"touchmove",this._onTouchMove,this),ze(document,"touchend",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))):this._zooming=!1}});Ge.addInitHook("addHandler","touchZoom",wn),Ge.BoxZoom=gn,Ge.DoubleClickZoom=_n,Ge.Drag=yn,Ge.Keyboard=vn,Ge.ScrollWheelZoom=xn,Ge.Tap=bn,Ge.TouchZoom=wn,t.version="1.7.1",t.Control=He,t.control=We,t.Browser=At,t.Evented=M,t.Mixin=ei,t.Util=P,t.Class=z,t.Handler=Qe,t.extend=e,t.bind=n,t.stamp=o,t.setOptions=p,t.DomEvent=qe,t.DomUtil=Ee,t.PosAnimation=$e,t.Draggable=oi,t.LineUtil=gi,t.PolyUtil=yi,t.Point=I,t.point=k,t.Bounds=D,t.bounds=B,t.Transformation=$,t.transformation=G,t.Projection=bi,t.LatLng=O,t.latLng=U,t.LatLngBounds=R,t.latLngBounds=F,t.CRS=N,t.GeoJSON=Fi,t.geoJSON=Hi,t.geoJson=Wi,t.Layer=Si,t.LayerGroup=Pi,t.layerGroup=function(t,e){return new Pi(t,e)},t.FeatureGroup=zi,t.featureGroup=function(t,e){return new zi(t,e)},t.ImageOverlay=Xi,t.imageOverlay=function(t,e,i){return new Xi(t,e,i)},t.VideoOverlay=Ki,t.videoOverlay=function(t,e,i){return new Ki(t,e,i)},t.SVGOverlay=Yi,t.svgOverlay=function(t,e,i){return new Yi(t,e,i)},t.DivOverlay=Ji,t.Popup=Qi,t.popup=function(t,e){return new Qi(t,e)},t.Tooltip=tn,t.tooltip=function(t,e){return new tn(t,e)},t.Icon=Ci,t.icon=function(t){return new Ci(t)},t.DivIcon=en,t.divIcon=function(t){return new en(t)},t.Marker=Ai,t.marker=function(t,e){return new Ai(t,e)},t.TileLayer=rn,t.tileLayer=on,t.GridLayer=nn,t.gridLayer=function(t){return new nn(t)},t.SVG=dn,t.svg=mn,t.Renderer=an,t.Canvas=ln,t.canvas=cn,t.Path=ki,t.CircleMarker=Li,t.circleMarker=function(t,e){return new Li(t,e)},t.Circle=Di,t.circle=function(t,e,i){return new Di(t,e,i)},t.Polyline=Bi,t.polyline=function(t,e){return new Bi(t,e)},t.Polygon=Ri,t.polygon=function(t,e){return new Ri(t,e)},t.Rectangle=fn,t.rectangle=function(t,e){return new fn(t,e)},t.Map=Ge,t.map=function(t,e){return new Ge(t,e)};var Tn=window.L;t.noConflict=function(){return window.L=Tn,this},window.L=t}(e)},795:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>s});var n=i(379),r=i.n(n),o=i(550);r()(o.Z,{insert:"head",singleton:!1});const s=o.Z.locals||{}},276:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>s});var n=i(379),r=i.n(n),o=i(40);r()(o.Z,{insert:"head",singleton:!1});const s=o.Z.locals||{}},477:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>s});var n=i(379),r=i.n(n),o=i(958);r()(o.Z,{insert:"head",singleton:!1});const s=o.Z.locals||{}},379:(t,e,i)=>{"use strict";var n,r=function(){var t={};return function(e){if(void 0===t[e]){var i=document.querySelector(e);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(t){i=null}t[e]=i}return t[e]}}(),o=[];function s(t){for(var e=-1,i=0;i<o.length;i++)if(o[i].identifier===t){e=i;break}return e}function a(t,e){for(var i={},n=[],r=0;r<t.length;r++){var a=t[r],l=e.base?a[0]+e.base:a[0],c=i[l]||0,h="".concat(l," ").concat(c);i[l]=c+1;var u=s(h),p={css:a[1],media:a[2],sourceMap:a[3]};-1!==u?(o[u].references++,o[u].updater(p)):o.push({identifier:h,updater:f(p,e),references:1}),n.push(h)}return n}function l(t){var e=document.createElement("style"),n=t.attributes||{};if(void 0===n.nonce){var o=i.nc;o&&(n.nonce=o)}if(Object.keys(n).forEach((function(t){e.setAttribute(t,n[t])})),"function"==typeof t.insert)t.insert(e);else{var s=r(t.insert||"head");if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(e)}return e}var c,h=(c=[],function(t,e){return c[t]=e,c.filter(Boolean).join("\n")});function u(t,e,i,n){var r=i?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(t.styleSheet)t.styleSheet.cssText=h(e,r);else{var o=document.createTextNode(r),s=t.childNodes;s[e]&&t.removeChild(s[e]),s.length?t.insertBefore(o,s[e]):t.appendChild(o)}}function p(t,e,i){var n=i.css,r=i.media,o=i.sourceMap;if(r?t.setAttribute("media",r):t.removeAttribute("media"),o&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}var d=null,m=0;function f(t,e){var i,n,r;if(e.singleton){var o=m++;i=d||(d=l(e)),n=u.bind(null,i,o,!1),r=u.bind(null,i,o,!0)}else i=l(e),n=p.bind(null,i,e),r=function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(i)};return n(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;n(t=e)}else r()}}t.exports=function(t,e){(e=e||{}).singleton||"boolean"==typeof e.singleton||(e.singleton=(void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n));var i=a(t=t||[],e);return function(t){if(t=t||[],"[object Array]"===Object.prototype.toString.call(t)){for(var n=0;n<i.length;n++){var r=s(i[n]);o[r].references--}for(var l=a(t,e),c=0;c<i.length;c++){var h=s(i[c]);0===o[h].references&&(o[h].updater(),o.splice(h,1))}i=l}}}},389:function(t,e,i){var n,r;n=[i(243),i(693)],void 0===(r=function(t){const e=["road_oneway","bridge_major_trunk_primary","bridge_minor_trunk_primary","bridge_major","bridge_major case","road_trunk_primary","road_secondary_tertiary","road_minor","tunnel_major","road_major_motorway","road_pier","road_area_pier"];t.EditDrag=t.EditDrag||{},t.EditDrag.Polyline=t.Handler.extend({options:{distance:20,tollerance:0,vertices:{},icon:new t.DivIcon({iconSize:new t.Point(8,8),className:"leaflet-div-icon leaflet-editing-icon maplink-edit-icon"}),snapToClosestPoint:null},initialize:function(e){this._poly=e,this._marker=null,this._dragging=!1,this._points_of_interest=[this._poly._latlngs[0],this._poly._latlngs[this._poly._latlngs.length-1]],this._markerLayer=null,this._removeMarkerEventName=e.options.removeMarkerEventName??"contextmenu",t.Util.setOptions(this,e.options)},addHooks:function(){this._poly._map&&(this._map=this._poly._map,this._map.on("mousemove",this._mouseMove,this),this._plotPointsOfInterestMarkers())},removeHooks:function(){this._map.off("mousemove")},_peekdepth:function(t,e){if(e=e||new WeakSet,!(t instanceof Array)||e.has(t))return 0;e.add(t);let i=0,n=0;for(;i<t.length;)n=Math.max(n,this._peekdepth(t[i],e)),i+=1;return 1+n},_getClosestPointAndSegment:function(e){let i=1/0,n=null;for(let r=0,o=this._poly._latlngs.length-1;r<o;r++){let o=[this._poly._latlngs[r],this._poly._latlngs[r+1]],s=t.GeometryUtil.distanceSegment(this._map,e,o[0],o[1]);s<i&&(i=s,n=o)}return{point:t.GeometryUtil.closestOnSegment(this._map,e,n[0],n[1]),segment:n}},_mouseContextClick:function(e){let i=t.GeometryUtil.closest(this._map,this._poly,e.latlng,!0);if(!1!==this.options.vertices.destroy&&i.distance<this.options.tollerance){let t=this._poly._latlngs.findIndex((t=>i.lat===t.lat&&i.lng==t.lng)),e=this._poly._latlngs.length-1;if(!1===this.options.vertices.first&&0==t||!1===this.options.vertices.last&&t==e)return;const n=this._poly.getLatLngs(),r=n.splice(t,1)[0];this._poly.fire("removedPoint",r);const o=this._points_of_interest.findIndex((t=>t.lat===r.lat&&t.lng===r.lng));o>-1&&(this._points_of_interest.splice(o,1),this._plotPointsOfInterestMarkers()),this._poly.setLatLngs(n),this._map.removeLayer(this._marker),this._marker=null}},_mouseMove:function(e){if(this._dragging)return;let i=t.GeometryUtil.closestLayerSnap(this._map,[this._poly],e.latlng,this.options.distance,!1);this._marker&&i?(this._marker.addTo(this._map),t.extend(this._marker._latlng,i.latlng),this._marker.options.draggable=!0,this._marker.update()):!this._marker&&i?(this._marker=t.marker(i.latlng,{draggable:!0,icon:this.options.icon}).addTo(this._map),this._marker.on("dragstart",this._markerDragStart,this),this._marker.on("drag",this._markerDrag,this),this._marker.on("dragend",this._markerDragEnd,this),this._marker.on(this._removeMarkerEventName,this._mouseContextClick,this)):this._marker&&(this._map.removeLayer(this._marker),this._marker=null)},_isInvalidDrag:function(t){let e=this._poly._latlngs.length-1;return!1===this.options.vertices.first&&0==t||!1===this.options.vertices.last&&t==e||!1===this.options.vertices.middle&&t>0&&t<e||(!1===this.options.vertices.middle||!1===this.options.vertices.insert)&&-1===t},_markerDragStart:function(e){let i=e.target.getLatLng();if(this.closest=t.GeometryUtil.closest(this._map,this._poly,i,!0),this._dragging=!0,this.closest.distance<this.options.tollerance){const e=new t.latLng(this.closest.lat,this.closest.lng);let i=this._poly._latlngs.indexOf(e);this._isInvalidDrag(i)&&(this.closest=null,this._marker.options.draggable=!1)}else{this.closest=this._getClosestPointAndSegment(i);const e=new t.latLng(this.closest.lat,this.closest.lng);let n=this._poly._latlngs.indexOf(e);if(this._isInvalidDrag(n))return this.closest=null,void(this._marker.options.draggable=!1);let r=this._poly._latlngs.indexOf(this.closest.segment[1]);this._poly._latlngs.splice(r,0,this.closest)}},_markerDrag:function(t){if(this.closest){if(this.closest.lat=t.target.getLatLng().lat,this.closest.lng=t.target.getLatLng().lng,this.closest.pixelPosition={x:t.originalEvent.layerX,y:t.originalEvent.layerY},this.options.snapToClosestPoint){let t=this._snapToClosestPoint();t&&(this.closest.lat=t.latlng.lat,this.closest.lng=t.latlng.lng)}this._poly.redraw()}},_markerDragEnd:function(e){if(this._dragging=!1,-1!==this._poly._latlngs.indexOf(this.closest)){let e=this._findNextWaypoint(this.closest,this._points_of_interest);this._points_of_interest.splice(e.nextWayPoint,0,t.latLng(this.closest.lat,this.closest.lng)),this._plotPointsOfInterestMarkers(),this._poly.fire("addedPoint",{...this.closest.point}),this._poly.fire("pointsOfInterestChanged",{points:[...this._points_of_interest]})}},_getRoadPolylines:function(t){const e=[];if("MultiLineString"===t.type&&t.coordinates.forEach((t=>{const i=t.map((t=>{const[e,i]=t;return[i,e]}));e.push(i)})),"LineString"===t.type){const i=t.coordinates.map((t=>{const[e,i]=t;return[i,e]}));e.push(i)}return e},_findNextWaypoint:function(t,e){let i=Number.MAX_VALUE,n=0,r=0;return this._poly._latlngs.forEach((o=>{this._calcDist(o,e[n])<1&&(r=Math.min(e.length-1,r+1));const s=this._calcDist(o,t);s<i&&(i=s,n=r==e.length?r-1:r)})),{minDistance:i,nextWayPoint:n}},_calcDist(t,e){const i=t.lat,n=e.lat,r=t.lng,o=e.lng,s=Math.sin(this._toRad(n-i)/2),a=Math.sin(this._toRad(o-r)/2);return 12742e3*Math.asin(Math.sqrt(s*s+a*a*Math.cos(this._toRad(i))*Math.cos(this._toRad(n))))},_toRad:t=>.017453292519943295*t,_plotPointsOfInterestMarkers:function(){this._markerLayer&&this._map.removeLayer(this._markerLayer);const e=this._points_of_interest.map((({lat:e,lng:i})=>{const n=new t.Marker([e,i]);return n.on(this._removeMarkerEventName,(()=>{this._removePointOfInterest(e,i)})),n}));this._markerLayer=t.layerGroup(e),this._markerLayer.addTo(this._map)},_removePointOfInterest:function(t,e){let i;for(layerKey in this._map._layers){const n=this._map._layers[layerKey];if(!n.options?.edit_with_drag)continue;const r=n.editingDrag._points_of_interest.findIndex((i=>i.lat===t&&i.lng===e));r>-1&&(i=n.editingDrag._points_of_interest.splice(r,1)[0],n.editingDrag.__proto__._plotPointsOfInterestMarkers.bind(n.editingDrag)())}i&&(this._poly.fire("removedPoint",i),this._poly.fire("pointsOfInterestChanged",{points:[...this._points_of_interest]}))},_getMapScaleInMeters:function(){const e=t.control.scale();return e._getRoundNum(this._map.containerPointToLatLng([0,this._map.getSize().y/2]).distanceTo(this._map.containerPointToLatLng([e.options.maxWidth,this._map.getSize().y/2])))},_getMapMetersPerPixel:function(){const e=t.control.scale(),i=(e._getRoundNum(this._map.containerPointToLatLng([0,this._map.getSize().y/2]).distanceTo(this._map.containerPointToLatLng([e.options.maxWidth,this._map.getSize().y/2]))),this._map.getSize().y),n=this._map.getSize().x,r=this._map.containerPointToLatLng([0,i]).distanceTo(this._map.containerPointToLatLng([n,i]))/n;return this._getRoundNum(r)},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1),i=t/e;return e*(i>=10?10:i>=5?5:i>=3?3:i>=2?2:1)},_snapToClosestPoint:function(){const{x:i,y:n}=this.closest.pixelPosition,r=Object.values(this._map._layers)[0]._glMap.queryRenderedFeatures([[i-200,n-200],[i+200,n+200]],{layers:e}),o=[],s=new Set(this.options?.snapToClosestPoint?.ignoreTypeOfPath||[]);return r.forEach((t=>{s.has(t?.properties?.class||"")||s.has(t?.properties?.service||"")||o.push(...this._getRoadPolylines(t.geometry))})),this.options?.snapToClosestPoint.debug&&(this._roadLayer&&this._map.removeLayer(this._roadLayer),this._roadLayer=t.layerGroup(o.map((e=>new t.polyline(e,{color:"blue",weight:3,opacity:.5,smoothFactor:1})))),this._roadLayer.addTo(this._map)),t.GeometryUtil.closestLayerSnap(this._map,o,this.closest,this.options?.snapToClosestPoint?.threshold)}}),t.Polyline.addInitHook((function(){this.edit_with_drag||(t.EditDrag.Polyline&&(this.editingDrag=new t.EditDrag.Polyline(this),this.options.edit_with_drag&&this.editingDrag.enable()),this.on("add",(function(){this.editingDrag&&this.editingDrag.enabled()&&this.editingDrag.addHooks()})),this.on("remove",(function(){this.editingDrag&&this.editingDrag.enabled()&&this.editingDrag.removeHooks()})))}))}.apply(e,n))||(t.exports=r)},259:function(t,e,i){var n,r,o;r=[i(243),i(613)],void 0===(o="function"==typeof(n=function(t,e){t.MaplibreGLayer=t.Layer.extend({options:{updateInterval:32,padding:.1,interactive:!1},initialize:function(i){t.setOptions(this,i),i.accessToken&&(e.accessToken=i.accessToken),this._throttledUpdate=t.Util.throttle(this._update,this.options.updateInterval,this)},onAdd:function(e){this._container||this._initContainer(),e.getPanes().tilePane.appendChild(this._container),this._initGL(),this._offset=this._map.containerPointToLayerPoint([0,0]),e.options.zoomAnimation&&t.DomEvent.on(e._proxy,t.DomUtil.TRANSITION_END,this._transitionEnd,this)},onRemove:function(e){this._map._proxy&&this._map.options.zoomAnimation&&t.DomEvent.off(this._map._proxy,t.DomUtil.TRANSITION_END,this._transitionEnd,this),e.getPanes().tilePane.removeChild(this._container),this._glMap.remove(),this._glMap=null},getEvents:function(){return{move:this._throttledUpdate,zoomanim:this._animateZoom,zoom:this._pinchZoom,zoomstart:this._zoomStart,zoomend:this._zoomEnd,resize:this._resize}},getMaplibreMap:function(){return this._glMap},getCanvas:function(){return this._glMap.getCanvas()},getSize:function(){return this._map.getSize().multiplyBy(1+2*this.options.padding)},getBounds:function(){const e=this.getSize().multiplyBy(.5),i=this._map.latLngToContainerPoint(this._map.getCenter());return t.latLngBounds(this._map.containerPointToLatLng(i.subtract(e)),this._map.containerPointToLatLng(i.add(e)))},getContainer:function(){return this._container},_initContainer:function(){var e=this._container=t.DomUtil.create("div","leaflet-gl-layer"),i=this.getSize(),n=this._map.getSize().multiplyBy(this.options.padding);e.style.width=i.x+"px",e.style.height=i.y+"px";var r=this._map.containerPointToLayerPoint([0,0]).subtract(n);t.DomUtil.setPosition(e,r)},_initGL:function(){const i=this._map.getCenter(),n=t.extend({},this.options,{container:this._container,center:[i.lng,i.lat],zoom:this._map.getZoom()-1,attributionControl:!1});this._glMap=new e.Map(n),this._glMap.transform.latRange=null,this._glMap._canvas.canvas?this._glMap._actualCanvas=this._glMap._canvas.canvas:this._glMap._actualCanvas=this._glMap._canvas;var r=this._glMap._actualCanvas;t.DomUtil.addClass(r,"leaflet-image-layer"),t.DomUtil.addClass(r,"leaflet-zoom-animated"),this.options.interactive&&t.DomUtil.addClass(r,"leaflet-interactive"),this.options.className&&t.DomUtil.addClass(r,this.options.className)},_update:function(i){if(this._offset=this._map.containerPointToLayerPoint([0,0]),!this._zooming){var n=this.getSize(),r=this._container,o=this._glMap,s=this._map.getSize().multiplyBy(this.options.padding),a=this._map.containerPointToLayerPoint([0,0]).subtract(s);t.DomUtil.setPosition(r,a);var l=this._map.getCenter(),c=o.transform;c.center=e.LngLat.convert([l.lng,l.lat]),c.zoom=this._map.getZoom()-1,o.transform.width!==n.x||o.transform.height!==n.y?(r.style.width=n.x+"px",r.style.height=n.y+"px",null!==o._resize&&void 0!==o._resize?o._resize():o.resize()):null!==o._update&&void 0!==o._update?o._update():o.update()}},_pinchZoom:function(t){this._glMap.jumpTo({zoom:this._map.getZoom()-1,center:this._map.getCenter()})},_animateZoom:function(e){var i=this._map.getZoomScale(e.zoom),n=this._map.getSize().multiplyBy(this.options.padding*i),r=this.getSize()._divideBy(2),o=this._map.project(e.center,e.zoom)._subtract(r)._add(this._map._getMapPanePos().add(n))._round(),s=this._map.project(this._map.getBounds().getNorthWest(),e.zoom)._subtract(o);t.DomUtil.setTransform(this._glMap._actualCanvas,s.subtract(this._offset),i)},_zoomStart:function(t){this._zooming=!0},_zoomEnd:function(){var e=this._map.getZoomScale(this._map.getZoom()),i=this._map._latLngToNewLayerPoint(this._map.getBounds().getNorthWest(),this._map.getZoom(),this._map.getCenter());t.DomUtil.setTransform(this._glMap._actualCanvas,i.subtract(this._offset),e),this._zooming=!1,this._update()},_transitionEnd:function(e){t.Util.requestAnimFrame((function(){var e=this._map.getZoom(),i=this._map.getCenter(),n=this._map.latLngToContainerPoint(this._map.getBounds().getNorthWest());t.DomUtil.setTransform(this._glMap._actualCanvas,n,1),this._glMap.once("moveend",t.Util.bind((function(){this._zoomEnd()}),this)),this._glMap.jumpTo({center:i,zoom:e-1})}),this)},_resize:function(t){this._transitionEnd(t)}}),t.maplibreGL=function(e,i,n){return n={...n,attribution:i,style:"https://api.maplink.global/maps/v1/style",transformRequest:function(t){return{url:`${t}?apikey=${e}`}}},new t.MaplibreGLayer(n)},t.mapboxGL=t.maplibreGL})?n.apply(e,r):n)||(t.exports=o)},480:(t,e,i)=>{"use strict";i.d(e,{Z:()=>s});const n=i(243);i(259),i(389);const r='&copy; <a href="https://maplink.global/">Maplink</a> | &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',o=[-23.545344,-46.657384];class s{constructor(t,e="map",i={}){const r=i.center||o,s=i.zoom||17;i.maxZoom=i.maxZoom||20;const a=this._extractLatLonFromCoordinate(r);this.L=n,this.map=n.map(e,{maxZoom:i.maxZoom}).setView(a,s),this.features=[],this._initMapLayers(t,i)}_initMapLayers(t,e){"png"!==e.renderType?n.maplibreGL(t,r,{maxZoom:e.maxZoom}).addTo(this.map):n.tileLayer("https://api.maplink.global/maps/v1/tiles/{z}/{x}/{y}.png?apikey={apiKey}",{apiKey:t,attribution:r,maxZoom:e.maxZoom}).addTo(this.map)}marker(t,e={}){const i=e.popup,r=this._extractLatLonFromCoordinate(t),o=n.marker(r,e).addTo(this.map);return i&&o.bindPopup(i),this.features.push(o),o}icon(t,e,i={}){return n.icon({iconUrl:t,shadowUrl:e,...i})}line(t,e={}){const i=(e={...e,color:e.color??this._getRandomColor()}).fitBounds??!1,r=t.map((t=>this._extractLatLonFromCoordinate(t))),o={...e,edit_with_drag:!1};delete o.fitBounds;const s=n.polyline(r,o).addTo(this.map);return i&&this.map.fitBounds(s.getBounds()),this.features.push(s),s}decodePolyline(t){const e=1e5;let i=0,n=0;function r(t){return 1&t?~(t>>>1):t>>>1}const o=[];return function(t,e){let i=0,n=0,o=0,s=0,a=0,l=0;for(let c=0;c<t.length;c++)s=t.charCodeAt(c)-63,a|=(31&s)<<l,l+=5,s<32&&(1&++i?n=r(a):(o=r(a),e(n,o)),a=0,l=0)}(t,(function(t,r){i+=t,n+=r,o.push([i/e,n/e])})),o}draggableLine(t,e={}){const i=(e={...e,color:e.color??this._getRandomColor()}).fitBounds??!1,r=t.map((t=>this._extractLatLonFromCoordinate(t))),o={...e,edit_with_drag:!0};delete o.fitBounds;const s=n.polyline(r,o).addTo(this.map);return i&&this.map.fitBounds(s.getBounds()),this.features.push(s),s}getPointsOfInterest(...t){if(!t)throw"Parameter being passed to getPointsOfInterest is null or undefined!";const e=[];let i="";for(let n of t){const t=n?.editingDrag?._points_of_interest??[];for(let n of t){const t=`${n.lat}${n.lng}`;i!==t&&(e.push(n),i=t)}}return e}getMarkersFromDraggablePolylines(...t){if(!t)throw"Parameter being passed to getMarkersFromDraggablePolylines is null or undefined!";const e={};return t.map((t=>Object.keys(t?.editingDrag?._markerLayer._layers??[]).map((e=>t?.editingDrag?._markerLayer._layers[e])))).reduce(((t,e)=>t.concat(e)),[]).filter((t=>{const{lat:i,lng:n}=t._latlng,r=`${i}${n}`;return!e[r]&&(e[r]=!0,!0)}))}lines(t=[],e={}){e={...e,color:e.color??this._getRandomColor(),fitBounds:e.fitBounds??!1};const i=t.map((t=>this.line(t,e)));return i.length>0&&this.map.fitBounds(i[0].getBounds()),i}fitBounds(){const t=new n.featureGroup(this.features);this.map.fitBounds(t.getBounds())}_extractLatLonFromCoordinate(t){return Array.isArray(t)&&2===t.length?t:[t.latitude,t.longitude]}_getRandomColor(){const t="0123456789ABCDEF".split("");let e="#";for(let i=0;i<6;i++)e+=t[Math.round(15*Math.random())];return e}}},613:function(t){t.exports=function(){"use strict";var t,e,i;function n(n,r){if(t)if(e){var o="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",s={};t(s),i=r(s),"undefined"!=typeof window&&(i.workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"})))}else e=r;else t=r}return n(0,(function(t){function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var i=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),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),r=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=r,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=e(i),o=s;function s(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}s.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var i=t,n=0;n<8;n++){var r=this.sampleCurveX(i)-t;if(Math.abs(r)<e)return i;var o=this.sampleCurveDerivativeX(i);if(Math.abs(o)<1e-6)break;i-=r/o}var s=0,a=1;for(i=t,n=0;n<20&&(r=this.sampleCurveX(i),!(Math.abs(r-t)<e));n++)t>r?s=i:a=i,i=.5*(a-s)+s;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var a=e(o);function l(t,e,i,n){const r=new a(t,e,i,n);return function(t){return r.solve(t)}}const c=l(.25,.1,.25,1);function h(t,e,i){return Math.min(i,Math.max(e,t))}function u(t,e,i){const n=i-e,r=((t-e)%n+n)%n+e;return r===e?i:r}function p(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}let d=1;function m(t,e,i){const n={};for(const r in t)n[r]=e.call(i||this,t[r],r,t);return n}function f(t,e,i){const n={};for(const r in t)e.call(i||this,t[r],r,t)&&(n[r]=t[r]);return n}function g(t){return Array.isArray(t)?t.map(g):"object"==typeof t&&t?m(t,g):t}const _={};function y(t){_[t]||("undefined"!=typeof console&&console.warn(t),_[t]=!0)}function v(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}function x(t){let e=0;for(let i,n,r=0,o=t.length,s=o-1;r<o;s=r++)i=t[r],n=t[s],e+=(n.x-i.x)*(i.y+n.y);return e}function b(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}let w=null;function T(t){if(null==w){const e=t.navigator?t.navigator.userAgent:null;w=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return w}function E(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}const S="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let P,z;const C={now:"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(t){const e=requestAnimationFrame(t);return{cancel:()=>cancelAnimationFrame(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=>(P||(P=document.createElement("a")),P.href=t,P.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(null==z&&(z=matchMedia("(prefers-reduced-motion: reduce)")),z.matches)}},M={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class I extends Error{constructor(t,e,i,n){super(`AJAXError: ${e} (${t}): ${i}`),this.status=t,this.statusText=e,this.url=i,this.body=n}}const A=b()?()=>self.worker&&self.worker.referrer:()=>("blob:"===window.location.protocol?window.parent:window).location.href,k=t=>M.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))];function L(t,e){const i=new AbortController,n=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:A(),signal:i.signal});let r=!1,o=!1;return"json"===t.type&&n.headers.set("Accept","application/json"),o||fetch(n).then((i=>i.ok?(i=>{("arrayBuffer"===t.type||"image"===t.type?i.arrayBuffer():"json"===t.type?i.json():i.text()).then((t=>{o||(r=!0,e(null,t,i.headers.get("Cache-Control"),i.headers.get("Expires")))})).catch((t=>{o||e(new Error(t.message))}))})(i):i.blob().then((n=>e(new I(i.status,i.statusText,t.url,n)))))).catch((t=>{20!==t.code&&e(new Error(t.message))})),{cancel:()=>{o=!0,r||i.abort()}}}const D=function(t,e){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){if(b()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e);if(!b())return(k(t.url)||L)(t,e)}if(!(/^file:/.test(i=t.url)||/^file:/.test(A())&&!/^\w+:/.test(i))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return L(t,e);if(b()&&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 n=i.response;if("json"===t.type)try{n=JSON.parse(i.response)}catch(t){return e(t)}e(null,n,i.getResponseHeader("Cache-Control"),i.getResponseHeader("Expires"))}else{const n=new Blob([i.response],{type:i.getResponseHeader("Content-Type")});e(new I(i.status,i.statusText,t.url,n))}},i.send(t.body),{cancel:()=>i.abort()}}(t,e)},B=function(t,e){return D(p(t,{type:"arrayBuffer"}),e)};function R(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 F(t,e,i){i[t]&&-1!==i[t].indexOf(e)||(i[t]=i[t]||[],i[t].push(e))}function O(t,e,i){if(i&&i[t]){const n=i[t].indexOf(e);-1!==n&&i[t].splice(n,1)}}class U{constructor(t,e={}){p(this,e),this.type=t}}class V extends U{constructor(t,e={}){super("error",p({error:t},e))}}class N{on(t,e){return this._listeners=this._listeners||{},F(t,e,this._listeners),this}off(t,e){return O(t,e,this._listeners),O(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},F(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){"string"==typeof t&&(t=new U(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)O(i,e,this._oneTimeListeners),e.call(this,t);const r=this._eventedParent;r&&(p(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),r.fire(t))}else t instanceof V&&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 Z={$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:{}},default:"mapbox"},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 $(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!$(t[i],e[i]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==e){if("object"!=typeof e)return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const i in t)if(!$(t[i],e[i]))return!1;return!0}return t===e}const G={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function H(t,e,i){i.push({command:G.addSource,args:[t,e[t]]})}function W(t,e,i){e.push({command:G.removeSource,args:[t]}),i[t]=!0}function X(t,e,i,n){W(t,i,n),H(t,e,i)}function K(t,e,i){let n;for(n in t[i])if(Object.prototype.hasOwnProperty.call(t[i],n)&&"data"!==n&&!$(t[i][n],e[i][n]))return!1;for(n in e[i])if(Object.prototype.hasOwnProperty.call(e[i],n)&&"data"!==n&&!$(t[i][n],e[i][n]))return!1;return!0}function Y(t,e,i,n,r,o){let s;for(s in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,s)&&($(t[s],e[s])||i.push({command:o,args:[n,s,e[s],r]}));for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&!Object.prototype.hasOwnProperty.call(t,s)&&($(t[s],e[s])||i.push({command:o,args:[n,s,e[s],r]}))}function J(t){return t.id}function Q(t,e){return t[e.id]=e,t}class tt{constructor(t,e,i,n){this.message=(t?`${t}: `:"")+i,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)}}function et(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}class it extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class nt{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,i]of e)this.bindings[t]=i}concat(t){return new nt(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const rt={kind:"null"},ot={kind:"number"},st={kind:"string"},at={kind:"boolean"},lt={kind:"color"},ct={kind:"object"},ht={kind:"value"},ut={kind:"collator"},pt={kind:"formatted"},dt={kind:"padding"},mt={kind:"resolvedImage"},ft={kind:"variableAnchorOffsetCollection"};function gt(t,e){return{kind:"array",itemType:t,N:e}}function _t(t){if("array"===t.kind){const e=_t(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const yt=[rt,ot,st,at,lt,pt,ct,gt(ht),dt,mt,ft];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 yt)if(!vt(t,e))return null}return`Expected ${_t(t)} but found ${_t(e)} instead.`}function xt(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 wt(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const Tt=.96422,Et=.82521,St=4/29,Pt=6/29,zt=3*Pt*Pt,Ct=Math.PI/180,Mt=180/Math.PI;function It(t){return(t%=360)<0&&(t+=360),t}function At([t,e,i,n]){let r,o;const s=Lt((.2225045*(t=kt(t))+.7168786*(e=kt(e))+.0606169*(i=kt(i)))/1);t===e&&e===i?r=o=s:(r=Lt((.4360747*t+.3850649*e+.1430804*i)/Tt),o=Lt((.0139322*t+.0971045*e+.7141733*i)/Et));const a=116*s-16;return[a<0?0:a,500*(r-s),200*(s-o),n]}function kt(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Lt(t){return t>.008856451679035631?Math.pow(t,1/3):t/zt+St}function Dt([t,e,i,n]){let r=(t+16)/116,o=isNaN(e)?r:r+e/500,s=isNaN(i)?r:r-i/200;return r=1*Rt(r),o=Tt*Rt(o),s=Et*Rt(s),[Bt(3.1338561*o-1.6168667*r-.4906146*s),Bt(-.9787684*o+1.9161415*r+.033454*s),Bt(.0719453*o-.2289914*r+1.4052427*s),n]}function Bt(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function Rt(t){return t>Pt?t*t*t:zt*(t-St)}function Ft(t){return parseInt(t.padEnd(2,t),16)/255}function Ot(t,e){return Ut(e?t/100:t,0,1)}function Ut(t,e,i){return Math.min(Math.max(e,t),i)}function Vt(t){return!t.some(Number.isNaN)}const Nt={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 Zt{constructor(t,e,i,n=1,r=!0){this.r=t,this.g=e,this.b=i,this.a=n,r||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[t,e,i,n]))}static parse(t){if(t instanceof Zt)return t;if("string"!=typeof t)return;const e=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];const e=Nt[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[Ft(t.slice(i,i+=e)),Ft(t.slice(i,i+=e)),Ft(t.slice(i,i+=e)),Ft(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,r,o,s,a,l,c,h,u,p]=e,d=[r||" ",a||" ",h].join("");if("  "===d||"  /"===d||",,"===d||",,,"===d){const t=[n,s,c].join(""),e="%%%"===t?100:""===t?255:0;if(e){const t=[Ut(+i/e,0,1),Ut(+o/e,0,1),Ut(+l/e,0,1),u?Ot(+u,p):1];if(Vt(t))return t}}return}}const i=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){const[t,e,n,r,o,s,a,l,c]=i,h=[n||" ",o||" ",a].join("");if("  "===h||"  /"===h||",,"===h||",,,"===h){const t=[+e,Ut(+r,0,100),Ut(+s,0,100),l?Ot(+l,c):1];if(Vt(t))return function([t,e,i,n]){function r(n){const r=(n+t/30)%12,o=e*Math.min(i,1-i);return i-o*Math.max(-1,Math.min(r-3,9-r,1))}return t=It(t),e/=100,i/=100,[r(0),r(8),r(4),n]}(t)}}}(t);return e?new Zt(...e,!1):void 0}get rgb(){const{r:t,g:e,b:i,a:n}=this,r=n||1/0;return this.overwriteGetter("rgb",[t/r,e/r,i/r,n])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,i,n,r]=At(t),o=Math.sqrt(i*i+n*n);return[Math.round(1e4*o)?It(Math.atan2(n,i)*Mt):NaN,o,e,r]}(this.rgb))}get lab(){return this.overwriteGetter("lab",At(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})`}}Zt.black=new Zt(0,0,0,1),Zt.white=new Zt(1,1,1,1),Zt.transparent=new Zt(0,0,0,0),Zt.red=new Zt(1,0,0,1);class jt{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,n,r){this.text=t,this.image=e,this.scale=i,this.fontStack=n,this.textColor=r}}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 Gt{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Gt)return t;if("number"==typeof t)return new Gt([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 Gt(t)}}toString(){return JSON.stringify(this.values)}}const Ht=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Wt{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Wt)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){const i=t[e],n=t[e+1];if("string"!=typeof i||!Ht.has(i))return;if(!Array.isArray(n)||2!==n.length||"number"!=typeof n[0]||"number"!=typeof n[1])return}return new Wt(t)}}toString(){return JSON.stringify(this.values)}}class Xt{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Xt({name:t,available:!1}):null}}function Kt(t,e,i,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[t,e,i,n]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Yt(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof Zt||t instanceof jt||t instanceof $t||t instanceof Gt||t instanceof Wt||t instanceof Xt)return!0;if(Array.isArray(t)){for(const e of t)if(!Yt(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!Yt(t[e]))return!1;return!0}return!1}function Jt(t){if(null===t)return rt;if("string"==typeof t)return st;if("boolean"==typeof t)return at;if("number"==typeof t)return ot;if(t instanceof Zt)return lt;if(t instanceof jt)return ut;if(t instanceof $t)return pt;if(t instanceof Gt)return dt;if(t instanceof Wt)return ft;if(t instanceof Xt)return mt;if(Array.isArray(t)){const e=t.length;let i;for(const e of t){const t=Jt(e);if(i){if(i===t)continue;i=ht;break}i=t}return gt(i||ht,e)}return ct}function Qt(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof Zt||t instanceof $t||t instanceof Gt||t instanceof Wt||t instanceof Xt?t.toString():JSON.stringify(t)}class te{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(!Yt(t[1]))return e.error("invalid value");const i=t[1];let n=Jt(i);const r=e.expectedType;return"array"!==n.kind||0!==n.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(n=r),new te(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class ee{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const ie={string:st,number:ot,boolean:at,object:ct};class ne{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i,n=1;const r=t[0];if("array"===r){let r,o;if(t.length>2){const i=t[1];if("string"!=typeof i||!(i in ie)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=ie[i],n++}else r=ht;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);o=t[2],n++}i=gt(r,o)}else{if(!ie[r])throw new Error(`Types doesn't contain name = ${r}`);i=ie[r]}const o=[];for(;n<t.length;n++){const i=e.parse(t[n],n,ht);if(!i)return null;o.push(i)}return new ne(i,o)}evaluate(t){for(let e=0;e<this.args.length;e++){const i=this.args[e].evaluate(t);if(!vt(this.type,Jt(i)))return i;if(e===this.args.length-1)throw new ee(`Expected value to be of type ${_t(this.type)}, but found ${_t(Jt(i))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const re={"to-boolean":at,"to-color":lt,"to-number":ot,"to-string":st};class oe{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(!re[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=re[i],r=[];for(let i=1;i<t.length;i++){const n=e.parse(t[i],i,ht);if(!n)return null;r.push(n)}return new oe(n,r)}evaluate(t){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(t));case"color":{let e,i;for(const n of this.args){if(e=n.evaluate(t),i=null,e instanceof Zt)return e;if("string"==typeof e){const i=t.parseColor(e);if(i)return i}else if(Array.isArray(e)&&(i=e.length<3||e.length>4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:Kt(e[0],e[1],e[2],e[3]),!i))return new Zt(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new ee(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=Gt.parse(e);if(n)return n}throw new ee(`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=Wt.parse(e);if(n)return n}throw new ee(`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 ee(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return $t.fromString(Qt(this.args[0].evaluate(t)));case"resolvedImage":return Xt.fromString(Qt(this.args[0].evaluate(t)));default:return Qt(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const se=["Unknown","Point","LineString","Polygon"];class ae{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?se[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]=Zt.parse(t)),e}}class le{constructor(t,e,i=[],n,r=new nt,o=[]){this.registry=t,this.path=i,this.key=i.map((t=>`[${t}]`)).join(""),this.scope=r,this.errors=o,this.expectedType=n,this._isConstant=e}parse(t,e,i,n,r={}){return e?this.concat(e,i,n)._parse(t,r):this._parse(t,r)}_parse(t,e){function i(t,e,i){return"assert"===i?new ne(e,[t]):"coerce"===i?new oe(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=t[0];if("string"!=typeof n)return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const r=this.registry[n];if(r){let n=r.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,r=n.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==r.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==r.kind&&"string"!==r.kind)if("padding"!==t.kind||"value"!==r.kind&&"number"!==r.kind&&"array"!==r.kind)if("variableAnchorOffsetCollection"!==t.kind||"value"!==r.kind&&"array"!==r.kind){if(this.checkSubtype(t,r))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 te)&&"resolvedImage"!==n.type.kind&&this._isConstant(n)){const e=new ae;try{n=new te(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,r=i?this.scope.concat(i):this.scope;return new le(this.registry,this._isConstant,n,e||null,r,this.errors)}error(t,...e){const i=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new it(i,t))}checkSubtype(t,e){const i=vt(t,e);return i&&this.error(i),i}}class ce{constructor(t,e,i){this.type=ut,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,at);if(!n)return null;const r=e.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,at);if(!r)return null;let o=null;return i.locale&&(o=e.parse(i.locale,1,st),!o)?null:new ce(n,r,o)}evaluate(t){return new jt(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 he=8192;function ue(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 pe(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function de(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,r=Math.pow(2,e.z);return[Math.round(i*r*he),Math.round(n*r*he)]}function me(t,e,i){const n=t[0]-e[0],r=t[1]-e[1],o=t[0]-i[0],s=t[1]-i[1];return n*s-o*r==0&&n*o<=0&&r*s<=0}function fe(t,e){let i=!1;for(let s=0,a=e.length;s<a;s++){const a=e[s];for(let e=0,s=a.length;e<s-1;e++){if(me(t,a[e],a[e+1]))return!1;(r=a[e])[1]>(n=t)[1]!=(o=a[e+1])[1]>n[1]&&n[0]<(o[0]-r[0])*(n[1]-r[1])/(o[1]-r[1])+r[0]&&(i=!i)}}var n,r,o;return i}function ge(t,e){for(let i=0;i<e.length;i++)if(fe(t,e[i]))return!0;return!1}function _e(t,e,i,n){const r=n[0]-i[0],o=n[1]-i[1],s=(t[0]-i[0])*o-r*(t[1]-i[1]),a=(e[0]-i[0])*o-r*(e[1]-i[1]);return s>0&&a<0||s<0&&a>0}function ye(t,e,i){for(const c of i)for(let i=0;i<c.length-1;++i)if(0!=(a=[(s=c[i+1])[0]-(o=c[i])[0],s[1]-o[1]])[0]*(l=[(r=e)[0]-(n=t)[0],r[1]-n[1]])[1]-a[1]*l[0]&&_e(n,r,o,s)&&_e(o,s,n,r))return!0;var n,r,o,s,a,l;return!1}function ve(t,e){for(let i=0;i<t.length;++i)if(!fe(t[i],e))return!1;for(let i=0;i<t.length-1;++i)if(ye(t[i],t[i+1],e))return!1;return!0}function xe(t,e){for(let i=0;i<e.length;i++)if(ve(t,e[i]))return!0;return!1}function be(t,e,i){const n=[];for(let r=0;r<t.length;r++){const o=[];for(let n=0;n<t[r].length;n++){const s=de(t[r][n],i);ue(e,s),o.push(s)}n.push(o)}return n}function we(t,e,i){const n=[];for(let r=0;r<t.length;r++){const o=be(t[r],e,i);n.push(o)}return n}function Te(t,e,i,n){if(t[0]<i[0]||t[0]>i[2]){const e=.5*n;let r=t[0]-i[0]>e?-n:i[0]-t[0]>e?n:0;0===r&&(r=t[0]-i[2]>e?-n:i[2]-t[0]>e?n:0),t[0]+=r}ue(e,t)}function Ee(t,e,i,n){const r=Math.pow(2,n.z)*he,o=[n.x*he,n.y*he],s=[];for(const n of t)for(const t of n){const n=[t.x+o[0],t.y+o[1]];Te(n,e,i,r),s.push(n)}return s}function Se(t,e,i,n){const r=Math.pow(2,n.z)*he,o=[n.x*he,n.y*he],s=[];for(const i of t){const t=[];for(const n of i){const i=[n.x+o[0],n.y+o[1]];ue(e,i),t.push(i)}s.push(t)}if(e[2]-e[0]<=r/2){(a=e)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const t of s)for(const n of t)Te(n,e,i,r)}var a;return s}class Pe{constructor(t,e){this.type=at,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(Yt(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t<e.features.length;++t){const i=e.features[t].geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new Pe(e,e.features[t].geometry)}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new Pe(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new Pe(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if("Polygon"===e.type){const o=be(e.coordinates,n,r),s=Ee(t.geometry(),i,n,r);if(!pe(i,n))return!1;for(const t of s)if(!fe(t,o))return!1}if("MultiPolygon"===e.type){const o=we(e.coordinates,n,r),s=Ee(t.geometry(),i,n,r);if(!pe(i,n))return!1;for(const t of s)if(!ge(t,o))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if("Polygon"===e.type){const o=be(e.coordinates,n,r),s=Se(t.geometry(),i,n,r);if(!pe(i,n))return!1;for(const t of s)if(!ve(t,o))return!1}if("MultiPolygon"===e.type){const o=we(e.coordinates,n,r),s=Se(t.geometry(),i,n,r);if(!pe(i,n))return!1;for(const t of s)if(!xe(t,o))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class ze{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const i=t[1];return e.scope.has(i)?new ze(i,e.scope.get(i)):e.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class Ce{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=Ce.definitions[i];if(!n)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(n)?n[0]:n.type,o=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,s=o.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let a=null;for(const[n,o]of s){a=new le(e.registry,Me,e.path,null,e.scope);const s=[];let l=!1;for(let e=1;e<t.length;e++){const i=t[e],r=Array.isArray(n)?n[e-1]:n.type,o=a.parse(i,1+s.length,r);if(!o){l=!0;break}s.push(o)}if(!l)if(Array.isArray(n)&&n.length!==s.length)a.error(`Expected ${n.length} arguments, but found ${s.length} instead.`);else{for(let t=0;t<s.length;t++){const e=Array.isArray(n)?n[t]:n.type,i=s[t];a.concat(t+1).checkSubtype(e,i.type)}if(0===a.errors.length)return new Ce(i,r,o,s)}}if(1===s.length)e.errors.push(...a.errors);else{const i=(s.length?s:o).map((([t])=>{return e=t,Array.isArray(e)?`(${e.map(_t).join(", ")})`:`(${_t(e.type)}...)`;var e})).join(" | "),n=[];for(let i=1;i<t.length;i++){const r=e.parse(t[i],1+n.length);if(!r)return null;n.push(_t(r.type))}e.error(`Expected arguments of type ${i}, but found (${n.join(", ")}) instead.`)}return null}static register(t,e){Ce.definitions=e;for(const i in e)t[i]=Ce}}function Me(t){if(t instanceof ze)return Me(t.boundExpression);if(t instanceof Ce&&"error"===t.name)return!1;if(t instanceof ce)return!1;if(t instanceof Pe)return!1;const e=t instanceof oe||t instanceof ne;let i=!0;return t.eachChild((t=>{i=e?i&&Me(t):i&&t instanceof te})),!!i&&Ie(t)&&ke(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Ie(t){if(t instanceof Ce){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 Pe)return!1;let e=!0;return t.eachChild((t=>{e&&!Ie(t)&&(e=!1)})),e}function Ae(t){if(t instanceof Ce&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!Ae(t)&&(e=!1)})),e}function ke(t,e){if(t instanceof Ce&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild((t=>{i&&!ke(t,e)&&(i=!1)})),i}function Le(t,e){const i=t.length-1;let n,r,o=0,s=i,a=0;for(;o<=s;)if(a=Math.floor((o+s)/2),n=t[a],r=t[a+1],n<=e){if(a===i||e<r)return a;o=a+1}else{if(!(n>e))throw new ee("Input is not a number.");s=a-1}return 0}class De{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,ot);if(!i)return null;const n=[];let r=null;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(let i=1;i<t.length;i+=2){const o=1===i?-1/0:t[i],s=t[i+1],a=i,l=i+1;if("number"!=typeof o)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(n.length&&n[n.length-1][0]>=o)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const c=e.parse(s,l,r);if(!c)return null;r=r||c.type,n.push([o,c])}return new De(r,i,n)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;return n>=e[r-1]?i[r-1].evaluate(t):i[Le(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 Be(t,e,i){return t+i*(e-t)}function Re(t,e,i){return t.map(((t,n)=>Be(t,e[n],i)))}const Fe={number:Be,color:function(t,e,i,n="rgb"){switch(n){case"rgb":{const[n,r,o,s]=Re(t.rgb,e.rgb,i);return new Zt(n,r,o,s,!1)}case"hcl":{const[n,r,o,s]=t.hcl,[a,l,c,h]=e.hcl;let u,p;if(isNaN(n)||isNaN(a))isNaN(n)?isNaN(a)?u=NaN:(u=a,1!==o&&0!==o||(p=l)):(u=n,1!==c&&0!==c||(p=r));else{let t=a-n;a>n&&t>180?t-=360:a<n&&n-a>180&&(t+=360),u=n+i*t}const[d,m,f,g]=function([t,e,i,n]){return t=isNaN(t)?0:t*Ct,Dt([i,Math.cos(t)*e,Math.sin(t)*e,n])}([u,null!=p?p:Be(r,l,i),Be(o,c,i),Be(s,h,i)]);return new Zt(d,m,f,g,!1)}case"lab":{const[n,r,o,s]=Dt(Re(t.lab,e.lab,i));return new Zt(n,r,o,s,!1)}}},array:Re,padding:function(t,e,i){return new Gt(Re(t.values,e.values,i))},variableAnchorOffsetCollection:function(t,e,i){const n=t.values,r=e.values;if(n.length!==r.length)throw new ee(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);const o=[];for(let t=0;t<n.length;t+=2){if(n[t]!==r[t])throw new ee(`Cannot interpolate values containing mismatched anchors. from[${t}]: ${n[t]}, to[${t}]: ${r[t]}`);o.push(n[t]);const[e,s]=n[t+1],[a,l]=r[t+1];o.push([Be(e,a,i),Be(s,l,i)])}return new Wt(o)}};class Oe{constructor(t,e,i,n,r){this.type=t,this.operator=e,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,i,n){let r=0;if("exponential"===t.name)r=Ue(e,t.base,i,n);else if("linear"===t.name)r=Ue(e,1,i,n);else if("cubic-bezier"===t.name){const o=t.controlPoints;r=new a(o[0],o[1],o[2],o[3]).solve(Ue(e,1,i,n))}return r}static parse(t,e){let[i,n,r,...o]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t}}else{if("cubic-bezier"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(r=e.parse(r,2,ot),!r)return null;const s=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=lt:e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType);for(let t=0;t<o.length;t+=2){const i=o[t],n=o[t+1],r=t+3,l=t+4;if("number"!=typeof i)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',r);if(s.length&&s[s.length-1][0]>=i)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const c=e.parse(n,l,a);if(!c)return null;a=a||c.type,s.push([i,c])}return wt(a,ot)||wt(a,lt)||wt(a,dt)||wt(a,ft)||wt(a,gt(ot))?new Oe(a,i,n,r,s):e.error(`Type ${_t(a)} is not interpolatable.`)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;if(n>=e[r-1])return i[r-1].evaluate(t);const o=Le(e,n),s=Oe.interpolationFactor(this.interpolation,n,e[o],e[o+1]),a=i[o].evaluate(t),l=i[o+1].evaluate(t);switch(this.operator){case"interpolate":return Fe[this.type.kind](a,l,s);case"interpolate-hcl":return Fe.color(a,l,s,"hcl");case"interpolate-lab":return Fe.color(a,l,s,"lab")}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Ue(t,e,i,n){const r=n-i,o=t-i;return 0===r?0:1===e?o/r:(Math.pow(e,o)-1)/(Math.pow(e,r)-1)}class Ve{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 r=[];for(const n of t.slice(1)){const t=e.parse(n,1+r.length,i,void 0,{typeAnnotation:"omit"});if(!t)return null;i=i||t.type,r.push(t)}if(!i)throw new Error("No output type");const o=n&&r.some((t=>vt(n,t.type)));return new Ve(o?ht:i,r)}evaluate(t){let e,i=null,n=0;for(const r of this.args)if(n++,i=r.evaluate(t),i&&i instanceof Xt&&!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()))}}class Ne{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const i=[];for(let n=1;n<t.length-1;n+=2){const r=t[n];if("string"!=typeof r)return e.error(`Expected string, but found ${typeof r} instead.`,n);if(/[^a-zA-Z0-9_]/.test(r))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);const o=e.parse(t[n+1],n+1);if(!o)return null;i.push([r,o])}const n=e.parse(t[t.length-1],t.length-1,e.expectedType,i);return n?new Ne(i,n):null}outputDefined(){return this.result.outputDefined()}}class Ze{constructor(t,e,i){this.type=t,this.index=e,this.input=i}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ot),n=e.parse(t[2],2,gt(e.expectedType||ht));return i&&n?new Ze(n.type.itemType,i,n):null}evaluate(t){const e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new ee(`Array index out of bounds: ${e} < 0.`);if(e>=i.length)throw new ee(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new ee(`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 je{constructor(t,e){this.type=at,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,ht),n=e.parse(t[2],2,ht);return i&&n?xt(i.type,[at,st,ot,rt,ht])?new je(i,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${_t(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 ee(`Expected first argument to be of type boolean, string, number or null, but found ${_t(Jt(e))} instead.`);if(!bt(i,["string","array"]))throw new ee(`Expected second argument to be of type array or string, but found ${_t(Jt(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=ot,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,ht),n=e.parse(t[2],2,ht);if(!i||!n)return null;if(!xt(i.type,[at,st,ot,rt,ht]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${_t(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,ot);return r?new qe(i,n,r):null}return new qe(i,n)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!bt(e,["boolean","string","number","null"]))throw new ee(`Expected first argument to be of type boolean, string, number or null, but found ${_t(Jt(e))} instead.`);if(!bt(i,["string","array"]))throw new ee(`Expected second argument to be of type array or string, but found ${_t(Jt(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 $e{constructor(t,e,i,n,r,o){this.inputType=t,this.type=e,this.input=i,this.cases=n,this.outputs=r,this.otherwise=o}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let i,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const r={},o=[];for(let s=2;s<t.length-1;s+=2){let a=t[s];const l=t[s+1];Array.isArray(a)||(a=[a]);const c=e.concat(s);if(0===a.length)return c.error("Expected at least one branch label.");for(const t of a){if("number"!=typeof t&&"string"!=typeof t)return c.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.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,Jt(t)))return null}else i=Jt(t);if(void 0!==r[String(t)])return c.error("Branch labels must be unique.");r[String(t)]=o.length}const h=e.parse(l,s,n);if(!h)return null;n=n||h.type,o.push(h)}const s=e.parse(t[1],1,ht);if(!s)return null;const a=e.parse(t[t.length-1],t.length-1,n);return a?"value"!==s.type.kind&&e.concat(1).checkSubtype(i,s.type)?null:new $e(i,n,s,r,o,a):null}evaluate(t){const e=this.input.evaluate(t);return(Jt(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 Ge{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const n=[];for(let r=1;r<t.length-1;r+=2){const o=e.parse(t[r],r,at);if(!o)return null;const s=e.parse(t[r+1],r+1,i);if(!s)return null;n.push([o,s]),i=i||s.type}const r=e.parse(t[t.length-1],t.length-1,i);if(!r)return null;if(!i)throw new Error("Can't infer output type");return new Ge(i,n,r)}evaluate(t){for(const[e,i]of this.branches)if(e.evaluate(t))return i.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,i]of this.branches)t(e),t(i);t(this.otherwise)}outputDefined(){return this.branches.every((([t,e])=>e.outputDefined()))&&this.otherwise.outputDefined()}}class He{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,ht),n=e.parse(t[2],2,ot);if(!i||!n)return null;if(!xt(i.type,[gt(ht),st,ht]))return e.error(`Expected first argument to be of type array or string, but found ${_t(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,ot);return r?new He(i.type,i,n,r):null}return new He(i.type,i,n)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);if(!bt(e,["string","array"]))throw new ee(`Expected first argument to be of type array or string, but found ${_t(Jt(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 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 Xe(t,e,i,n){return 0===n.compare(e,i)}function Ke(t,e,i){const n="=="!==t&&"!="!==t;return class r{constructor(t,e,i){this.type=at,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 o=e.parse(t[1],1,ht);if(!o)return null;if(!We(i,o.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${_t(o.type)}'.`);let s=e.parse(t[2],2,ht);if(!s)return null;if(!We(i,s.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${_t(s.type)}'.`);if(o.type.kind!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return e.error(`Cannot compare types '${_t(o.type)}' and '${_t(s.type)}'.`);n&&("value"===o.type.kind&&"value"!==s.type.kind?o=new ne(s.type,[o]):"value"!==o.type.kind&&"value"===s.type.kind&&(s=new ne(o.type,[s])));let a=null;if(4===t.length){if("string"!==o.type.kind&&"string"!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,ut),!a)return null}return new r(o,s,a)}evaluate(r){const o=this.lhs.evaluate(r),s=this.rhs.evaluate(r);if(n&&this.hasUntypedArgument){const e=Jt(o),i=Jt(s);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new ee(`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=Jt(o),i=Jt(s);if("string"!==t.kind||"string"!==i.kind)return e(r,o,s)}return this.collator?i(r,o,s,this.collator.evaluate(r)):e(r,o,s)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const Ye=Ke("==",(function(t,e,i){return e===i}),Xe),Je=Ke("!=",(function(t,e,i){return e!==i}),(function(t,e,i,n){return!Xe(0,e,i,n)})),Qe=Ke("<",(function(t,e,i){return e<i}),(function(t,e,i,n){return n.compare(e,i)<0})),ti=Ke(">",(function(t,e,i){return e>i}),(function(t,e,i,n){return n.compare(e,i)>0})),ei=Ke("<=",(function(t,e,i){return e<=i}),(function(t,e,i,n){return n.compare(e,i)<=0})),ii=Ke(">=",(function(t,e,i){return e>=i}),(function(t,e,i,n){return n.compare(e,i)>=0}));class ni{constructor(t,e,i,n,r){this.type=st,this.number=t,this.locale=e,this.currency=i,this.minFractionDigits=n,this.maxFractionDigits=r}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,ot);if(!i)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let r=null;if(n.locale&&(r=e.parse(n.locale,1,st),!r))return null;let o=null;if(n.currency&&(o=e.parse(n.currency,1,st),!o))return null;let s=null;if(n["min-fraction-digits"]&&(s=e.parse(n["min-fraction-digits"],1,ot),!s))return null;let a=null;return n["max-fraction-digits"]&&(a=e.parse(n["max-fraction-digits"],1,ot),!a)?null:new ni(i,r,o,s,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 ri{constructor(t){this.type=pt,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");const n=[];let r=!1;for(let i=1;i<=t.length-1;++i){const o=t[i];if(r&&"object"==typeof o&&!Array.isArray(o)){r=!1;let t=null;if(o["font-scale"]&&(t=e.parse(o["font-scale"],1,ot),!t))return null;let i=null;if(o["text-font"]&&(i=e.parse(o["text-font"],1,gt(st)),!i))return null;let s=null;if(o["text-color"]&&(s=e.parse(o["text-color"],1,lt),!s))return null;const a=n[n.length-1];a.scale=t,a.font=i,a.textColor=s}else{const o=e.parse(t[i],1,ht);if(!o)return null;const s=o.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,n.push({content:o,scale:null,font:null,textColor:null})}}return new ri(n)}evaluate(t){return new $t(this.sections.map((e=>{const i=e.content.evaluate(t);return Jt(i)===mt?new qt("",i,null,null,null):new qt(Qt(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 oi{constructor(t){this.type=mt,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,st);return i?new oi(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=Xt.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}}class si{constructor(t){this.type=ot,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 ${_t(i.type)} instead.`):new si(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 ee(`Expected value to be of type string or array, but found ${_t(Jt(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const ai={"==":Ye,"!=":Je,">":ti,"<":Qe,">=":ii,"<=":ei,array:ne,at:Ze,boolean:ne,case:Ge,coalesce:Ve,collator:ce,format:ri,image:oi,in:je,"index-of":qe,interpolate:Oe,"interpolate-hcl":Oe,"interpolate-lab":Oe,length:si,let:Ne,literal:te,match:$e,number:ne,"number-format":ni,object:ne,slice:He,step:De,string:ne,"to-boolean":oe,"to-color":oe,"to-number":oe,"to-string":oe,var:ze,within:Pe};function li(t,[e,i,n,r]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);const o=r?r.evaluate(t):1,s=Kt(e,i,n,o);if(s)throw new ee(s);return new Zt(e/255,i/255,n/255,o,!1)}function ci(t,e){return t in e}function hi(t,e){const i=e[t];return void 0===i?null:i}function ui(t){return{type:t}}function pi(t){return{result:"success",value:t}}function di(t){return{result:"error",value:t}}function mi(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function fi(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function gi(t){return!!t.expression&&t.expression.interpolated}function _i(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function yi(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function vi(t){return t}function xi(t,e){const i="color"===e.type,n=t.stops&&"object"==typeof t.stops[0][0],r=n||!(n||void 0!==t.property),o=t.type||(gi(e)?"exponential":"interval");if(i||"padding"===e.type){const n=i?Zt.parse:Gt.parse;(t=et({},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"!==(s=t.colorSpace)&&"hcl"!==s&&"lab"!==s)throw new Error(`Unknown color space: "${t.colorSpace}"`);var s;let a,l,c;if("exponential"===o)a=Ei;else if("interval"===o)a=Ti;else if("categorical"===o){a=wi,l=Object.create(null);for(const e of t.stops)l[e[0]]=e[1];c=typeof t.stops[0][0]}else{if("identity"!==o)throw new Error(`Unknown function type "${o}"`);a=Si}if(n){const i={},n=[];for(let e=0;e<t.stops.length;e++){const r=t.stops[e],o=r[0].zoom;void 0===i[o]&&(i[o]={zoom:o,type:t.type,property:t.property,default:t.default,stops:[]},n.push(o)),i[o].stops.push([r[0].value,r[1]])}const r=[];for(const t of n)r.push([i[t].zoom,xi(i[t],e)]);const o={name:"linear"};return{kind:"composite",interpolationType:o,interpolationFactor:Oe.interpolationFactor.bind(void 0,o),zoomStops:r.map((t=>t[0])),evaluate:({zoom:i},n)=>Ei({stops:r,base:t.base},e,i).evaluate(i,n)}}if(r){const i="exponential"===o?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:Oe.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 r=n&&n.properties?n.properties[t.property]:void 0;return void 0===r?bi(t.default,e.default):a(t,e,r,l,c)}}}function bi(t,e,i){return void 0!==t?t:void 0!==e?e:void 0!==i?i:void 0}function wi(t,e,i,n,r){return bi(typeof i===r?n[i]:void 0,t.default,e.default)}function Ti(t,e,i){if("number"!==_i(i))return bi(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=Le(t.stops.map((t=>t[0])),i);return t.stops[r][1]}function Ei(t,e,i){const n=void 0!==t.base?t.base:1;if("number"!==_i(i))return bi(t.default,e.default);const r=t.stops.length;if(1===r)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[r-1][0])return t.stops[r-1][1];const o=Le(t.stops.map((t=>t[0])),i),s=function(t,e,i,n){const r=n-i,o=t-i;return 0===r?0:1===e?o/r:(Math.pow(e,o)-1)/(Math.pow(e,r)-1)}(i,n,t.stops[o][0],t.stops[o+1][0]),a=t.stops[o][1],l=t.stops[o+1][1],c=Fe[e.type]||vi;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,s,t.colorSpace)}}:c(a,l,s,t.colorSpace)}function Si(t,e,i){switch(e.type){case"color":i=Zt.parse(i);break;case"formatted":i=$t.fromString(i.toString());break;case"resolvedImage":i=Xt.fromString(i.toString());break;case"padding":i=Gt.parse(i);break;default:_i(i)===e.type||"enum"===e.type&&e.values[i]||(i=void 0)}return bi(i,t.default,e.default)}Ce.register(ai,{error:[{kind:"error"},[st],(t,[e])=>{throw new ee(e.evaluate(t))}],typeof:[st,[ht],(t,[e])=>_t(Jt(e.evaluate(t)))],"to-rgba":[gt(ot,4),[lt],(t,[e])=>{const[i,n,r,o]=e.evaluate(t).rgb;return[255*i,255*n,255*r,o]}],rgb:[lt,[ot,ot,ot],li],rgba:[lt,[ot,ot,ot,ot],li],has:{type:at,overloads:[[[st],(t,[e])=>ci(e.evaluate(t),t.properties())],[[st,ct],(t,[e,i])=>ci(e.evaluate(t),i.evaluate(t))]]},get:{type:ht,overloads:[[[st],(t,[e])=>hi(e.evaluate(t),t.properties())],[[st,ct],(t,[e,i])=>hi(e.evaluate(t),i.evaluate(t))]]},"feature-state":[ht,[st],(t,[e])=>hi(e.evaluate(t),t.featureState||{})],properties:[ct,[],t=>t.properties()],"geometry-type":[st,[],t=>t.geometryType()],id:[ht,[],t=>t.id()],zoom:[ot,[],t=>t.globals.zoom],"heatmap-density":[ot,[],t=>t.globals.heatmapDensity||0],"line-progress":[ot,[],t=>t.globals.lineProgress||0],accumulated:[ht,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[ot,ui(ot),(t,e)=>{let i=0;for(const n of e)i+=n.evaluate(t);return i}],"*":[ot,ui(ot),(t,e)=>{let i=1;for(const n of e)i*=n.evaluate(t);return i}],"-":{type:ot,overloads:[[[ot,ot],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[ot],(t,[e])=>-e.evaluate(t)]]},"/":[ot,[ot,ot],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[ot,[ot,ot],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[ot,[],()=>Math.LN2],pi:[ot,[],()=>Math.PI],e:[ot,[],()=>Math.E],"^":[ot,[ot,ot],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[ot,[ot],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[ot,[ot],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[ot,[ot],(t,[e])=>Math.log(e.evaluate(t))],log2:[ot,[ot],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[ot,[ot],(t,[e])=>Math.sin(e.evaluate(t))],cos:[ot,[ot],(t,[e])=>Math.cos(e.evaluate(t))],tan:[ot,[ot],(t,[e])=>Math.tan(e.evaluate(t))],asin:[ot,[ot],(t,[e])=>Math.asin(e.evaluate(t))],acos:[ot,[ot],(t,[e])=>Math.acos(e.evaluate(t))],atan:[ot,[ot],(t,[e])=>Math.atan(e.evaluate(t))],min:[ot,ui(ot),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[ot,ui(ot),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[ot,[ot],(t,[e])=>Math.abs(e.evaluate(t))],round:[ot,[ot],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[ot,[ot],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[ot,[ot],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[at,[st,ht],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[at,[ht],(t,[e])=>t.id()===e.value],"filter-type-==":[at,[st],(t,[e])=>t.geometryType()===e.value],"filter-<":[at,[st,ht],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<r}],"filter-id-<":[at,[ht],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<n}],"filter->":[at,[st,ht],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>r}],"filter-id->":[at,[ht],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[at,[st,ht],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<=r}],"filter-id-<=":[at,[ht],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[at,[st,ht],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>=r}],"filter-id->=":[at,[ht],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[at,[ht],(t,[e])=>e.value in t.properties()],"filter-has-id":[at,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[at,[gt(st)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[at,[gt(ht)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[at,[st,gt(ht)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[at,[st,gt(ht)],(t,[e,i])=>function(t,e,i,n){for(;i<=n;){const r=i+n>>1;if(e[r]===t)return!0;e[r]>t?n=r-1:i=r+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:at,overloads:[[[at,at],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[ui(at),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:at,overloads:[[[at,at],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[ui(at),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[at,[at],(t,[e])=>!e.evaluate(t)],"is-supported-script":[at,[st],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[st,[st],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[st,[st],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[st,ui(ht),(t,e)=>e.map((e=>Qt(e.evaluate(t)))).join("")],"resolved-locale":[st,[ut],(t,[e])=>e.evaluate(t).resolvedLocale()]});class Pi{constructor(t,e){var i;this.expression=t,this._warningHistory={},this._evaluator=new ae,this._defaultValue=e?"color"===(i=e).type&&yi(i.default)?new Zt(0,0,0,0):"color"===i.type?Zt.parse(i.default)||null:"padding"===i.type?Gt.parse(i.default)||null:"variableAnchorOffsetCollection"===i.type?Wt.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,r,o){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=n,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,n,r,o){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=o||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 ee(`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 ai}function Ci(t,e){const i=new le(ai,Me,[],e?function(t){const e={color:lt,string:st,number:ot,enum:st,boolean:at,formatted:pt,padding:dt,resolvedImage:mt,variableAnchorOffsetCollection:ft};return"array"===t.type?gt(e[t.value]||ht,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?pi(new Pi(n,e)):di(i.errors)}class Mi{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Ae(e.expression)}evaluateWithoutErrorHandling(t,e,i,n,r,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,o)}evaluate(t,e,i,n,r,o){return this._styleExpression.evaluate(t,e,i,n,r,o)}}class Ii{constructor(t,e,i,n){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Ae(e.expression),this.interpolationType=n}evaluateWithoutErrorHandling(t,e,i,n,r,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,o)}evaluate(t,e,i,n,r,o){return this._styleExpression.evaluate(t,e,i,n,r,o)}interpolationFactor(t,e,i){return this.interpolationType?Oe.interpolationFactor(this.interpolationType,t,e,i):0}}function Ai(t,e){const i=Ci(t,e);if("error"===i.result)return i;const n=i.value.expression,r=Ie(n);if(!r&&!mi(e))return di([new it("","data expressions not supported")]);const o=ke(n,["zoom"]);if(!o&&!fi(e))return di([new it("","zoom expressions not supported")]);const s=Li(n);return s||o?s instanceof it?di([s]):s instanceof Oe&&!gi(e)?di([new it("",'"interpolate" expressions cannot be used with this property')]):pi(s?new Ii(r?"camera":"composite",i.value,s.labels,s instanceof Oe?s.interpolation:void 0):new Mi(r?"constant":"source",i.value)):di([new it("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class ki{constructor(t,e){this._parameters=t,this._specification=e,et(this,xi(this._parameters,this._specification))}static deserialize(t){return new ki(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Li(t){let e=null;if(t instanceof Ne)e=Li(t.result);else if(t instanceof Ve){for(const i of t.args)if(e=Li(i),e)break}else(t instanceof De||t instanceof Oe)&&t.input instanceof Ce&&"zoom"===t.input.name&&(e=t);return e instanceof it||t.eachChild((t=>{const i=Li(t);i instanceof it?e=i:!e&&i?e=new it("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new it("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function Di(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(!Di(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const Bi={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ri(t){if(null==t)return{filter:()=>!0,needGeometry:!1};Di(t)||(t=Ui(t));const e=Ci(t,Bi);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:Oi(t)}}function Fi(t,e){return t<e?-1:t>e?1:0}function Oi(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e<t.length;e++)if(Oi(t[e]))return!0;return!1}function Ui(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?Vi(t[1],t[2],"=="):"!="===e?ji(Vi(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?Vi(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map(Ui))):"all"===e?["all"].concat(t.slice(1).map(Ui)):"none"===e?["all"].concat(t.slice(1).map(Ui).map(ji)):"in"===e?Ni(t[1],t.slice(2)):"!in"===e?ji(Ni(t[1],t.slice(2))):"has"===e?Zi(t[1]):"!has"===e?ji(Zi(t[1])):"within"!==e||t;var i}function Vi(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 Ni(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(Fi)]]:["filter-in-small",t,["literal",e]]}}function Zi(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function ji(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 n="{";for(let e=0;e<i.length;e++)n+=`${JSON.stringify(i[e])}:${qi(t[i[e]])},`;return`${n}}`}function $i(t){let e="";for(const i of j)e+=`/${qi(t[i])}`;return e}function Gi(t){const e=t.value;return e?[new tt(t.key,e,"constants have been deprecated as of v8")]:[]}function Hi(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Wi(t){if(Array.isArray(t))return t.map(Wi);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=Wi(t[i]);return e}return Hi(t)}function Xi(t){const e=t.key,i=t.value,n=t.valueSpec||{},r=t.objectElementValidators||{},o=t.style,s=t.styleSpec,a=t.validateSpec;let l=[];const c=_i(i);if("object"!==c)return[new tt(e,i,`object expected, ${c} found`)];for(const t in i){const c=t.split(".")[0],h=n[c]||n["*"];let u;if(r[c])u=r[c];else if(n[c])u=a;else if(r["*"])u=r["*"];else{if(!n["*"]){l.push(new tt(e,i[t],`unknown property "${t}"`));continue}u=a}l=l.concat(u({key:(e?`${e}.`:e)+t,value:i[t],valueSpec:h,style:o,styleSpec:s,object:i,objectKey:t,validateSpec:a},i))}for(const t in n)r[t]||n[t].required&&void 0===n[t].default&&void 0===i[t]&&l.push(new tt(e,i,`missing required property "${t}"`));return l}function Ki(t){const e=t.value,i=t.valueSpec,n=t.style,r=t.styleSpec,o=t.key,s=t.arrayElementValidator||t.validateSpec;if("array"!==_i(e))return[new tt(o,e,`array expected, ${_i(e)} found`)];if(i.length&&e.length!==i.length)return[new tt(o,e,`array length ${i.length} expected, length ${e.length} found`)];if(i["min-length"]&&e.length<i["min-length"])return[new tt(o,e,`array length at least ${i["min-length"]} expected, length ${e.length} found`)];let a={type:i.value,values:i.values};r.$version<7&&(a.function=i.function),"object"===_i(i.value)&&(a=i.value);let l=[];for(let i=0;i<e.length;i++)l=l.concat(s({array:e,arrayIndex:i,value:e[i],valueSpec:a,validateSpec:t.validateSpec,style:n,styleSpec:r,key:`${o}[${i}]`}));return l}function Yi(t){const e=t.key,i=t.value,n=t.valueSpec;let r=_i(i);return"number"===r&&i!=i&&(r="NaN"),"number"!==r?[new tt(e,i,`number expected, ${r} found`)]:"minimum"in n&&i<n.minimum?[new tt(e,i,`${i} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&i>n.maximum?[new tt(e,i,`${i} is greater than the maximum value ${n.maximum}`)]:[]}function Ji(t){const e=t.valueSpec,i=Hi(t.value.type);let n,r,o,s={};const a="categorical"!==i&&void 0===t.value.property,l=!a,c="array"===_i(t.value.stops)&&"array"===_i(t.value.stops[0])&&"object"===_i(t.value.stops[0][0]),h=Xi({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 tt(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const n=t.value;return e=e.concat(Ki({key:t.key,value:n,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:u})),"array"===_i(n)&&0===n.length&&e.push(new tt(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&&h.push(new tt(t.key,t.value,'missing required property "property"')),"identity"===i||t.value.stops||h.push(new tt(t.key,t.value,'missing required property "stops"')),"exponential"===i&&t.valueSpec.expression&&!gi(t.valueSpec)&&h.push(new tt(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!mi(t.valueSpec)?h.push(new tt(t.key,t.value,"property functions not supported")):a&&!fi(t.valueSpec)&&h.push(new tt(t.key,t.value,"zoom functions not supported"))),"categorical"!==i&&!c||void 0!==t.value.property||h.push(new tt(t.key,t.value,'"property" property is required')),h;function u(t){let i=[];const n=t.value,a=t.key;if("array"!==_i(n))return[new tt(a,n,`array expected, ${_i(n)} found`)];if(2!==n.length)return[new tt(a,n,`array length 2 expected, length ${n.length} found`)];if(c){if("object"!==_i(n[0]))return[new tt(a,n,`object expected, ${_i(n[0])} found`)];if(void 0===n[0].zoom)return[new tt(a,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new tt(a,n,"object stop key must have value")];if(o&&o>Hi(n[0].zoom))return[new tt(a,n[0].zoom,"stop zoom values must appear in ascending order")];Hi(n[0].zoom)!==o&&(o=Hi(n[0].zoom),r=void 0,s={}),i=i.concat(Xi({key:`${a}[0]`,value:n[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Yi,value:p}}))}else i=i.concat(p({key:`${a}[0]`,value:n[0],valueSpec:{},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},n));return zi(Wi(n[1]))?i.concat([new tt(`${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 p(t,o){const a=_i(t.value),l=Hi(t.value),c=null!==t.value?t.value:o;if(n){if(a!==n)return[new tt(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 tt(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 mi(e)&&void 0===i&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new tt(t.key,c,n)]}return"categorical"!==i||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===a&&void 0!==r&&l<r?[new tt(t.key,c,"stop domain values must appear in ascending order")]:(r=l,"categorical"===i&&l in s?[new tt(t.key,c,"stop domain values must be unique")]:(s[l]=!0,[])):[new tt(t.key,c,`integer expected, found ${l}`)]}}function Qi(t){const e=("property"===t.expressionContext?Ai:Ci)(Wi(t.value),t.valueSpec);if("error"===e.result)return e.value.map((e=>new tt(`${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 tt(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&&!Ae(i))return[new tt(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!Ae(i))return[new tt(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!ke(i,["zoom","feature-state"]))return[new tt(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Ie(i))return[new tt(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function tn(t){const e=t.key,i=t.value,n=t.valueSpec,r=[];return Array.isArray(n.values)?-1===n.values.indexOf(Hi(i))&&r.push(new tt(e,i,`expected one of [${n.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(n.values).indexOf(Hi(i))&&r.push(new tt(e,i,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(i)} found`)),r}function en(t){return Di(Wi(t.value))?Qi(et({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):nn(t)}function nn(t){const e=t.value,i=t.key;if("array"!==_i(e))return[new tt(i,e,`array expected, ${_i(e)} found`)];const n=t.styleSpec;let r,o=[];if(e.length<1)return[new tt(i,e,"filter array must have at least 1 element")];switch(o=o.concat(tn({key:`${i}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),Hi(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===Hi(e[1])&&o.push(new tt(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&o.push(new tt(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(r=_i(e[1]),"string"!==r&&o.push(new tt(`${i}[1]`,e[1],`string expected, ${r} found`)));for(let s=2;s<e.length;s++)r=_i(e[s]),"$type"===Hi(e[1])?o=o.concat(tn({key:`${i}[${s}]`,value:e[s],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==r&&"number"!==r&&"boolean"!==r&&o.push(new tt(`${i}[${s}]`,e[s],`string, number, or boolean expected, ${r} found`));break;case"any":case"all":case"none":for(let n=1;n<e.length;n++)o=o.concat(nn({key:`${i}[${n}]`,value:e[n],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":r=_i(e[1]),2!==e.length?o.push(new tt(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==r&&o.push(new tt(`${i}[1]`,e[1],`string expected, ${r} found`));break;case"within":r=_i(e[1]),2!==e.length?o.push(new tt(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):"object"!==r&&o.push(new tt(`${i}[1]`,e[1],`object expected, ${r} found`))}return o}function rn(t,e){const i=t.key,n=t.validateSpec,r=t.style,o=t.styleSpec,s=t.value,a=t.objectKey,l=o[`${e}_${t.layerType}`];if(!l)return[];const c=a.match(/^(.*)-transition$/);if("paint"===e&&c&&l[c[1]]&&l[c[1]].transition)return n({key:i,value:s,valueSpec:o.transition,style:r,styleSpec:o});const h=t.valueSpec||l[a];if(!h)return[new tt(i,s,`unknown property "${a}"`)];let u;if("string"===_i(s)&&mi(h)&&!h.tokens&&(u=/^{([^}]+)}$/.exec(s)))return[new tt(i,s,`"${a}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(u[1])} }\`.`)];const p=[];return"symbol"===t.layerType&&("text-field"===a&&r&&!r.glyphs&&p.push(new tt(i,s,'use of "text-field" requires a style "glyphs" property')),"text-font"===a&&yi(Wi(s))&&"identity"===Hi(s.type)&&p.push(new tt(i,s,'"text-font" does not support identity functions'))),p.concat(n({key:t.key,value:s,valueSpec:h,style:r,styleSpec:o,expressionContext:"property",propertyType:e,propertyKey:a}))}function on(t){return rn(t,"paint")}function sn(t){return rn(t,"layout")}function an(t){let e=[];const i=t.value,n=t.key,r=t.style,o=t.styleSpec;i.type||i.ref||e.push(new tt(n,i,'either "type" or "ref" is required'));let s=Hi(i.type);const a=Hi(i.ref);if(i.id){const o=Hi(i.id);for(let s=0;s<t.arrayIndex;s++){const t=r.layers[s];Hi(t.id)===o&&e.push(new tt(n,i.id,`duplicate layer id "${i.id}", previously used at line ${t.id.__line__}`))}}if("ref"in i){let t;["type","source","source-layer","filter","layout"].forEach((t=>{t in i&&e.push(new tt(n,i[t],`"${t}" is prohibited for ref layers`))})),r.layers.forEach((e=>{Hi(e.id)===a&&(t=e)})),t?t.ref?e.push(new tt(n,i.ref,"ref cannot reference another ref layer")):s=Hi(t.type):e.push(new tt(n,i.ref,`ref layer "${a}" not found`))}else if("background"!==s)if(i.source){const t=r.sources&&r.sources[i.source],o=t&&Hi(t.type);t?"vector"===o&&"raster"===s?e.push(new tt(n,i.source,`layer "${i.id}" requires a raster source`)):"raster"===o&&"raster"!==s?e.push(new tt(n,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==o||i["source-layer"]?"raster-dem"===o&&"hillshade"!==s?e.push(new tt(n,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==s||!i.paint||!i.paint["line-gradient"]||"geojson"===o&&t.lineMetrics||e.push(new tt(n,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new tt(n,i,`layer "${i.id}" must specify a "source-layer"`)):e.push(new tt(n,i.source,`source "${i.source}" not found`))}else e.push(new tt(n,i,'missing required property "source"'));return e=e.concat(Xi({key:n,value:i,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${n}.type`,value:i.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:i,objectKey:"type"}),filter:en,layout:t=>Xi({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>sn(et({layerType:s},t))}}),paint:t=>Xi({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>on(et({layerType:s},t))}})}})),e}function ln(t){const e=t.value,i=t.key,n=_i(e);return"string"!==n?[new tt(i,e,`string expected, ${n} found`)]:[]}const cn={promoteId:function({key:t,value:e}){if("string"===_i(e))return ln({key:t,value:e});{const i=[];for(const n in e)i.push(...ln({key:`${t}.${n}`,value:e[n]}));return i}}};function hn(t){const e=t.value,i=t.key,n=t.styleSpec,r=t.style,o=t.validateSpec;if(!e.type)return[new tt(i,e,'"type" is required')];const s=Hi(e.type);let a;switch(s){case"vector":case"raster":case"raster-dem":return a=Xi({key:i,value:e,valueSpec:n[`source_${s.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:cn,validateSpec:o}),a;case"geojson":if(a=Xi({key:i,value:e,valueSpec:n.source_geojson,style:r,styleSpec:n,validateSpec:o,objectElementValidators:cn}),e.cluster)for(const t in e.clusterProperties){const[n,r]=e.clusterProperties[t],s="string"==typeof n?[n,["accumulated"],["get",t]]:n;a.push(...Qi({key:`${i}.${t}.map`,value:r,validateSpec:o,expressionContext:"cluster-map"})),a.push(...Qi({key:`${i}.${t}.reduce`,value:s,validateSpec:o,expressionContext:"cluster-reduce"}))}return a;case"video":return Xi({key:i,value:e,valueSpec:n.source_video,style:r,validateSpec:o,styleSpec:n});case"image":return Xi({key:i,value:e,valueSpec:n.source_image,style:r,validateSpec:o,styleSpec:n});case"canvas":return[new tt(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return tn({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:r,validateSpec:o,styleSpec:n})}}function un(t){const e=t.value,i=t.styleSpec,n=i.light,r=t.style;let o=[];const s=_i(e);if(void 0===e)return o;if("object"!==s)return o=o.concat([new tt("light",e,`object expected, ${s} found`)]),o;for(const s in e){const a=s.match(/^(.*)-transition$/);o=o.concat(a&&n[a[1]]&&n[a[1]].transition?t.validateSpec({key:s,value:e[s],valueSpec:i.transition,validateSpec:t.validateSpec,style:r,styleSpec:i}):n[s]?t.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:t.validateSpec,style:r,styleSpec:i}):[new tt(s,e[s],`unknown property "${s}"`)])}return o}function pn(t){const e=t.value,i=t.styleSpec,n=i.terrain,r=t.style;let o=[];const s=_i(e);if(void 0===e)return o;if("object"!==s)return o=o.concat([new tt("terrain",e,`object expected, ${s} found`)]),o;for(const s in e)o=o.concat(n[s]?t.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:t.validateSpec,style:r,styleSpec:i}):[new tt(s,e[s],`unknown property "${s}"`)]);return o}function dn(t){let e=[];const i=t.value,n=t.key;if(Array.isArray(i)){const r=[],o=[];for(const s in i)i[s].id&&r.includes(i[s].id)&&e.push(new tt(n,i,`all the sprites' ids must be unique, but ${i[s].id} is duplicated`)),r.push(i[s].id),i[s].url&&o.includes(i[s].url)&&e.push(new tt(n,i,`all the sprites' URLs must be unique, but ${i[s].url} is duplicated`)),o.push(i[s].url),e=e.concat(Xi({key:`${n}[${s}]`,value:i[s],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return e}return ln({key:n,value:i})}const mn={"*":()=>[],array:Ki,boolean:function(t){const e=t.value,i=t.key,n=_i(e);return"boolean"!==n?[new tt(i,e,`boolean expected, ${n} found`)]:[]},number:Yi,color:function(t){const e=t.key,i=t.value,n=_i(i);return"string"!==n?[new tt(e,i,`color expected, ${n} found`)]:Zt.parse(String(i))?[]:[new tt(e,i,`color expected, "${i}" found`)]},constants:Gi,enum:tn,filter:en,function:Ji,layer:an,object:Xi,source:hn,light:un,terrain:pn,string:ln,formatted:function(t){return 0===ln(t).length?[]:Qi(t)},resolvedImage:function(t){return 0===ln(t).length?[]:Qi(t)},padding:function(t){const e=t.key,i=t.value;if("array"===_i(i)){if(i.length<1||i.length>4)return[new tt(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];const n={type:"number"};let r=[];for(let o=0;o<i.length;o++)r=r.concat(t.validateSpec({key:`${e}[${o}]`,value:i[o],validateSpec:t.validateSpec,valueSpec:n}));return r}return Yi({key:e,value:i,valueSpec:{}})},variableAnchorOffsetCollection:function(t){const e=t.key,i=t.value,n=_i(i),r=t.styleSpec;if("array"!==n||i.length<1||i.length%2!=0)return[new tt(e,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let n=0;n<i.length;n+=2)o=o.concat(tn({key:`${e}[${n}]`,value:i[n],valueSpec:r.layout_symbol["text-anchor"]})),o=o.concat(Ki({key:`${e}[${n+1}]`,value:i[n+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:r}));return o},sprite:dn};function fn(t){const e=t.value,i=t.valueSpec,n=t.styleSpec;return t.validateSpec=fn,i.expression&&yi(Hi(e))?Ji(t):i.expression&&zi(Wi(e))?Qi(t):i.type&&mn[i.type]?mn[i.type](t):Xi(et({},t,{valueSpec:i.type?n[i.type]:i}))}function gn(t){const e=t.value,i=t.key,n=ln(t);return n.length||(-1===e.indexOf("{fontstack}")&&n.push(new tt(i,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&n.push(new tt(i,e,'"glyphs" url must include a "{range}" token'))),n}function _n(t,e=Z){let i=[];return i=i.concat(fn({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:fn,objectElementValidators:{glyphs:gn,"*":()=>[]}})),t.constants&&(i=i.concat(Gi({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:fn}))),vn(i)}function yn(t){return function(e){return t({...e,validateSpec:fn})}}function vn(t){return[].concat(t).sort(((t,e)=>t.line-e.line))}function xn(t){return function(...e){return vn(t.apply(this,e))}}_n.source=xn(yn(hn)),_n.sprite=xn(yn(dn)),_n.glyphs=xn(yn(gn)),_n.light=xn(yn(un)),_n.terrain=xn(yn(pn)),_n.layer=xn(yn(an)),_n.filter=xn(yn(en)),_n.paintProperty=xn(yn(on)),_n.layoutProperty=xn(yn(sn));const bn=_n,wn=bn.light,Tn=bn.paintProperty,En=bn.layoutProperty;function Sn(t,e){let i=!1;if(e&&e.length)for(const n of e)t.fire(new V(new Error(n.message))),i=!0;return i}class Pn{constructor(t,e,i){const n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const r=new Int32Array(this.arrayBuffer);t=r[0],this.d=(e=r[1])+2*(i=r[2]);for(let t=0;t<this.d*this.d;t++){const e=r[3+t],i=r[3+t+1];n.push(e===i?null:r.subarray(e,i))}const o=r[3+n.length+1];this.keys=r.subarray(r[3+n.length],o),this.bboxes=r.subarray(o),this.insert=this._insertReadonly}else{this.d=e+2*i;for(let t=0;t<this.d*this.d;t++)n.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=i,this.scale=e/t,this.uid=0;const r=i/e*t;this.min=-r,this.max=t+r}insert(t,e,i,n,r){this._forEachCell(e,i,n,r,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(r)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,e,i,n,r,o){this.cells[r].push(o)}query(t,e,i,n,r){const o=this.min,s=this.max;if(t<=o&&e<=o&&s<=i&&s<=n&&!r)return Array.prototype.slice.call(this.keys);{const o=[];return this._forEachCell(t,e,i,n,this._queryCell,o,{},r),o}}_queryCell(t,e,i,n,r,o,s,a){const l=this.cells[r];if(null!==l){const r=this.keys,c=this.bboxes;for(let h=0;h<l.length;h++){const u=l[h];if(void 0===s[u]){const l=4*u;(a?a(c[l+0],c[l+1],c[l+2],c[l+3]):t<=c[l+2]&&e<=c[l+3]&&i>=c[l+0]&&n>=c[l+1])?(s[u]=!0,o.push(r[u])):s[u]=!1}}}}_forEachCell(t,e,i,n,r,o,s,a){const l=this._convertToCellCoord(t),c=this._convertToCellCoord(e),h=this._convertToCellCoord(i),u=this._convertToCellCoord(n);for(let p=l;p<=h;p++)for(let l=c;l<=u;l++){const c=this.d*l+p;if((!a||a(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&r.call(this,t,e,i,n,c,o,s,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<this.cells.length;t++)i+=this.cells[t].length;const n=new Int32Array(e+i+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let r=e;for(let e=0;e<t.length;e++){const i=t[e];n[3+e]=r,n.set(i,r),r+=i.length}return n[3+t.length]=r,n.set(this.keys,r),r+=this.keys.length,n[3+t.length+1]=r,n.set(this.bboxes,r),r+=this.bboxes.length,n.buffer}static serialize(t,e){const i=t.toArrayBuffer();return e&&e.push(i),{buffer:i}}static deserialize(t){return new Pn(t.buffer)}}const zn={};function Cn(t,e,i={}){if(zn[t])throw new Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),zn[t]={klass:e,omit:i.omit||[],shallow:i.shallow||[]}}Cn("Object",Object),Cn("TransferableGridIndex",Pn),Cn("Color",Zt),Cn("Error",Error),Cn("AJAXError",I),Cn("ResolvedImage",Xt),Cn("StylePropertyFunction",ki),Cn("StyleExpression",Pi,{omit:["_evaluator"]}),Cn("ZoomDependentExpression",Ii),Cn("ZoomConstantExpression",Mi),Cn("CompoundExpression",Ce,{omit:["_evaluate"]});for(const t in ai)ai[t]._classRegistryKey||Cn(`Expression_${t}`,ai[t]);function Mn(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function In(t,e){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)return t;if(Mn(t))return e&&e.push(t),t;if(E(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){const i=t;return e&&e.push(i.buffer),i}if(t instanceof ImageData)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const i=[];for(const n of t)i.push(In(n,e));return i}if("object"==typeof t){const i=t.constructor,n=i._classRegistryKey;if(!n)throw new Error("can't serialize object of unregistered class");if(!zn[n])throw new Error(`${n} is not registered.`);const r=i.serialize?i.serialize(t,e):{};if(i.serialize){if(e&&r===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const i in t){if(!t.hasOwnProperty(i))continue;if(zn[n].omit.indexOf(i)>=0)continue;const o=t[i];r[i]=zn[n].shallow.indexOf(i)>=0?o:In(o,e)}t instanceof Error&&(r.message=t.message)}if(r.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==n&&(r.$name=n),r}throw new Error("can't serialize object of type "+typeof t)}function An(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||Mn(t)||E(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(An);if("object"==typeof t){const e=t.$name||"Object";if(!zn[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:i}=zn[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 r=t[i];n[i]=zn[e].shallow.indexOf(i)>=0?r:An(r)}return n}throw new Error("can't deserialize object of type "+typeof t)}class kn{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.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=i,!0))}}const Ln={"Latin-1 Supplement":t=>t>=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 Dn(t){for(const e of t)if(Fn(e.charCodeAt(0)))return!0;return!1}function Bn(t){for(const e of t)if(!Rn(e.charCodeAt(0)))return!1;return!0}function Rn(t){return!(Ln.Arabic(t)||Ln["Arabic Supplement"](t)||Ln["Arabic Extended-A"](t)||Ln["Arabic Presentation Forms-A"](t)||Ln["Arabic Presentation Forms-B"](t))}function Fn(t){return!(746!==t&&747!==t&&(t<4352||!(Ln["Bopomofo Extended"](t)||Ln.Bopomofo(t)||Ln["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||Ln["CJK Compatibility Ideographs"](t)||Ln["CJK Compatibility"](t)||Ln["CJK Radicals Supplement"](t)||Ln["CJK Strokes"](t)||!(!Ln["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Ln["CJK Unified Ideographs Extension A"](t)||Ln["CJK Unified Ideographs"](t)||Ln["Enclosed CJK Letters and Months"](t)||Ln["Hangul Compatibility Jamo"](t)||Ln["Hangul Jamo Extended-A"](t)||Ln["Hangul Jamo Extended-B"](t)||Ln["Hangul Jamo"](t)||Ln["Hangul Syllables"](t)||Ln.Hiragana(t)||Ln["Ideographic Description Characters"](t)||Ln.Kanbun(t)||Ln["Kangxi Radicals"](t)||Ln["Katakana Phonetic Extensions"](t)||Ln.Katakana(t)&&12540!==t||!(!Ln["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)||!(!Ln["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Ln["Unified Canadian Aboriginal Syllabics"](t)||Ln["Unified Canadian Aboriginal Syllabics Extended"](t)||Ln["Vertical Forms"](t)||Ln["Yijing Hexagram Symbols"](t)||Ln["Yi Syllables"](t)||Ln["Yi Radicals"](t))))}function On(t){return!(Fn(t)||function(t){return!!(Ln["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||Ln["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)||Ln["Letterlike Symbols"](t)||Ln["Number Forms"](t)||Ln["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)||Ln["Control Pictures"](t)&&9251!==t||Ln["Optical Character Recognition"](t)||Ln["Enclosed Alphanumerics"](t)||Ln["Geometric Shapes"](t)||Ln["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Ln["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Ln["CJK Symbols and Punctuation"](t)||Ln.Katakana(t)||Ln["Private Use Area"](t)||Ln["CJK Compatibility Forms"](t)||Ln["Small Form Variants"](t)||Ln["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 Un(t){return t>=1424&&t<=2303||Ln["Arabic Presentation Forms-A"](t)||Ln["Arabic Presentation Forms-B"](t)}function Vn(t,e){return!(!e&&Un(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Ln.Khmer(t))}function Nn(t){for(const e of t)if(Un(e.charCodeAt(0)))return!0;return!1}const Zn="deferred",jn="loading",qn="loaded";let $n=null,Gn="unavailable",Hn=null;const Wn=function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&(Gn="error"),$n&&$n(t)};function Xn(){Kn.fire(new U("pluginStateChange",{pluginStatus:Gn,pluginURL:Hn}))}const Kn=new N,Yn=function(){return Gn},Jn=function(){if(Gn!==Zn||!Hn)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Gn=jn,Xn(),Hn&&B({url:Hn},(t=>{t?Wn(t):(Gn=qn,Xn())}))},Qn={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Gn===qn||null!=Qn.applyArabicShaping,isLoading:()=>Gn===jn,setState(t){if(!b())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Gn=t.pluginStatus,Hn=t.pluginURL},isParsed(){if(!b())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return null!=Qn.applyArabicShaping&&null!=Qn.processBidirectionalText&&null!=Qn.processStyledBidirectionalText},getPluginURL(){if(!b())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Hn}};class tr{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 kn,this.transition={})}isSupportedScript(t){return function(t,e){for(const i of t)if(!Vn(i.charCodeAt(0),e))return!1;return!0}(t,Qn.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 er{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(yi(t))return new ki(t,e);if(zi(t)){const i=Ai(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=Zt.parse(t):"padding"!==e.type||"number"!=typeof t&&!Array.isArray(t)?"variableAnchorOffsetCollection"===e.type&&Array.isArray(t)&&(i=Wt.parse(t)):i=Gt.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 ir{constructor(t){this.property=t,this.value=new er(t,void 0)}transitioned(t,e){return new rr(this.property,this.value,e,p({},t.transition,this.transition),t.now)}untransitioned(){return new rr(this.property,this.value,null,{},0)}}class nr{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return g(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ir(this._values[t].property)),this._values[t].value=new er(this._values[t].property,null===e?void 0:g(e))}getTransition(t){return g(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ir(this._values[t].property)),this._values[t].transition=g(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 or(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 or(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class rr{constructor(t,e,i,n,r){this.property=t,this.value=e,this.begin=r+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,r=this.value.possiblyEvaluate(t,e,i),o=this.prior;if(o){if(n>this.end)return this.prior=null,r;if(this.value.isDataDriven())return this.prior=null,r;if(n<this.begin)return o.possiblyEvaluate(t,e,i);{const s=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(t,e,i),r,function(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,i=e*t;return 4*(t<.5?i:3*(t-e)+i-.75)}(s))}}return r}}class or{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,i){const n=new lr(this._properties);for(const r of Object.keys(this._values))n._values[r]=this._values[r].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 sr{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return void 0!==this._values[t].value}getValue(t){return g(this._values[t].value)}setValue(t,e){this._values[t]=new er(this._values[t].property,null===e?void 0:g(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 lr(this._properties);for(const r of Object.keys(this._values))n._values[r]=this._values[r].possiblyEvaluate(t,e,i);return n}}class ar{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 lr{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class cr{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=Fe[this.specification.type];return n?n(t,e,i):t}}class hr{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,i,n){return new ar(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 ar(this,{kind:"constant",value:void 0},t.parameters);const n=Fe[this.specification.type];if(n){const r=n(t.value.value,e.value.value,i);return new ar(this,{kind:"constant",value:r},t.parameters)}return t}evaluate(t,e,i,n,r,o){return"constant"===t.kind?t.value:t.evaluate(e,i,n,r,o)}}class ur extends hr{possiblyEvaluate(t,e,i,n){if(void 0===t.value)return new ar(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const r=t.expression.evaluate(e,null,{},i,n),o="resolvedImage"===t.property.specification.type&&"string"!=typeof r?r.name:r,s=this._calculate(o,o,o,e);return new ar(this,{kind:"constant",value:s},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 ar(this,{kind:"constant",value:i},e)}return new ar(this,t.expression,e)}evaluate(t,e,i,n,r,o){if("source"===t.kind){const s=t.evaluate(e,i,n,r,o);return this._calculate(s,s,s,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 pr{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,n){if(void 0!==t.value){if("constant"===t.expression.kind){const r=t.expression.evaluate(e,null,{},i,n);return this._calculate(r,r,r,e)}return this._calculate(t.expression.evaluate(new tr(Math.floor(e.zoom-1),e)),t.expression.evaluate(new tr(Math.floor(e.zoom),e)),t.expression.evaluate(new tr(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 dr{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,n){return!!t.expression.evaluate(e,null,{},i,n)}interpolate(){return!1}}class mr{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 er(i,void 0),r=this.defaultTransitionablePropertyValues[e]=new ir(i);this.defaultTransitioningPropertyValues[e]=r.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({})}}}Cn("DataDrivenProperty",hr),Cn("DataConstantProperty",cr),Cn("CrossFadedDataDrivenProperty",ur),Cn("CrossFadedProperty",pr),Cn("ColorRampProperty",dr);const fr="-transition";class gr extends N{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 sr(e.layout)),e.paint)){this._transitionablePaint=new nr(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 lr(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(En,`layers.${this.id}.layout.${t}`,t,e,i)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return t.endsWith(fr)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,i={}){if(null!=e&&this._validate(Tn,`layers.${this.id}.paint.${t}`,t,e,i))return!1;if(t.endsWith(fr))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"],r=i.value.isDataDriven(),o=i.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const s=this._transitionablePaint._values[t].value;return s.isDataDriven()||r||n||this._handleOverridablePaintPropertyUpdate(t,o,s)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,i){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&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),f(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,i,n,r={}){return(!r||!1!==r.validate)&&Sn(this,t.call(bn,{key:e,layerType:this.type,objectKey:i,value:n,styleSpec:Z,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 ar&&mi(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}}const _r={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class yr{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 vr{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 xr(t,e=1){let i=0,n=0;return{members:t.map((t=>{const r=_r[t.type].BYTES_PER_ELEMENT,o=i=br(i,Math.max(e,r)),s=t.components||1;return n=Math.max(n,r),i+=r*s,{name:t.name,type:t.type,components:s,offset:o}})),size:br(i,Math.max(n,e)),alignment:e}}function br(t,e){return Math.ceil(t/e)*e}class wr extends vr{_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}}wr.prototype.bytesPerElement=4,Cn("StructArrayLayout2i4",wr);class Tr extends vr{_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 r=3*t;return this.int16[r+0]=e,this.int16[r+1]=i,this.int16[r+2]=n,t}}Tr.prototype.bytesPerElement=6,Cn("StructArrayLayout3i6",Tr);class Er extends vr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i,n)}emplace(t,e,i,n,r){const o=4*t;return this.int16[o+0]=e,this.int16[o+1]=i,this.int16[o+2]=n,this.int16[o+3]=r,t}}Er.prototype.bytesPerElement=8,Cn("StructArrayLayout4i8",Er);class Sr extends vr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r,o){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,i,n,r,o)}emplace(t,e,i,n,r,o,s){const a=6*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.int16[a+2]=n,this.int16[a+3]=r,this.int16[a+4]=o,this.int16[a+5]=s,t}}Sr.prototype.bytesPerElement=12,Cn("StructArrayLayout2i4i12",Sr);class Pr extends vr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r,o){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,i,n,r,o)}emplace(t,e,i,n,r,o,s){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]=r,this.uint8[l+6]=o,this.uint8[l+7]=s,t}}Pr.prototype.bytesPerElement=8,Cn("StructArrayLayout2i4ub8",Pr);class zr extends vr{_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}}zr.prototype.bytesPerElement=8,Cn("StructArrayLayout2f8",zr);class Cr extends vr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r,o,s,a,l,c){const h=this.length;return this.resize(h+1),this.emplace(h,t,e,i,n,r,o,s,a,l,c)}emplace(t,e,i,n,r,o,s,a,l,c,h){const u=10*t;return this.uint16[u+0]=e,this.uint16[u+1]=i,this.uint16[u+2]=n,this.uint16[u+3]=r,this.uint16[u+4]=o,this.uint16[u+5]=s,this.uint16[u+6]=a,this.uint16[u+7]=l,this.uint16[u+8]=c,this.uint16[u+9]=h,t}}Cr.prototype.bytesPerElement=20,Cn("StructArrayLayout10ui20",Cr);class Mr extends vr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r,o,s,a,l,c,h,u){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,i,n,r,o,s,a,l,c,h,u)}emplace(t,e,i,n,r,o,s,a,l,c,h,u,p){const d=12*t;return this.int16[d+0]=e,this.int16[d+1]=i,this.int16[d+2]=n,this.int16[d+3]=r,this.uint16[d+4]=o,this.uint16[d+5]=s,this.uint16[d+6]=a,this.uint16[d+7]=l,this.int16[d+8]=c,this.int16[d+9]=h,this.int16[d+10]=u,this.int16[d+11]=p,t}}Mr.prototype.bytesPerElement=24,Cn("StructArrayLayout4i4ui4i24",Mr);class Ir extends vr{_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 r=3*t;return this.float32[r+0]=e,this.float32[r+1]=i,this.float32[r+2]=n,t}}Ir.prototype.bytesPerElement=12,Cn("StructArrayLayout3f12",Ir);class Ar extends vr{_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}}Ar.prototype.bytesPerElement=4,Cn("StructArrayLayout1ul4",Ar);class kr extends vr{_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,r,o,s,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,i,n,r,o,s,a,l)}emplace(t,e,i,n,r,o,s,a,l,c){const h=10*t,u=5*t;return this.int16[h+0]=e,this.int16[h+1]=i,this.int16[h+2]=n,this.int16[h+3]=r,this.int16[h+4]=o,this.int16[h+5]=s,this.uint32[u+3]=a,this.uint16[h+8]=l,this.uint16[h+9]=c,t}}kr.prototype.bytesPerElement=20,Cn("StructArrayLayout6i1ul2ui20",kr);class Lr extends vr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r,o){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,i,n,r,o)}emplace(t,e,i,n,r,o,s){const a=6*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.int16[a+2]=n,this.int16[a+3]=r,this.int16[a+4]=o,this.int16[a+5]=s,t}}Lr.prototype.bytesPerElement=12,Cn("StructArrayLayout2i2i2i12",Lr);class Dr extends vr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,n,r)}emplace(t,e,i,n,r,o){const s=4*t,a=8*t;return this.float32[s+0]=e,this.float32[s+1]=i,this.float32[s+2]=n,this.int16[a+6]=r,this.int16[a+7]=o,t}}Dr.prototype.bytesPerElement=16,Cn("StructArrayLayout2f1f2i16",Dr);class Br extends vr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i,n)}emplace(t,e,i,n,r){const o=12*t,s=3*t;return this.uint8[o+0]=e,this.uint8[o+1]=i,this.float32[s+1]=n,this.float32[s+2]=r,t}}Br.prototype.bytesPerElement=12,Cn("StructArrayLayout2ub2f12",Br);class Rr extends vr{_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 r=3*t;return this.uint16[r+0]=e,this.uint16[r+1]=i,this.uint16[r+2]=n,t}}Rr.prototype.bytesPerElement=6,Cn("StructArrayLayout3ui6",Rr);class Fr extends vr{_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,r,o,s,a,l,c,h,u,p,d,m,f,g){const _=this.length;return this.resize(_+1),this.emplace(_,t,e,i,n,r,o,s,a,l,c,h,u,p,d,m,f,g)}emplace(t,e,i,n,r,o,s,a,l,c,h,u,p,d,m,f,g,_){const y=24*t,v=12*t,x=48*t;return this.int16[y+0]=e,this.int16[y+1]=i,this.uint16[y+2]=n,this.uint16[y+3]=r,this.uint32[v+2]=o,this.uint32[v+3]=s,this.uint32[v+4]=a,this.uint16[y+10]=l,this.uint16[y+11]=c,this.uint16[y+12]=h,this.float32[v+7]=u,this.float32[v+8]=p,this.uint8[x+36]=d,this.uint8[x+37]=m,this.uint8[x+38]=f,this.uint32[v+10]=g,this.int16[y+22]=_,t}}Fr.prototype.bytesPerElement=48,Cn("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Fr);class Or extends vr{_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,r,o,s,a,l,c,h,u,p,d,m,f,g,_,y,v,x,b,w,T,E,S,P,z){const C=this.length;return this.resize(C+1),this.emplace(C,t,e,i,n,r,o,s,a,l,c,h,u,p,d,m,f,g,_,y,v,x,b,w,T,E,S,P,z)}emplace(t,e,i,n,r,o,s,a,l,c,h,u,p,d,m,f,g,_,y,v,x,b,w,T,E,S,P,z,C){const M=32*t,I=16*t;return this.int16[M+0]=e,this.int16[M+1]=i,this.int16[M+2]=n,this.int16[M+3]=r,this.int16[M+4]=o,this.int16[M+5]=s,this.int16[M+6]=a,this.int16[M+7]=l,this.uint16[M+8]=c,this.uint16[M+9]=h,this.uint16[M+10]=u,this.uint16[M+11]=p,this.uint16[M+12]=d,this.uint16[M+13]=m,this.uint16[M+14]=f,this.uint16[M+15]=g,this.uint16[M+16]=_,this.uint16[M+17]=y,this.uint16[M+18]=v,this.uint16[M+19]=x,this.uint16[M+20]=b,this.uint16[M+21]=w,this.uint16[M+22]=T,this.uint32[I+12]=E,this.float32[I+13]=S,this.float32[I+14]=P,this.uint16[M+30]=z,this.uint16[M+31]=C,t}}Or.prototype.bytesPerElement=64,Cn("StructArrayLayout8i15ui1ul2f2ui64",Or);class Ur extends vr{_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}}Ur.prototype.bytesPerElement=4,Cn("StructArrayLayout1f4",Ur);class Vr extends vr{_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 r=3*t;return this.uint16[6*t+0]=e,this.float32[r+1]=i,this.float32[r+2]=n,t}}Vr.prototype.bytesPerElement=12,Cn("StructArrayLayout1ui2f12",Vr);class Nr extends vr{_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 r=4*t;return this.uint32[2*t+0]=e,this.uint16[r+2]=i,this.uint16[r+3]=n,t}}Nr.prototype.bytesPerElement=8,Cn("StructArrayLayout1ul2ui8",Nr);class Zr extends vr{_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}}Zr.prototype.bytesPerElement=4,Cn("StructArrayLayout2ui4",Zr);class jr extends vr{_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}}jr.prototype.bytesPerElement=2,Cn("StructArrayLayout1ui2",jr);class qr extends vr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i,n)}emplace(t,e,i,n,r){const o=4*t;return this.float32[o+0]=e,this.float32[o+1]=i,this.float32[o+2]=n,this.float32[o+3]=r,t}}qr.prototype.bytesPerElement=16,Cn("StructArrayLayout4f16",qr);class $r extends yr{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)}}$r.prototype.size=20;class Gr extends kr{get(t){return new $r(this,t)}}Cn("CollisionBoxArray",Gr);class Hr extends yr{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]}}Hr.prototype.size=48;class Wr extends Fr{get(t){return new Hr(this,t)}}Cn("PlacedSymbolArray",Wr);class Xr extends yr{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]}}Xr.prototype.size=64;class Kr extends Or{get(t){return new Xr(this,t)}}Cn("SymbolInstanceArray",Kr);class Yr extends Ur{getoffsetX(t){return this.float32[1*t+0]}}Cn("GlyphOffsetArray",Yr);class Jr extends Tr{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Cn("SymbolLineVertexArray",Jr);class Qr extends yr{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]}}Qr.prototype.size=12;class to extends Vr{get(t){return new Qr(this,t)}}Cn("TextAnchorOffsetArray",to);class eo extends yr{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]}}eo.prototype.size=8;class io extends Nr{get(t){return new eo(this,t)}}Cn("FeatureIndexArray",io);class no extends wr{}class ro extends wr{}class oo extends wr{}class so extends Sr{}class ao extends Pr{}class lo extends zr{}class co extends Cr{}class ho extends Mr{}class uo extends Ir{}class po extends Ar{}class mo extends Lr{}class fo extends Br{}class go extends Rr{}class _o extends Zr{}const yo=xr([{name:"a_pos",components:2,type:"Int16"}],4),{members:vo}=yo;class xo{constructor(t=[]){this.segments=t}prepareSegment(t,e,i,n){let r=this.segments[this.segments.length-1];return t>xo.MAX_VERTEX_ARRAY_LENGTH&&y(`Max vertices per segment is ${xo.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!r||r.vertexLength+t>xo.MAX_VERTEX_ARRAY_LENGTH||r.sortKey!==n)&&(r={vertexOffset:e.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0},void 0!==n&&(r.sortKey=n),this.segments.push(r)),r}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 xo([{vertexOffset:t,primitiveOffset:e,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}}function bo(t,e){return 256*(t=h(Math.floor(t),0,255))+h(Math.floor(e),0,255)}xo.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Cn("SegmentVector",xo);const wo=xr([{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 To={exports:{}},Eo=function(t,e){var i,n,r,o,s,a,l,c;for(n=t.length-(i=3&t.length),r=e,s=3432918353,a=461845907,c=0;c<n;)l=255&t.charCodeAt(c)|(255&t.charCodeAt(++c))<<8|(255&t.charCodeAt(++c))<<16|(255&t.charCodeAt(++c))<<24,++c,r=27492+(65535&(o=5*(65535&(r=(r^=l=(65535&(l=(l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|r>>>19))+((5*(r>>>16)&65535)<<16)&4294967295))+((58964+(o>>>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:r^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(c)))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return r^=t.length,r=2246822507*(65535&(r^=r>>>16))+((2246822507*(r>>>16)&65535)<<16)&4294967295,r=3266489909*(65535&(r^=r>>>13))+((3266489909*(r>>>16)&65535)<<16)&4294967295,(r^=r>>>16)>>>0},So=function(t,e){for(var i,n=t.length,r=e^n,o=0;n>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<24))+((1540483477*(i>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),n-=4,++o;switch(n){case 3:r^=(255&t.charCodeAt(o+2))<<16;case 2:r^=(255&t.charCodeAt(o+1))<<8;case 1:r=1540483477*(65535&(r^=255&t.charCodeAt(o)))+((1540483477*(r>>>16)&65535)<<16)}return r=1540483477*(65535&(r^=r>>>13))+((1540483477*(r>>>16)&65535)<<16),(r^=r>>>15)>>>0};To.exports=Eo,To.exports.murmur3=Eo,To.exports.murmur2=So;var Po=e(To.exports);class zo{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,i,n){this.ids.push(Co(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=Co(t);let i=0,n=this.ids.length-1;for(;i<n;){const t=i+n>>1;this.ids[t]>=e?n=t:i=t+1}const r=[];for(;this.ids[i]===e;)r.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return r}static serialize(t,e){const i=new Float64Array(t.ids),n=new Uint32Array(t.positions);return Mo(i,n,0,i.length-1),e&&e.push(i.buffer,n.buffer),{ids:i,positions:n}}static deserialize(t){const e=new zo;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function Co(t){const e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Po(String(t))}function Mo(t,e,i,n){for(;i<n;){const r=t[i+n>>1];let o=i-1,s=n+1;for(;;){do{o++}while(t[o]<r);do{s--}while(t[s]>r);if(o>=s)break;Io(t,o,s),Io(e,3*o,3*s),Io(e,3*o+1,3*s+1),Io(e,3*o+2,3*s+2)}s-i<n-s?(Mo(t,e,i,s),i=s+1):(Mo(t,e,s+1,n),n=s)}}function Io(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}Cn("FeaturePositionMap",zo);class Ao{constructor(t,e){this.gl=t.gl,this.location=e}}class ko extends Ao{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class Lo extends Ao{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class Do extends Ao{constructor(t,e){super(t,e),this.current=Zt.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}const Bo=new Float32Array(16);function Ro(t){return[bo(255*t.r,255*t.g),bo(255*t.b,255*t.a)]}class Fo{constructor(t,e,i){this.value=t,this.uniformNames=e.map((t=>`u_${t}`)),this.type=i}setUniform(t,e,i){t.set(i.constantOr(this.value))}getBinding(t,e,i){return"color"===this.type?new Do(t,e):new ko(t,e)}}class Oo{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 r="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;r&&t.set(r)}getBinding(t,e,i){return"u_pattern"===i.substr(0,9)?new Lo(t,e):new ko(t,e)}}class Uo{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,r){const o=this.paintVertexArray.length,s=this.expression.evaluate(new tr(0),e,{},n,[],r);this.paintVertexArray.resize(t),this._setPaintValue(o,t,s)}updatePaintArray(t,e,i,n){const r=this.expression.evaluate({zoom:0},i,n);this._setPaintValue(t,e,r)}_setPaintValue(t,e,i){if("color"===this.type){const n=Ro(i);for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,n[0],n[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Vo{constructor(t,e,i,n,r,o){this.expression=t,this.uniformNames=e.map((t=>`u_${t}_t`)),this.type=i,this.useIntegerZoom=n,this.zoom=r,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===i?4:2,offset:0}))),this.paintVertexArray=new o}populatePaintArray(t,e,i,n,r){const o=this.expression.evaluate(new tr(this.zoom),e,{},n,[],r),s=this.expression.evaluate(new tr(this.zoom+1),e,{},n,[],r),a=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(a,t,o,s)}updatePaintArray(t,e,i,n){const r=this.expression.evaluate({zoom:this.zoom},i,n),o=this.expression.evaluate({zoom:this.zoom+1},i,n);this._setPaintValue(t,e,r,o)}_setPaintValue(t,e,i,n){if("color"===this.type){const r=Ro(i),o=Ro(n);for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r[0],r[1],o[0],o[1])}else{for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,i,n);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(n))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e){const i=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,n=h(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);t.set(n)}getBinding(t,e,i){return new ko(t,e)}}class No{constructor(t,e,i,n,r,o){this.expression=t,this.type=e,this.useIntegerZoom=i,this.zoom=n,this.layerId=o,this.zoomInPaintVertexArray=new r,this.zoomOutPaintVertexArray=new r}populatePaintArray(t,e,i){const n=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(n,t,e.patterns&&e.patterns[this.layerId],i)}updatePaintArray(t,e,i,n,r){this._setPaintValues(t,e,i.patterns&&i.patterns[this.layerId],r)}_setPaintValues(t,e,i,n){if(!n||!i)return;const{min:r,mid:o,max:s}=i,a=n[r],l=n[o],c=n[s];if(a&&l&&c)for(let i=t;i<e;i++)this.zoomInPaintVertexArray.emplace(i,l.tl[0],l.tl[1],l.br[0],l.br[1],a.tl[0],a.tl[1],a.br[0],a.br[1],l.pixelRatio,a.pixelRatio),this.zoomOutPaintVertexArray.emplace(i,l.tl[0],l.tl[1],l.br[0],l.br[1],c.tl[0],c.tl[1],c.br[0],c.br[1],l.pixelRatio,c.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,wo.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,wo.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Zo{constructor(t,e,i){this.binders={},this._buffers=[];const n=[];for(const r in t.paint._values){if(!i(r))continue;const o=t.paint.get(r);if(!(o instanceof ar&&mi(o.property.specification)))continue;const s=qo(r,t.type),a=o.value,l=o.property.specification.type,c=o.property.useIntegerZoom,h=o.property.specification["property-type"],u="cross-faded"===h||"cross-faded-data-driven"===h;if("constant"===a.kind)this.binders[r]=u?new Oo(a.value,s):new Fo(a.value,s,l),n.push(`/u_${r}`);else if("source"===a.kind||u){const i=$o(r,l,"source");this.binders[r]=u?new No(a,l,c,e,i,t.id):new Uo(a,s,l,i),n.push(`/a_${r}`)}else{const t=$o(r,l,"composite");this.binders[r]=new Vo(a,s,l,c,e,t),n.push(`/z_${r}`)}}this.cacheKey=n.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof Uo||e instanceof Vo?e.maxValue:0}populatePaintArrays(t,e,i,n,r){for(const o in this.binders){const s=this.binders[o];(s instanceof Uo||s instanceof Vo||s instanceof No)&&s.populatePaintArray(t,e,i,n,r)}}setConstantPatternPositions(t,e){for(const i in this.binders){const n=this.binders[i];n instanceof Oo&&n.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,i,n,r){let o=!1;for(const s in t){const a=e.getPositions(s);for(const e of a){const a=i.feature(e.index);for(const i in this.binders){const l=this.binders[i];if((l instanceof Uo||l instanceof Vo||l instanceof No)&&!0===l.expression.isStateDependent){const c=n.paint.get(i);l.expression=c.value,l.updatePaintArray(e.start,e.end,a,t[s],r),o=!0}}}}return o}defines(){const t=[];for(const e in this.binders){const i=this.binders[e];(i instanceof Fo||i instanceof Oo)&&t.push(...i.uniformNames.map((t=>`#define HAS_UNIFORM_${t}`)))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const i=this.binders[e];if(i instanceof Uo||i instanceof Vo)for(let e=0;e<i.paintVertexAttributes.length;e++)t.push(i.paintVertexAttributes[e].name);else if(i instanceof No)for(let e=0;e<wo.members.length;e++)t.push(wo.members[e].name)}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const i=this.binders[e];if(i instanceof Fo||i instanceof Oo||i instanceof Vo)for(const e of i.uniformNames)t.push(e)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){const i=[];for(const n in this.binders){const r=this.binders[n];if(r instanceof Fo||r instanceof Oo||r instanceof Vo)for(const o of r.uniformNames)if(e[o]){const s=r.getBinding(t,e[o],o);i.push({name:o,property:n,binding:s})}}return i}setUniforms(t,e,i,n){for(const{name:t,property:r,binding:o}of e)this.binders[r].setUniform(o,n,i.get(r),t)}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const i=this.binders[e];if(t&&i instanceof No){const e=2===t.fromScale?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(i instanceof Uo||i instanceof Vo)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(t){for(const e in this.binders){const i=this.binders[e];(i instanceof Uo||i instanceof Vo||i instanceof No)&&i.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof Uo||e instanceof Vo||e instanceof No)&&e.destroy()}}}class jo{constructor(t,e,i=(()=>!0)){this.programConfigurations={};for(const n of t)this.programConfigurations[n.id]=new Zo(n,e,i);this.needsUpload=!1,this._featureMap=new zo,this._bufferOffset=0}populatePaintArrays(t,e,i,n,r,o){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(t,e,n,r,o);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 r of i)this.needsUpload=this.programConfigurations[r.id].updatePaintArrays(t,this._featureMap,e,r,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 qo(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 $o(t,e,i){const n={color:{source:zr,composite:qr},number:{source:Ur,composite:zr}},r=function(t){return{"line-pattern":{source:co,composite:co},"fill-pattern":{source:co,composite:co},"fill-extrusion-pattern":{source:co,composite:co}}[t]}(t);return r&&r[i]||n[e][i]}Cn("ConstantBinder",Fo),Cn("CrossFadedConstantBinder",Oo),Cn("SourceExpressionBinder",Uo),Cn("CrossFadedCompositeBinder",No),Cn("CompositeExpressionBinder",Vo),Cn("ProgramConfiguration",Zo,{omit:["_buffers"]}),Cn("ProgramConfigurationSet",jo);const Go=8192,Ho=Math.pow(2,14)-1,Wo=-Ho-1;function Xo(t){const e=Go/t.extent,i=t.loadGeometry();for(let t=0;t<i.length;t++){const n=i[t];for(let t=0;t<n.length;t++){const i=n[t],r=Math.round(i.x*e),o=Math.round(i.y*e);i.x=h(r,Wo,Ho),i.y=h(o,Wo,Ho),(r<i.x||r>i.x+1||o<i.y||o>i.y+1)&&y("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function Ko(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Xo(t):[]}}function Yo(t,e,i,n,r){t.emplaceBack(2*e+(n+1)/2,2*i+(r+1)/2)}class Jo{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 ro,this.indexArray=new go,this.segments=new xo,this.programConfigurations=new jo(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],r=[];let o=null,s=!1;"circle"===n.type&&(o=n.layout.get("circle-sort-key"),s=!o.isConstant());for(const{feature:e,id:n,index:a,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Ko(e,t);if(!this.layers[0]._featureFilter.filter(new tr(this.zoom),c,i))continue;const h=s?o.evaluate(c,{},i):void 0,u={id:n,properties:e.properties,type:e.type,sourceLayerIndex:l,index:a,geometry:t?c.geometry:Xo(e),patterns:{},sortKey:h};r.push(u)}s&&r.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of r){const{geometry:r,index:o,sourceLayerIndex:s}=n,a=t[o].feature;this.addFeature(n,r,o,i),e.featureIndex.insert(a,r,o,s,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,vo),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>=Go||n<0||n>=Go)continue;const r=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),o=r.vertexLength;Yo(this.layoutVertexArray,i,n,-1,-1),Yo(this.layoutVertexArray,i,n,1,-1),Yo(this.layoutVertexArray,i,n,1,1),Yo(this.layoutVertexArray,i,n,-1,1),this.indexArray.emplaceBack(o,o+1,o+2),this.indexArray.emplaceBack(o,o+3,o+2),r.vertexLength+=4,r.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{},n)}}function Qo(t,e){for(let i=0;i<t.length;i++)if(ls(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(ls(t,e[i]))return!0;return!!ns(t,e)}function ts(t,e,i){return!!ls(t,e)||!!os(e,t,i)}function es(t,e){if(1===t.length)return as(e,t[0]);for(let i=0;i<e.length;i++){const n=e[i];for(let e=0;e<n.length;e++)if(ls(t,n[e]))return!0}for(let i=0;i<t.length;i++)if(as(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(ns(t,e[i]))return!0;return!1}function is(t,e,i){if(t.length>1){if(ns(t,e))return!0;for(let n=0;n<e.length;n++)if(os(e[n],t,i))return!0}for(let n=0;n<t.length;n++)if(os(t[n],e,i))return!0;return!1}function ns(t,e){if(0===t.length||0===e.length)return!1;for(let i=0;i<t.length-1;i++){const n=t[i],r=t[i+1];for(let t=0;t<e.length-1;t++)if(rs(n,r,e[t],e[t+1]))return!0}return!1}function rs(t,e,i,n){return v(t,i,n)!==v(e,i,n)&&v(t,e,i)!==v(t,e,n)}function os(t,e,i){const n=i*i;if(1===e.length)return t.distSqr(e[0])<n;for(let i=1;i<e.length;i++)if(ss(t,e[i-1],e[i])<n)return!0;return!1}function ss(t,e,i){const n=e.distSqr(i);if(0===n)return t.distSqr(e);const r=((t.x-e.x)*(i.x-e.x)+(t.y-e.y)*(i.y-e.y))/n;return t.distSqr(r<0?e:r>1?i:i.sub(e)._mult(r)._add(e))}function as(t,e){let i,n,r,o=!1;for(let s=0;s<t.length;s++){i=t[s];for(let t=0,s=i.length-1;t<i.length;s=t++)n=i[t],r=i[s],n.y>e.y!=r.y>e.y&&e.x<(r.x-n.x)*(e.y-n.y)/(r.y-n.y)+n.x&&(o=!o)}return o}function ls(t,e){let i=!1;for(let n=0,r=t.length-1;n<t.length;r=n++){const o=t[n],s=t[r];o.y>e.y!=s.y>e.y&&e.x<(s.x-o.x)*(e.y-o.y)/(s.y-o.y)+o.x&&(i=!i)}return i}function cs(t,e,i){const n=i[0],r=i[2];if(t.x<n.x&&e.x<n.x||t.x>r.x&&e.x>r.x||t.y<n.y&&e.y<n.y||t.y>r.y&&e.y>r.y)return!1;const o=v(t,e,i[0]);return o!==v(t,e,i[1])||o!==v(t,e,i[2])||o!==v(t,e,i[3])}function hs(t,e,i){const n=e.paint.get(t).value;return"constant"===n.kind?n.value:i.programConfigurations.get(e.id).getMaxValue(t)}function us(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function ps(t,e,i,n,o){if(!e[0]&&!e[1])return t;const s=r.convert(e)._mult(o);"viewport"===i&&s._rotate(-n);const a=[];for(let e=0;e<t.length;e++)a.push(t[e].sub(s));return a}let ds,ms;Cn("CircleBucket",Jo,{omit:["layers"]});var fs={get paint(){return ms=ms||new mr({"circle-radius":new hr(Z.paint_circle["circle-radius"]),"circle-color":new hr(Z.paint_circle["circle-color"]),"circle-blur":new hr(Z.paint_circle["circle-blur"]),"circle-opacity":new hr(Z.paint_circle["circle-opacity"]),"circle-translate":new cr(Z.paint_circle["circle-translate"]),"circle-translate-anchor":new cr(Z.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new cr(Z.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new cr(Z.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new hr(Z.paint_circle["circle-stroke-width"]),"circle-stroke-color":new hr(Z.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new hr(Z.paint_circle["circle-stroke-opacity"])})},get layout(){return ds=ds||new mr({"circle-sort-key":new hr(Z.layout_circle["circle-sort-key"])})}},gs=1e-6,_s="undefined"!=typeof Float32Array?Float32Array:Array;function ys(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function vs(t,e,i){var n=e[0],r=e[1],o=e[2],s=e[3],a=e[4],l=e[5],c=e[6],h=e[7],u=e[8],p=e[9],d=e[10],m=e[11],f=e[12],g=e[13],_=e[14],y=e[15],v=i[0],x=i[1],b=i[2],w=i[3];return t[0]=v*n+x*a+b*u+w*f,t[1]=v*r+x*l+b*p+w*g,t[2]=v*o+x*c+b*d+w*_,t[3]=v*s+x*h+b*m+w*y,t[4]=(v=i[4])*n+(x=i[5])*a+(b=i[6])*u+(w=i[7])*f,t[5]=v*r+x*l+b*p+w*g,t[6]=v*o+x*c+b*d+w*_,t[7]=v*s+x*h+b*m+w*y,t[8]=(v=i[8])*n+(x=i[9])*a+(b=i[10])*u+(w=i[11])*f,t[9]=v*r+x*l+b*p+w*g,t[10]=v*o+x*c+b*d+w*_,t[11]=v*s+x*h+b*m+w*y,t[12]=(v=i[12])*n+(x=i[13])*a+(b=i[14])*u+(w=i[15])*f,t[13]=v*r+x*l+b*p+w*g,t[14]=v*o+x*c+b*d+w*_,t[15]=v*s+x*h+b*m+w*y,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var xs,bs=vs;function ws(t,e,i){var n=e[0],r=e[1],o=e[2],s=e[3];return t[0]=i[0]*n+i[4]*r+i[8]*o+i[12]*s,t[1]=i[1]*n+i[5]*r+i[9]*o+i[13]*s,t[2]=i[2]*n+i[6]*r+i[10]*o+i[14]*s,t[3]=i[3]*n+i[7]*r+i[11]*o+i[15]*s,t}xs=new _s(4),_s!=Float32Array&&(xs[0]=0,xs[1]=0,xs[2]=0,xs[3]=0);class Ts extends gr{constructor(t){super(t,fs)}createBucket(t){return new Jo(t)}queryRadius(t){const e=t;return hs("circle-radius",this,e)+hs("circle-stroke-width",this,e)+us(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,i,n,r,o,s,a){const l=ps(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,s),c=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i),h="map"===this.paint.get("circle-pitch-alignment"),u=h?l:function(t,e){return t.map((t=>Es(t,e)))}(l,a),p=h?c*s:c;for(const t of n)for(const e of t){const t=h?e:Es(e,a);let i=p;const n=ws([],[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]/o.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(i*=o.cameraToCenterDistance/n[3]),ts(u,t,i))return!0}return!1}}function Es(t,e){const i=ws([],[t.x,t.y,0,1],e);return new r(i[0]/i[3],i[1]/i[3])}class Ss extends Jo{}let Ps;Cn("HeatmapBucket",Ss,{omit:["layers"]});var zs={get paint(){return Ps=Ps||new mr({"heatmap-radius":new hr(Z.paint_heatmap["heatmap-radius"]),"heatmap-weight":new hr(Z.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new cr(Z.paint_heatmap["heatmap-intensity"]),"heatmap-color":new dr(Z.paint_heatmap["heatmap-color"]),"heatmap-opacity":new cr(Z.paint_heatmap["heatmap-opacity"])})}};function Cs(t,{width:e,height:i},n,r){if(r){if(r instanceof Uint8ClampedArray)r=new Uint8Array(r.buffer);else if(r.length!==e*i*n)throw new RangeError(`mismatched image size. expected: ${r.length} but got: ${e*i*n}`)}else r=new Uint8Array(e*i*n);return t.width=e,t.height=i,t.data=r,t}function Ms(t,{width:e,height:i},n){if(e===t.width&&i===t.height)return;const r=Cs({},{width:e,height:i},n);Is(t,r,{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=r.data}function Is(t,e,i,n,r,o){if(0===r.width||0===r.height)return e;if(r.width>t.width||r.height>t.height||i.x>t.width-r.width||i.y>t.height-r.height)throw new RangeError("out of range source coordinates for image copy");if(r.width>e.width||r.height>e.height||n.x>e.width-r.width||n.y>e.height-r.height)throw new RangeError("out of range destination coordinates for image copy");const s=t.data,a=e.data;if(s===a)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<r.height;l++){const c=((i.y+l)*t.width+i.x)*o,h=((n.y+l)*e.width+n.x)*o;for(let t=0;t<r.width*o;t++)a[h+t]=s[c+t]}return e}class As{constructor(t,e){Cs(this,t,1,e)}resize(t){Ms(this,t,1)}clone(){return new As({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,n,r){Is(t,e,i,n,r,1)}}class ks{constructor(t,e){Cs(this,t,4,e)}resize(t){Ms(this,t,4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new ks({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,n,r){Is(t,e,i,n,r,4)}}function Ls(t){const e={},i=t.resolution||256,n=t.clips?t.clips.length:1,r=t.image||new ks({width:i,height:n});if(Math.log(i)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${i}`);const o=(i,n,o)=>{e[t.evaluationKey]=o;const s=t.expression.evaluate(e);r.data[i+n+0]=Math.floor(255*s.r/s.a),r.data[i+n+1]=Math.floor(255*s.g/s.a),r.data[i+n+2]=Math.floor(255*s.b/s.a),r.data[i+n+3]=Math.floor(255*s.a)};if(t.clips)for(let e=0,r=0;e<n;++e,r+=4*i)for(let n=0,s=0;n<i;n++,s+=4){const a=n/(i-1),{start:l,end:c}=t.clips[e];o(r,s,l*(1-a)+c*a)}else for(let t=0,e=0;t<i;t++,e+=4)o(0,e,t/(i-1));return r}Cn("AlphaImage",As),Cn("RGBAImage",ks);class Ds extends gr{createBucket(t){return new Ss(t)}constructor(t){super(t,zs),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Ls({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}}let Bs;var Rs={get paint(){return Bs=Bs||new mr({"hillshade-illumination-direction":new cr(Z.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new cr(Z.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new cr(Z.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new cr(Z.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new cr(Z.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new cr(Z.paint_hillshade["hillshade-accent-color"])})}};class Fs extends gr{constructor(t){super(t,Rs)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}}const Os=xr([{name:"a_pos",components:2,type:"Int16"}],4),{members:Us}=Os;var Vs={exports:{}};function Ns(t,e,i){i=i||2;var n,r,o,s,a,l,c,h=e&&e.length,u=h?e[0]*i:t.length,p=Zs(t,0,u,i,!0),d=[];if(!p||p.next===p.prev)return d;if(h&&(p=function(t,e,i,n){var r,o,s,a=[];for(r=0,o=e.length;r<o;r++)(s=Zs(t,e[r]*n,r<o-1?e[r+1]*n:t.length,n,!1))===s.next&&(s.steiner=!0),a.push(Qs(s));for(a.sort(Xs),r=0;r<a.length;r++)i=Ks(a[r],i);return i}(t,e,p,i)),t.length>80*i){n=o=t[0],r=s=t[1];for(var m=i;m<u;m+=i)(a=t[m])<n&&(n=a),(l=t[m+1])<r&&(r=l),a>o&&(o=a),l>s&&(s=l);c=0!==(c=Math.max(o-n,s-r))?32767/c:0}return qs(p,d,i,n,r,c,0),d}function Zs(t,e,i,n,r){var o,s;if(r===pa(t,e,i,n)>0)for(o=e;o<i;o+=n)s=ca(o,t[o],t[o+1],s);else for(o=i-n;o>=e;o-=n)s=ca(o,t[o],t[o+1],s);return s&&na(s,s.next)&&(ha(s),s=s.next),s}function js(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!na(n,n.next)&&0!==ia(n.prev,n,n.next))n=n.next;else{if(ha(n),(n=e=n.prev)===n.next)break;i=!0}}while(i||n!==e);return e}function qs(t,e,i,n,r,o,s){if(t){!s&&o&&function(t,e,i,n){var r=t;do{0===r.z&&(r.z=Js(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,i,n,r,o,s,a,l,c=1;do{for(i=t,t=null,o=null,s=0;i;){for(s++,n=i,a=0,e=0;e<c&&(a++,n=n.nextZ);e++);for(l=c;a>0||l>0&&n;)0!==a&&(0===l||!n||i.z<=n.z)?(r=i,i=i.nextZ,a--):(r=n,n=n.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;i=n}o.nextZ=null,c*=2}while(s>1)}(r)}(t,n,r,o);for(var a,l,c=t;t.prev!==t.next;)if(a=t.prev,l=t.next,o?Gs(t,n,r,o):$s(t))e.push(a.i/i|0),e.push(t.i/i|0),e.push(l.i/i|0),ha(t),t=l.next,c=l.next;else if((t=l)===c){s?1===s?qs(t=Hs(js(t),e,i),e,i,n,r,o,2):2===s&&Ws(t,e,i,n,r,o):qs(js(t),e,i,n,r,o,1);break}}}function $s(t){var e=t.prev,i=t,n=t.next;if(ia(e,i,n)>=0)return!1;for(var r=e.x,o=i.x,s=n.x,a=e.y,l=i.y,c=n.y,h=r<o?r<s?r:s:o<s?o:s,u=a<l?a<c?a:c:l<c?l:c,p=r>o?r>s?r:s:o>s?o:s,d=a>l?a>c?a:c:l>c?l:c,m=n.next;m!==e;){if(m.x>=h&&m.x<=p&&m.y>=u&&m.y<=d&&ta(r,a,o,l,s,c,m.x,m.y)&&ia(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Gs(t,e,i,n){var r=t.prev,o=t,s=t.next;if(ia(r,o,s)>=0)return!1;for(var a=r.x,l=o.x,c=s.x,h=r.y,u=o.y,p=s.y,d=a<l?a<c?a:c:l<c?l:c,m=h<u?h<p?h:p:u<p?u:p,f=a>l?a>c?a:c:l>c?l:c,g=h>u?h>p?h:p:u>p?u:p,_=Js(d,m,e,i,n),y=Js(f,g,e,i,n),v=t.prevZ,x=t.nextZ;v&&v.z>=_&&x&&x.z<=y;){if(v.x>=d&&v.x<=f&&v.y>=m&&v.y<=g&&v!==r&&v!==s&&ta(a,h,l,u,c,p,v.x,v.y)&&ia(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,x.x>=d&&x.x<=f&&x.y>=m&&x.y<=g&&x!==r&&x!==s&&ta(a,h,l,u,c,p,x.x,x.y)&&ia(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;v&&v.z>=_;){if(v.x>=d&&v.x<=f&&v.y>=m&&v.y<=g&&v!==r&&v!==s&&ta(a,h,l,u,c,p,v.x,v.y)&&ia(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;x&&x.z<=y;){if(x.x>=d&&x.x<=f&&x.y>=m&&x.y<=g&&x!==r&&x!==s&&ta(a,h,l,u,c,p,x.x,x.y)&&ia(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Hs(t,e,i){var n=t;do{var r=n.prev,o=n.next.next;!na(r,o)&&ra(r,n,n.next,o)&&aa(r,o)&&aa(o,r)&&(e.push(r.i/i|0),e.push(n.i/i|0),e.push(o.i/i|0),ha(n),ha(n.next),n=t=o),n=n.next}while(n!==t);return js(n)}function Ws(t,e,i,n,r,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&ea(s,a)){var l=la(s,a);return s=js(s,s.next),l=js(l,l.next),qs(s,e,i,n,r,o,0),void qs(l,e,i,n,r,o,0)}a=a.next}s=s.next}while(s!==t)}function Xs(t,e){return t.x-e.x}function Ks(t,e){var i=function(t,e){var i,n=e,r=t.x,o=t.y,s=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var a=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=r&&a>s&&(s=a,i=n.x<n.next.x?n:n.next,a===r))return i}n=n.next}while(n!==e);if(!i)return null;var l,c=i,h=i.x,u=i.y,p=1/0;n=i;do{r>=n.x&&n.x>=h&&r!==n.x&&ta(o<u?r:s,o,h,u,o<u?s:r,o,n.x,n.y)&&(l=Math.abs(o-n.y)/(r-n.x),aa(n,t)&&(l<p||l===p&&(n.x>i.x||n.x===i.x&&Ys(i,n)))&&(i=n,p=l)),n=n.next}while(n!==c);return i}(t,e);if(!i)return e;var n=la(i,t);return js(n,n.next),js(i,i.next)}function Ys(t,e){return ia(t.prev,t,e.prev)<0&&ia(e.next,t,t.next)<0}function Js(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Qs(t){var e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function ta(t,e,i,n,r,o,s,a){return(r-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(n-a)>=(i-s)*(e-a)&&(i-s)*(o-a)>=(r-s)*(n-a)}function ea(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&&ra(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(aa(t,e)&&aa(e,t)&&function(t,e){var i=t,n=!1,r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&r<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(ia(t.prev,t,e.prev)||ia(t,e.prev,e))||na(t,e)&&ia(t.prev,t,t.next)>0&&ia(e.prev,e,e.next)>0)}function ia(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function na(t,e){return t.x===e.x&&t.y===e.y}function ra(t,e,i,n){var r=sa(ia(t,e,i)),o=sa(ia(t,e,n)),s=sa(ia(i,n,t)),a=sa(ia(i,n,e));return r!==o&&s!==a||!(0!==r||!oa(t,i,e))||!(0!==o||!oa(t,n,e))||!(0!==s||!oa(i,t,n))||!(0!==a||!oa(i,e,n))}function oa(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 sa(t){return t>0?1:t<0?-1:0}function aa(t,e){return ia(t.prev,t,t.next)<0?ia(t,e,t.next)>=0&&ia(t,t.prev,e)>=0:ia(t,e,t.prev)<0||ia(t,t.next,e)<0}function la(t,e){var i=new ua(t.i,t.x,t.y),n=new ua(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,o.next=n,n.prev=o,n}function ca(t,e,i,n){var r=new ua(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function ha(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 ua(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 pa(t,e,i,n){for(var r=0,o=e,s=i-n;o<i;o+=n)r+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return r}Vs.exports=Ns,Vs.exports.default=Ns,Ns.deviation=function(t,e,i,n){var r=e&&e.length,o=Math.abs(pa(t,0,r?e[0]*i:t.length,i));if(r)for(var s=0,a=e.length;s<a;s++)o-=Math.abs(pa(t,e[s]*i,s<a-1?e[s+1]*i:t.length,i));var l=0;for(s=0;s<n.length;s+=3){var c=n[s]*i,h=n[s+1]*i,u=n[s+2]*i;l+=Math.abs((t[c]-t[u])*(t[h+1]-t[c+1])-(t[c]-t[h])*(t[u+1]-t[c+1]))}return 0===o&&0===l?0:Math.abs((l-o)/o)},Ns.flatten=function(t){for(var e=t[0][0].length,i={vertices:[],holes:[],dimensions:e},n=0,r=0;r<t.length;r++){for(var o=0;o<t[r].length;o++)for(var s=0;s<e;s++)i.vertices.push(t[r][o][s]);r>0&&i.holes.push(n+=t[r-1].length)}return i};var da=e(Vs.exports);function ma(t,e,i,n,r){fa(t,e,i||0,n||t.length-1,r||_a)}function fa(t,e,i,n,r){for(;n>i;){if(n-i>600){var o=n-i+1,s=e-i+1,a=Math.log(o),l=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*l*(o-l)/o)*(s-o/2<0?-1:1);fa(t,e,Math.max(i,Math.floor(e-s*l/o+c)),Math.min(n,Math.floor(e+(o-s)*l/o+c)),r)}var h=t[e],u=i,p=n;for(ga(t,i,e),r(t[n],h)>0&&ga(t,i,n);u<p;){for(ga(t,u,p),u++,p--;r(t[u],h)<0;)u++;for(;r(t[p],h)>0;)p--}0===r(t[i],h)?ga(t,i,p):ga(t,++p,n),p<=e&&(i=p+1),e<=p&&(n=p-1)}}function ga(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function _a(t,e){return t<e?-1:t>e?1:0}function ya(t,e){const i=t.length;if(i<=1)return[t];const n=[];let r,o;for(let e=0;e<i;e++){const i=x(t[e]);0!==i&&(t[e].area=Math.abs(i),void 0===o&&(o=i<0),o===i<0?(r&&n.push(r),r=[t[e]]):r.push(t[e]))}if(r&&n.push(r),e>1)for(let t=0;t<n.length;t++)n[t].length<=e||(ma(n[t],e,1,n[t].length-1,va),n[t]=n[t].slice(0,e));return n}function va(t,e){return e.area-t.area}function xa(t,e,i){const n=i.patternDependencies;let r=!1;for(const i of e){const e=i.paint.get(`${t}-pattern`);e.isConstant()||(r=!0);const o=e.constantOr(null);o&&(r=!0,n[o.to]=!0,n[o.from]=!0)}return r}function ba(t,e,i,n,r){const o=r.patternDependencies;for(const s of e){const e=s.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:n-1},i,{},r.availableImages),a=e.evaluate({zoom:n},i,{},r.availableImages),l=e.evaluate({zoom:n+1},i,{},r.availableImages);t=t&&t.name?t.name:t,a=a&&a.name?a.name:a,l=l&&l.name?l.name:l,o[t]=!0,o[a]=!0,o[l]=!0,i.patterns[s.id]={min:t,mid:a,max:l}}}return i}class wa{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 oo,this.indexArray=new go,this.indexArray2=new _o,this.programConfigurations=new jo(t.layers,t.zoom),this.segments=new xo,this.segments2=new xo,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.hasPattern=xa("fill",this.layers,e);const n=this.layers[0].layout.get("fill-sort-key"),r=!n.isConstant(),o=[];for(const{feature:s,id:a,index:l,sourceLayerIndex:c}of t){const t=this.layers[0]._featureFilter.needGeometry,h=Ko(s,t);if(!this.layers[0]._featureFilter.filter(new tr(this.zoom),h,i))continue;const u=r?n.evaluate(h,{},i,e.availableImages):void 0,p={id:a,properties:s.properties,type:s.type,sourceLayerIndex:c,index:l,geometry:t?h.geometry:Xo(s),patterns:{},sortKey:u};o.push(p)}r&&o.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of o){const{geometry:r,index:o,sourceLayerIndex:s}=n;if(this.hasPattern){const t=ba("fill",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,r,o,i,{});e.featureIndex.insert(t[o].feature,r,o,s,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,Us),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,r){for(const t of ya(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,r=[],o=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&o.push(r.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),r.push(e[0].x),r.push(e[0].y);for(let t=1;t<e.length;t++)this.layoutVertexArray.emplaceBack(e[t].x,e[t].y),this.indexArray2.emplaceBack(n+t-1,n+t),r.push(e[t].x),r.push(e[t].y);i.vertexLength+=e.length,i.primitiveLength+=e.length}const s=da(r,o);for(let t=0;t<s.length;t+=3)this.indexArray.emplaceBack(n+s[t],n+s[t+1],n+s[t+2]);i.vertexLength+=e,i.primitiveLength+=s.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,r,n)}}let Ta,Ea;Cn("FillBucket",wa,{omit:["layers","patternFeatures"]});var Sa={get paint(){return Ea=Ea||new mr({"fill-antialias":new cr(Z.paint_fill["fill-antialias"]),"fill-opacity":new hr(Z.paint_fill["fill-opacity"]),"fill-color":new hr(Z.paint_fill["fill-color"]),"fill-outline-color":new hr(Z.paint_fill["fill-outline-color"]),"fill-translate":new cr(Z.paint_fill["fill-translate"]),"fill-translate-anchor":new cr(Z.paint_fill["fill-translate-anchor"]),"fill-pattern":new ur(Z.paint_fill["fill-pattern"])})},get layout(){return Ta=Ta||new mr({"fill-sort-key":new hr(Z.layout_fill["fill-sort-key"])})}};class Pa extends gr{constructor(t){super(t,Sa)}recalculate(t,e){super.recalculate(t,e);const i=this.paint._values["fill-outline-color"];"constant"===i.value.kind&&void 0===i.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new wa(t)}queryRadius(){return us(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,i,n,r,o,s){return es(ps(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,s),n)}isTileClipped(){return!0}}const za=xr([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Ca=xr([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Ma}=za;var Ia={},Aa=i,ka=La;function La(t,e,i,n,r){this.properties={},this.extent=i,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=r,t.readFields(Da,this,e)}function Da(t,e,i){1==t?e.id=i.readVarint():2==t?function(t,e){for(var i=t.readVarint()+t.pos;t.pos<i;){var n=e._keys[t.readVarint()],r=e._values[t.readVarint()];e.properties[n]=r}}(i,e):3==t?e.type=i.readVarint():4==t&&(e._geometry=i.pos)}function Ba(t){for(var e,i,n=0,r=0,o=t.length,s=o-1;r<o;s=r++)n+=((i=t[s]).x-(e=t[r]).x)*(e.y+i.y);return n}La.types=["Unknown","Point","LineString","Polygon"],La.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,i=t.readVarint()+t.pos,n=1,r=0,o=0,s=0,a=[];t.pos<i;){if(r<=0){var l=t.readVarint();n=7&l,r=l>>3}if(r--,1===n||2===n)o+=t.readSVarint(),s+=t.readSVarint(),1===n&&(e&&a.push(e),e=[]),e.push(new Aa(o,s));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&a.push(e),a},La.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,i=1,n=0,r=0,o=0,s=1/0,a=-1/0,l=1/0,c=-1/0;t.pos<e;){if(n<=0){var h=t.readVarint();i=7&h,n=h>>3}if(n--,1===i||2===i)(r+=t.readSVarint())<s&&(s=r),r>a&&(a=r),(o+=t.readSVarint())<l&&(l=o),o>c&&(c=o);else if(7!==i)throw new Error("unknown command "+i)}return[s,l,a,c]},La.prototype.toGeoJSON=function(t,e,i){var n,r,o=this.extent*Math.pow(2,i),s=this.extent*t,a=this.extent*e,l=this.loadGeometry(),c=La.types[this.type];function h(t){for(var e=0;e<t.length;e++){var i=t[e];t[e]=[360*(i.x+s)/o-180,360/Math.PI*Math.atan(Math.exp((180-360*(i.y+a)/o)*Math.PI/180))-90]}}switch(this.type){case 1:var u=[];for(n=0;n<l.length;n++)u[n]=l[n][0];h(l=u);break;case 2:for(n=0;n<l.length;n++)h(l[n]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var i,n,r=[],o=0;o<e;o++){var s=Ba(t[o]);0!==s&&(void 0===n&&(n=s<0),n===s<0?(i&&r.push(i),i=[t[o]]):i.push(t[o]))}return i&&r.push(i),r}(l),n=0;n<l.length;n++)for(r=0;r<l[n].length;r++)h(l[n][r])}1===l.length?l=l[0]:c="Multi"+c;var p={type:"Feature",geometry:{type:c,coordinates:l},properties:this.properties};return"id"in this&&(p.id=this.id),p};var Ra=ka,Fa=Oa;function Oa(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Ua,this,e),this.length=this._features.length}function Ua(t,e,i){15===t?e.version=i.readVarint():1===t?e.name=i.readString():5===t?e.extent=i.readVarint():2===t?e._features.push(i.pos):3===t?e._keys.push(i.readString()):4===t&&e._values.push(function(t){for(var e=null,i=t.readVarint()+t.pos;t.pos<i;){var n=t.readVarint()>>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))}Oa.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 Ra(this._pbf,e,this.extent,this._keys,this._values)};var Va=Fa;function Na(t,e,i){if(3===t){var n=new Va(i,i.readVarint()+i.pos);n.length&&(e[n.name]=n)}}Ia.VectorTile=function(t,e){this.layers=t.readFields(Na,{},e)},Ia.VectorTileFeature=ka,Ia.VectorTileLayer=Fa;const Za=Ia.VectorTileFeature.types,ja=Math.pow(2,13);function qa(t,e,i,n,r,o,s,a){t.emplaceBack(e,i,2*Math.floor(n*ja)+s,r*ja*2,o*ja*2,Math.round(a))}class $a{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 so,this.centroidVertexArray=new no,this.indexArray=new go,this.programConfigurations=new jo(t.layers,t.zoom),this.segments=new xo,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.features=[],this.hasPattern=xa("fill-extrusion",this.layers,e);for(const{feature:n,id:r,index:o,sourceLayerIndex:s}of t){const t=this.layers[0]._featureFilter.needGeometry,a=Ko(n,t);if(!this.layers[0]._featureFilter.filter(new tr(this.zoom),a,i))continue;const l={id:r,sourceLayerIndex:s,index:o,geometry:t?a.geometry:Xo(n),properties:n.properties,type:n.type,patterns:{}};this.hasPattern?this.features.push(ba("fill-extrusion",this.layers,l,this.zoom,e)):this.addFeature(l,l.geometry,o,i,{}),e.featureIndex.insert(n,l.geometry,o,s,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,Ma),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Ca.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,r){const o={x:0,y:0,vertexCount:0};for(const i of ya(e,500)){let e=0;for(const t of i)e+=t.length;let n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const t of i){if(0===t.length)continue;if(Ha(t))continue;let e=0;for(let i=0;i<t.length;i++){const r=t[i];if(i>=1){const s=t[i-1];if(!Ga(r,s)){n.vertexLength+4>xo.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const t=r.sub(s)._perp()._unit(),i=s.dist(r);e+i>32768&&(e=0),qa(this.layoutVertexArray,r.x,r.y,t.x,t.y,0,0,e),qa(this.layoutVertexArray,r.x,r.y,t.x,t.y,0,1,e),o.x+=2*r.x,o.y+=2*r.y,o.vertexCount+=2,e+=i,qa(this.layoutVertexArray,s.x,s.y,t.x,t.y,0,0,e),qa(this.layoutVertexArray,s.x,s.y,t.x,t.y,0,1,e),o.x+=2*s.x,o.y+=2*s.y,o.vertexCount+=2;const a=n.vertexLength;this.indexArray.emplaceBack(a,a+2,a+1),this.indexArray.emplaceBack(a+1,a+2,a+3),n.vertexLength+=4,n.primitiveLength+=2}}}}if(n.vertexLength+e>xo.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray)),"Polygon"!==Za[t.type])continue;const r=[],s=[],a=n.vertexLength;for(const t of i)if(0!==t.length){t!==i[0]&&s.push(r.length/2);for(let e=0;e<t.length;e++){const i=t[e];qa(this.layoutVertexArray,i.x,i.y,0,0,1,1,0),o.x+=i.x,o.y+=i.y,o.vertexCount+=1,r.push(i.x),r.push(i.y)}}const l=da(r,s);for(let t=0;t<l.length;t+=3)this.indexArray.emplaceBack(a+l[t],a+l[t+2],a+l[t+1]);n.primitiveLength+=l.length/3,n.vertexLength+=e}for(let t=0;t<o.vertexCount;t++)this.centroidVertexArray.emplaceBack(Math.floor(o.x/o.vertexCount),Math.floor(o.y/o.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,r,n)}}function Ga(t,e){return t.x===e.x&&(t.x<0||t.x>Go)||t.y===e.y&&(t.y<0||t.y>Go)}function Ha(t){return t.every((t=>t.x<0))||t.every((t=>t.x>Go))||t.every((t=>t.y<0))||t.every((t=>t.y>Go))}let Wa;Cn("FillExtrusionBucket",$a,{omit:["layers","features"]});var Xa={get paint(){return Wa=Wa||new mr({"fill-extrusion-opacity":new cr(Z["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new hr(Z["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new cr(Z["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new cr(Z["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ur(Z["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new hr(Z["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new hr(Z["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new cr(Z["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Ka extends gr{constructor(t){super(t,Xa)}createBucket(t){return new $a(t)}queryRadius(){return us(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,e,i,n,o,s,a,l){const c=ps(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),s.angle,a),h=this.paint.get("fill-extrusion-height").evaluate(e,i),u=this.paint.get("fill-extrusion-base").evaluate(e,i),p=function(t,e,i,n){const o=[];for(const i of t){const t=[i.x,i.y,0,1];ws(t,t,e),o.push(new r(t[0]/t[3],t[1]/t[3]))}return o}(c,l),d=function(t,e,i,n){const o=[],s=[],a=n[8]*e,l=n[9]*e,c=n[10]*e,h=n[11]*e,u=n[8]*i,p=n[9]*i,d=n[10]*i,m=n[11]*i;for(const e of t){const t=[],i=[];for(const o of e){const e=o.x,s=o.y,f=n[0]*e+n[4]*s+n[12],g=n[1]*e+n[5]*s+n[13],_=n[2]*e+n[6]*s+n[14],y=n[3]*e+n[7]*s+n[15],v=_+c,x=y+h,b=f+u,w=g+p,T=_+d,E=y+m,S=new r((f+a)/x,(g+l)/x);S.z=v/x,t.push(S);const P=new r(b/E,w/E);P.z=T/E,i.push(P)}o.push(t),s.push(i)}return[o,s]}(n,u,h,l);return function(t,e,i){let n=1/0;es(i,e)&&(n=Ja(i,e[0]));for(let r=0;r<e.length;r++){const o=e[r],s=t[r];for(let t=0;t<o.length-1;t++){const e=o[t],r=[e,o[t+1],s[t+1],s[t],e];Qo(i,r)&&(n=Math.min(n,Ja(i,r)))}}return n!==1/0&&n}(d[0],d[1],p)}}function Ya(t,e){return t.x*e.x+t.y*e.y}function Ja(t,e){if(1===t.length){let i=0;const n=e[i++];let r;for(;!r||n.equals(r);)if(r=e[i++],!r)return 1/0;for(;i<e.length;i++){const o=e[i],s=t[0],a=r.sub(n),l=o.sub(n),c=s.sub(n),h=Ya(a,a),u=Ya(a,l),p=Ya(l,l),d=Ya(c,a),m=Ya(c,l),f=h*p-u*u,g=(p*d-u*m)/f,_=(h*m-u*d)/f,y=n.z*(1-g-_)+r.z*g+o.z*_;if(isFinite(y))return y}return 1/0}{let t=1/0;for(const i of e)t=Math.min(t,i.z);return t}}const Qa=xr([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:tl}=Qa,el=xr([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:il}=el,nl=Ia.VectorTileFeature.types,rl=Math.cos(Math.PI/180*37.5),ol=Math.pow(2,14)/.5;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.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={}})),this.layoutVertexArray=new ao,this.layoutVertexArray2=new lo,this.indexArray=new go,this.programConfigurations=new jo(t.layers,t.zoom),this.segments=new xo,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.hasPattern=xa("line",this.layers,e);const n=this.layers[0].layout.get("line-sort-key"),r=!n.isConstant(),o=[];for(const{feature:e,id:s,index:a,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Ko(e,t);if(!this.layers[0]._featureFilter.filter(new tr(this.zoom),c,i))continue;const h=r?n.evaluate(c,{},i):void 0,u={id:s,properties:e.properties,type:e.type,sourceLayerIndex:l,index:a,geometry:t?c.geometry:Xo(e),patterns:{},sortKey:h};o.push(u)}r&&o.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of o){const{geometry:r,index:o,sourceLayerIndex:s}=n;if(this.hasPattern){const t=ba("line",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,r,o,i,{});e.featureIndex.insert(t[o].feature,r,o,s,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,il)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,tl),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,r){const o=this.layers[0].layout,s=o.get("line-join").evaluate(t,{}),a=o.get("line-cap"),l=o.get("line-miter-limit"),c=o.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const i of e)this.addLine(i,t,s,a,l,c);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,r,n)}addLine(t,e,i,n,r,o){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e<t.length-1;e++)this.totalDistance+=t[e].dist(t[e+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const s="Polygon"===nl[e.type];let a=t.length;for(;a>=2&&t[a-1].equals(t[a-2]);)a--;let l=0;for(;l<a-1&&t[l].equals(t[l+1]);)l++;if(a<(s?3:2))return;"bevel"===i&&(r=1.05);const c=this.overscaling<=16?15*Go/(512*this.overscaling):0,h=this.segments.prepareSegment(10*a,this.layoutVertexArray,this.indexArray);let u,p,d,m,f;this.e1=this.e2=-1,s&&(u=t[a-2],f=t[l].sub(u)._unit()._perp());for(let e=l;e<a;e++){if(d=e===a-1?s?t[l+1]:void 0:t[e+1],d&&t[e].equals(d))continue;f&&(m=f),u&&(p=u),u=t[e],f=d?d.sub(u)._unit()._perp():m,m=m||f;let g=m.add(f);0===g.x&&0===g.y||g._unit();const _=m.x*f.x+m.y*f.y,y=g.x*f.x+g.y*f.y,v=0!==y?1/y:1/0,x=2*Math.sqrt(2-2*y),b=y<rl&&p&&d,w=m.x*f.y-m.y*f.x>0;if(b&&e>l){const t=u.dist(p);if(t>2*c){const e=u.sub(u.sub(p)._mult(c/t)._round());this.updateDistance(p,e),this.addCurrentVertex(e,m,0,0,h),p=e}}const T=p&&d;let E=T?i:s?"butt":n;if(T&&"round"===E&&(v<o?E="miter":v<=2&&(E="fakeround")),"miter"===E&&v>r&&(E="bevel"),"bevel"===E&&(v>2&&(E="flipbevel"),v<r&&(E="miter")),p&&this.updateDistance(p,u),"miter"===E)g._mult(v),this.addCurrentVertex(u,g,0,0,h);else if("flipbevel"===E){if(v>100)g=f.mult(-1);else{const t=v*m.add(f).mag()/m.sub(f).mag();g._perp()._mult(t*(w?-1:1))}this.addCurrentVertex(u,g,0,0,h),this.addCurrentVertex(u,g.mult(-1),0,0,h)}else if("bevel"===E||"fakeround"===E){const t=-Math.sqrt(v*v-1),e=w?t:0,i=w?0:t;if(p&&this.addCurrentVertex(u,m,e,i,h),"fakeround"===E){const t=Math.round(180*x/Math.PI/20);for(let e=1;e<t;e++){let i=e/t;if(.5!==i){const t=i-.5;i+=i*t*(i-1)*((1.0904+_*(_*(3.55645-1.43519*_)-3.2452))*t*t+(.848013+_*(.215638*_-1.06021)))}const n=f.sub(m)._mult(i)._add(m)._unit()._mult(w?-1:1);this.addHalfVertex(u,n.x,n.y,!1,w,0,h)}}d&&this.addCurrentVertex(u,f,-e,-i,h)}else if("butt"===E)this.addCurrentVertex(u,g,0,0,h);else if("square"===E){const t=p?1:-1;this.addCurrentVertex(u,g,t,t,h)}else"round"===E&&(p&&(this.addCurrentVertex(u,m,0,0,h),this.addCurrentVertex(u,m,1,1,h,!0)),d&&(this.addCurrentVertex(u,f,-1,-1,h,!0),this.addCurrentVertex(u,f,0,0,h)));if(b&&e<a-1){const t=u.dist(d);if(t>2*c){const e=u.add(d.sub(u)._mult(c/t)._round());this.updateDistance(u,e),this.addCurrentVertex(e,f,0,0,h),u=e}}}}addCurrentVertex(t,e,i,n,r,o=!1){const s=e.y*n-e.x,a=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*i,e.y-e.x*i,o,!1,i,r),this.addHalfVertex(t,s,a,o,!0,-n,r),this.distance>ol/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,i,n,r,o))}addHalfVertex({x:t,y:e},i,n,r,o,s,a){const l=.5*(this.lineClips?this.scaledDistance*(ol-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(r?1:0),(e<<1)+(o?1:0),Math.round(63*i)+128,Math.round(63*n)+128,1+(0===s?0:s<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++),o?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 al,ll;Cn("LineBucket",sl,{omit:["layers","patternFeatures"]});var cl={get paint(){return ll=ll||new mr({"line-opacity":new hr(Z.paint_line["line-opacity"]),"line-color":new hr(Z.paint_line["line-color"]),"line-translate":new cr(Z.paint_line["line-translate"]),"line-translate-anchor":new cr(Z.paint_line["line-translate-anchor"]),"line-width":new hr(Z.paint_line["line-width"]),"line-gap-width":new hr(Z.paint_line["line-gap-width"]),"line-offset":new hr(Z.paint_line["line-offset"]),"line-blur":new hr(Z.paint_line["line-blur"]),"line-dasharray":new pr(Z.paint_line["line-dasharray"]),"line-pattern":new ur(Z.paint_line["line-pattern"]),"line-gradient":new dr(Z.paint_line["line-gradient"])})},get layout(){return al=al||new mr({"line-cap":new cr(Z.layout_line["line-cap"]),"line-join":new hr(Z.layout_line["line-join"]),"line-miter-limit":new cr(Z.layout_line["line-miter-limit"]),"line-round-limit":new cr(Z.layout_line["line-round-limit"]),"line-sort-key":new hr(Z.layout_line["line-sort-key"])})}};class hl extends hr{possiblyEvaluate(t,e){return e=new tr(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=p({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,i,n)}}let ul;class pl extends gr{constructor(t){super(t,cl),this.gradientVersion=0,ul||(ul=new hl(cl.paint.properties["line-width"].specification),ul.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){"line-gradient"===t&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof De,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"]=ul.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new sl(t)}queryRadius(t){const e=t,i=dl(hs("line-width",this,e),hs("line-gap-width",this,e)),n=hs("line-offset",this,e);return i/2+Math.abs(n)+us(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,i,n,o,s,a){const l=ps(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),s.angle,a),c=a/2*dl(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),h=this.paint.get("line-offset").evaluate(e,i);return h&&(n=function(t,e){const i=[];for(let n=0;n<t.length;n++){const o=t[n],s=[];for(let t=0;t<o.length;t++){const i=o[t-1],n=o[t],a=o[t+1],l=0===t?new r(0,0):n.sub(i)._unit()._perp(),c=t===o.length-1?new r(0,0):a.sub(n)._unit()._perp(),h=l._add(c)._unit(),u=h.x*c.x+h.y*c.y;0!==u&&h._mult(1/u),s.push(h._mult(e)._add(n))}i.push(s)}return i}(n,h*a)),function(t,e,i){for(let n=0;n<e.length;n++){const r=e[n];if(t.length>=3)for(let e=0;e<r.length;e++)if(ls(t,r[e]))return!0;if(is(t,r,i))return!0}return!1}(l,n,c)}isTileClipped(){return!0}}function dl(t,e){return e>0?e+2*t:t}const ml=xr([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),fl=xr([{name:"a_projected_pos",components:3,type:"Float32"}],4);xr([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const gl=xr([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);xr([{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=xr([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),yl=xr([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function vl(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()),Qn.applyArabicShaping&&(t=Qn.applyArabicShaping(t)),t}(t.text,e,i)})),t}xr([{name:"triangle",components:3,type:"Uint16"}]),xr([{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"}]),xr([{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"}]),xr([{type:"Float32",name:"offsetX"}]),xr([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),xr([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const xl={"!":"︕","#":"＃",$:"＄","%":"％","&":"＆","(":"︵",")":"︶","*":"＊","+":"＋",",":"︐","-":"︲",".":"・","/":"／",":":"︓",";":"︔","<":"︿","=":"＝",">":"﹀","?":"︖","@":"＠","[":"﹇","\\":"＼","]":"﹈","^":"＾",_:"︳","`":"｀","{":"︷","|":"―","}":"︸","~":"～","¢":"￠","£":"￡","¥":"￥","¦":"￤","¬":"￢","¯":"￣","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"￦","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","！":"︕","（":"︵","）":"︶","，":"︐","－":"︲","．":"・","：":"︓","；":"︔","＜":"︿","＞":"﹀","？":"︖","［":"﹇","］":"﹈","＿":"︳","｛":"︷","｜":"―","｝":"︸","｟":"︵","｠":"︶","｡":"︒","｢":"﹁","｣":"﹂"};var bl=24,wl=Sl,Tl=function(t,e,i,n,r){var o,s,a=8*r-n-1,l=(1<<a)-1,c=l>>1,h=-7,u=i?r-1:0,p=i?-1:1,d=t[e+u];for(u+=p,o=d&(1<<-h)-1,d>>=-h,h+=a;h>0;o=256*o+t[e+u],u+=p,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+t[e+u],u+=p,h-=8);if(0===o)o=1-c;else{if(o===l)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=c}return(d?-1:1)*s*Math.pow(2,o-n)},El=function(t,e,i,n,r,o){var s,a,l,c=8*o-r-1,h=(1<<c)-1,u=h>>1,p=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,m=n?1:-1,f=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+u>=1?p/l:p*Math.pow(2,1-u))*l>=2&&(s++,l/=2),s+u>=h?(a=0,s=h):s+u>=1?(a=(e*l-1)*Math.pow(2,r),s+=u):(a=e*Math.pow(2,u-1)*Math.pow(2,r),s=0));r>=8;t[i+d]=255&a,d+=m,a/=256,r-=8);for(s=s<<r|a,c+=r;c>0;t[i+d]=255&s,d+=m,s/=256,c-=8);t[i+d-m]|=128*f};function Sl(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Sl.Varint=0,Sl.Fixed64=1,Sl.Bytes=2,Sl.Fixed32=5;var Pl=4294967296,zl=1/Pl,Cl="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Ml(t){return t.type===Sl.Bytes?t.readVarint()+t.pos:t.pos+1}function Il(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Al(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 r=i.pos-1;r>=t;r--)i.buf[r+n]=i.buf[r]}function kl(t,e){for(var i=0;i<t.length;i++)e.writeVarint(t[i])}function Ll(t,e){for(var i=0;i<t.length;i++)e.writeSVarint(t[i])}function Dl(t,e){for(var i=0;i<t.length;i++)e.writeFloat(t[i])}function Bl(t,e){for(var i=0;i<t.length;i++)e.writeDouble(t[i])}function Rl(t,e){for(var i=0;i<t.length;i++)e.writeBoolean(t[i])}function Fl(t,e){for(var i=0;i<t.length;i++)e.writeFixed32(t[i])}function Ol(t,e){for(var i=0;i<t.length;i++)e.writeSFixed32(t[i])}function Ul(t,e){for(var i=0;i<t.length;i++)e.writeFixed64(t[i])}function Vl(t,e){for(var i=0;i<t.length;i++)e.writeSFixed64(t[i])}function Nl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function Zl(t,e,i){t[i]=e,t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function jl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}Sl.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos<i;){var n=this.readVarint(),r=n>>3,o=this.pos;this.type=7&n,t(r,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Nl(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=jl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Nl(this.buf,this.pos)+Nl(this.buf,this.pos+4)*Pl;return this.pos+=8,t},readSFixed64:function(){var t=Nl(this.buf,this.pos)+jl(this.buf,this.pos+4)*Pl;return this.pos+=8,t},readFloat:function(){var t=Tl(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Tl(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,r,o=i.buf;if(n=(112&(r=o[i.pos++]))>>4,r<128)return Il(t,n,e);if(n|=(127&(r=o[i.pos++]))<<3,r<128)return Il(t,n,e);if(n|=(127&(r=o[i.pos++]))<<10,r<128)return Il(t,n,e);if(n|=(127&(r=o[i.pos++]))<<17,r<128)return Il(t,n,e);if(n|=(127&(r=o[i.pos++]))<<24,r<128)return Il(t,n,e);if(n|=(1&(r=o[i.pos++]))<<31,r<128)return Il(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&&Cl?function(t,e,i){return Cl.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){for(var n="",r=e;r<i;){var o,s,a,l=t[r],c=null,h=l>239?4:l>223?3:l>191?2:1;if(r+h>i)break;1===h?l<128&&(c=l):2===h?128==(192&(o=t[r+1]))&&(c=(31&l)<<6|63&o)<=127&&(c=null):3===h?(s=t[r+2],128==(192&(o=t[r+1]))&&128==(192&s)&&((c=(15&l)<<12|(63&o)<<6|63&s)<=2047||c>=55296&&c<=57343)&&(c=null)):4===h&&(s=t[r+2],a=t[r+3],128==(192&(o=t[r+1]))&&128==(192&s)&&128==(192&a)&&((c=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,h=1):c>65535&&(c-=65536,n+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),n+=String.fromCharCode(c),r+=h}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!==Sl.Bytes)return t.push(this.readVarint(e));var i=Ml(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==Sl.Bytes)return t.push(this.readSVarint());var e=Ml(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==Sl.Bytes)return t.push(this.readBoolean());var e=Ml(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==Sl.Bytes)return t.push(this.readFloat());var e=Ml(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==Sl.Bytes)return t.push(this.readDouble());var e=Ml(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==Sl.Bytes)return t.push(this.readFixed32());var e=Ml(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==Sl.Bytes)return t.push(this.readSFixed32());var e=Ml(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==Sl.Bytes)return t.push(this.readFixed64());var e=Ml(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==Sl.Bytes)return t.push(this.readSFixed64());var e=Ml(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===Sl.Varint)for(;this.buf[this.pos++]>127;);else if(e===Sl.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Sl.Fixed32)this.pos+=4;else{if(e!==Sl.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;e<this.pos+t;)e*=2;if(e!==this.length){var i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Zl(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Zl(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Zl(this.buf,-1&t,this.pos),Zl(this.buf,Math.floor(t*zl),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Zl(this.buf,-1&t,this.pos),Zl(this.buf,Math.floor(t*zl),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||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,r,o=0;o<e.length;o++){if((n=e.charCodeAt(o))>55295&&n<57344){if(!r){n>56319||o+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&Al(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),El(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),El(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<e;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,e){this.pos++;var i=this.pos;t(e,this);var n=this.pos-i;n>=128&&Al(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,i){this.writeTag(t,Sl.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,kl,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Ll,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Rl,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Dl,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Bl,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Fl,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Ol,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Ul,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Vl,e)},writeBytesField:function(t,e){this.writeTag(t,Sl.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Sl.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Sl.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Sl.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Sl.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Sl.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Sl.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Sl.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Sl.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Sl.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var ql=e(wl);function $l(t,e,i){1===t&&i.readMessage(Gl,e)}function Gl(t,e,i){if(3===t){const{id:t,bitmap:n,width:r,height:o,left:s,top:a,advance:l}=i.readMessage(Hl,{});e.push({id:t,bitmap:new As({width:r+6,height:o+6},n),metrics:{width:r,height:o,left:s,top:a,advance:l}})}}function Hl(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())}function Wl(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 r=0,o=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,o=Math.max(o,e.y+e.h),r=Math.max(r,e.x+e.w),e.w===i.w&&e.h===i.h){const e=n.pop();t<n.length&&(n[t]=e)}else e.h===i.h?(i.x+=e.w,i.w-=e.w):e.w===i.w?(i.y+=e.h,i.h-=e.h):(n.push({x:i.x+e.w,y:i.y,w:i.w-e.w,h:e.h}),i.y+=e.h,i.h-=e.h);break}}return{w:r,h:o,fill:e/(r*o)||0}}class Xl{constructor(t,{pixelRatio:e,version:i,stretchX:n,stretchY:r,content:o}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=n,this.stretchY=r,this.content=o,this.version=i}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Kl{constructor(t,e){const i={},n={};this.haveRenderCallbacks=[];const r=[];this.addImages(t,i,r),this.addImages(e,n,r);const{w:o,h:s}=Wl(r),a=new ks({width:o||1,height:s||1});for(const e in t){const n=t[e],r=i[e].paddedRect;ks.copy(n.data,a,{x:0,y:0},{x:r.x+1,y:r.y+1},n.data)}for(const t in e){const i=e[t],r=n[t].paddedRect,o=r.x+1,s=r.y+1,l=i.data.width,c=i.data.height;ks.copy(i.data,a,{x:0,y:0},{x:o,y:s},i.data),ks.copy(i.data,a,{x:0,y:c-1},{x:o,y:s-1},{width:l,height:1}),ks.copy(i.data,a,{x:0,y:0},{x:o,y:s+c},{width:l,height:1}),ks.copy(i.data,a,{x:l-1,y:0},{x:o-1,y:s},{width:1,height:c}),ks.copy(i.data,a,{x:0,y:0},{x:o+l,y:s},{width:1,height:c})}this.image=a,this.iconPositions=i,this.patternPositions=n}addImages(t,e,i){for(const n in t){const r=t[n],o={x:0,y:0,w:r.data.width+2,h:r.data.height+2};i.push(o),e[n]=new Xl(o,r),r.hasRenderCallback&&this.haveRenderCallbacks.push(n)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const i in t.updatedImages)this.patchUpdatedImage(this.iconPositions[i],t.getImage(i),e),this.patchUpdatedImage(this.patternPositions[i],t.getImage(i),e)}patchUpdatedImage(t,e,i){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[n,r]=t.tl;i.update(e.data,void 0,{x:n,y:r})}}var Yl;Cn("ImagePosition",Xl),Cn("ImageAtlas",Kl),t.WritingMode=void 0,(Yl=t.WritingMode||(t.WritingMode={}))[Yl.none=0]="none",Yl[Yl.horizontal=1]="horizontal",Yl[Yl.vertical=2]="vertical",Yl[Yl.horizontalOnly=3]="horizontalOnly";const Jl=-17;class Ql{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,e){const i=new Ql;return i.scale=t||1,i.fontStack=e,i}static forImage(t){const e=new Ql;return e.imageName=t,e}}class tc{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e){const i=new tc;for(let n=0;n<t.sections.length;n++){const r=t.sections[n];r.image?i.addImageSection(r):i.addTextSection(r,e)}return i}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let e="";for(let i=0;i<t.length;i++){const n=t.charCodeAt(i+1)||null,r=t.charCodeAt(i-1)||null;e+=n&&On(n)&&!xl[t[i+1]]||r&&On(r)&&!xl[t[i-1]]||!xl[t[i]]?t[i]:xl[t[i]]}return e}(this.text)}trim(){let t=0;for(let e=0;e<this.text.length&&ic[this.text.charCodeAt(e)];e++)t++;let e=this.text.length;for(let i=this.text.length-1;i>=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 tc;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(Ql.forText(t.scale,t.fontStack||e));const i=this.sections.length-1;for(let e=0;e<t.text.length;++e)this.sectionIndex.push(i)}addImageSection(t){const e=t.image?t.image.name:"";if(0===e.length)return void y("Can't add FormattedSection with an empty image.");const i=this.getNextImageSectionCharCode();i?(this.text+=String.fromCharCode(i),this.sections.push(Ql.forImage(e)),this.sectionIndex.push(this.sections.length-1)):y("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function ec(e,i,n,r,o,s,a,l,c,h,u,p,d,m,f,g){const _=tc.fromFeature(e,o);let y;p===t.WritingMode.vertical&&_.verticalizePunctuation();const{processBidirectionalText:v,processStyledBidirectionalText:x}=Qn;if(v&&1===_.sections.length){y=[];const t=v(_.toString(),cc(_,h,s,i,r,m,f));for(const e of t){const t=new tc;t.text=e,t.sections=_.sections;for(let i=0;i<e.length;i++)t.sectionIndex.push(0);y.push(t)}}else if(x){y=[];const t=x(_.text,_.sectionIndex,cc(_,h,s,i,r,m,f));for(const e of t){const t=new tc;t.text=e[0],t.sectionIndex=e[1],t.sections=_.sections,y.push(t)}}else y=function(t,e){const i=[],n=t.text;let r=0;for(const n of e)i.push(t.substring(r,n)),r=n;return r<n.length&&i.push(t.substring(r,n.length)),i}(_,cc(_,h,s,i,r,m,f));const b=[],w={positionedLines:b,text:_.toString(),top:u[1],bottom:u[1],left:u[0],right:u[0],writingMode:p,iconsInText:!1,verticalizable:!1};return function(e,i,n,r,o,s,a,l,c,h,u,p){let d=0,m=Jl,f=0,g=0;const _="right"===l?1:"left"===l?0:.5;let y=0;for(const a of o){a.trim();const o=a.getMaxScale(),l=(o-1)*bl,x={positionedGlyphs:[],lineOffset:0};e.positionedLines[y]=x;const b=x.positionedGlyphs;let w=0;if(!a.length()){m+=s,++y;continue}for(let s=0;s<a.length();s++){const f=a.getSection(s),g=a.getSectionIndex(s),_=a.getCharCode(s);let y=0,x=null,T=null,E=null,S=bl;const P=!(c===t.WritingMode.horizontal||!u&&!Fn(_)||u&&(ic[_]||(v=_,Ln.Arabic(v)||Ln["Arabic Supplement"](v)||Ln["Arabic Extended-A"](v)||Ln["Arabic Presentation Forms-A"](v)||Ln["Arabic Presentation Forms-B"](v))));if(f.imageName){const t=r[f.imageName];if(!t)continue;E=f.imageName,e.iconsInText=e.iconsInText||!0,T=t.paddedRect;const i=t.displaySize;f.scale=f.scale*bl/p,x={width:i[0],height:i[1],left:1,top:-3,advance:P?i[1]:i[0]},y=l+(bl-i[1]*f.scale),S=x.advance;const n=P?i[0]*f.scale-bl*o:i[1]*f.scale-bl*o;n>0&&n>w&&(w=n)}else{const t=n[f.fontStack],e=t&&t[_];if(e&&e.rect)T=e.rect,x=e.metrics;else{const t=i[f.fontStack],e=t&&t[_];if(!e)continue;x=e.metrics}y=(o-f.scale)*bl}P?(e.verticalizable=!0,b.push({glyph:_,imageName:E,x:d,y:m+y,vertical:P,scale:f.scale,fontStack:f.fontStack,sectionIndex:g,metrics:x,rect:T}),d+=S*f.scale+h):(b.push({glyph:_,imageName:E,x:d,y:m+y,vertical:P,scale:f.scale,fontStack:f.fontStack,sectionIndex:g,metrics:x,rect:T}),d+=x.advance*f.scale+h)}0!==b.length&&(f=Math.max(d-h,f),uc(b,0,b.length-1,_,w)),d=0;const T=s*o+w;x.lineOffset=Math.max(w,l),m+=T,g=Math.max(T,g),++y}var v;const x=m-Jl,{horizontalAlign:b,verticalAlign:w}=hc(a);(function(t,e,i,n,r,o,s,a,l){const c=(e-i)*r;let h=0;h=o!==s?-a*n-Jl:(-n*l+.5)*s;for(const e of t)for(const t of e.positionedGlyphs)t.x+=c,t.y+=h})(e.positionedLines,_,b,w,f,g,s,x,o.length),e.top+=-w*x,e.bottom=e.top+x,e.left+=-b*f,e.right=e.left+f}(w,i,n,r,y,a,l,c,p,h,d,g),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(b)&&w}const ic={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},nc={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 rc(t,e,i,n,r,o){if(e.imageName){const t=n[e.imageName];return t?t.displaySize[0]*e.scale*bl/o+r:0}{const n=i[e.fontStack],o=n&&n[t];return o?o.metrics.advance*e.scale+r:0}}function oc(t,e,i,n){const r=Math.pow(t-e,2);return n?t<e?r/2:2*r:r+Math.abs(i)*i}function sc(t,e,i){let n=0;return 10===t&&(n-=1e4),i&&(n+=150),40!==t&&65288!==t||(n+=50),41!==e&&65289!==e||(n+=50),n}function ac(t,e,i,n,r,o){let s=null,a=oc(e,i,r,o);for(const t of n){const n=oc(e-t.x,i,r,o)+t.badness;n<=a&&(s=t,a=n)}return{index:t,x:e,priorBreak:s,badness:a}}function lc(t){return t?lc(t.priorBreak).concat(t.index):[]}function cc(t,e,i,n,r,o,s){if("point"!==o)return[];if(!t)return[];const a=[],l=function(t,e,i,n,r,o){let s=0;for(let i=0;i<t.length();i++){const a=t.getSection(i);s+=rc(t.getCharCode(i),a,n,r,e,o)}return s/Math.max(1,Math.ceil(s/i))}(t,e,i,n,r,s),c=t.text.indexOf("​")>=0;let h=0;for(let i=0;i<t.length();i++){const o=t.getSection(i),p=t.getCharCode(i);if(ic[p]||(h+=rc(p,o,n,r,e,s)),i<t.length()-1){const e=!((u=p)<11904||!(Ln["Bopomofo Extended"](u)||Ln.Bopomofo(u)||Ln["CJK Compatibility Forms"](u)||Ln["CJK Compatibility Ideographs"](u)||Ln["CJK Compatibility"](u)||Ln["CJK Radicals Supplement"](u)||Ln["CJK Strokes"](u)||Ln["CJK Symbols and Punctuation"](u)||Ln["CJK Unified Ideographs Extension A"](u)||Ln["CJK Unified Ideographs"](u)||Ln["Enclosed CJK Letters and Months"](u)||Ln["Halfwidth and Fullwidth Forms"](u)||Ln.Hiragana(u)||Ln["Ideographic Description Characters"](u)||Ln["Kangxi Radicals"](u)||Ln["Katakana Phonetic Extensions"](u)||Ln.Katakana(u)||Ln["Vertical Forms"](u)||Ln["Yi Radicals"](u)||Ln["Yi Syllables"](u)));(nc[p]||e||o.imageName)&&a.push(ac(i+1,h,l,a,sc(p,t.getCharCode(i+1),e&&c),!1))}}var u;return lc(ac(t.length(),h,l,a,0,!0))}function hc(t){let e=.5,i=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function uc(t,e,i,n,r){if(!n&&!r)return;const o=t[i],s=(t[i].x+o.metrics.advance*o.scale)*n;for(let n=e;n<=i;n++)t[n].x-=s,t[n].y+=r}function pc(t,e,i){const{horizontalAlign:n,verticalAlign:r}=hc(i),o=e[0]-t.displaySize[0]*n,s=e[1]-t.displaySize[1]*r;return{image:t,top:s,bottom:s+t.displaySize[1],left:o,right:o+t.displaySize[0]}}function dc(t,e,i,n,r,o){const s=t.image;let a;if(s.content){const t=s.content,e=s.pixelRatio||1;a=[t[0]/e,t[1]/e,s.displaySize[0]-t[2]/e,s.displaySize[1]-t[3]/e]}const l=e.left*o,c=e.right*o;let h,u,p,d;"width"===i||"both"===i?(d=r[0]+l-n[3],u=r[0]+c+n[1]):(d=r[0]+(l+c-s.displaySize[0])/2,u=d+s.displaySize[0]);const m=e.top*o,f=e.bottom*o;return"height"===i||"both"===i?(h=r[1]+m-n[0],p=r[1]+f+n[2]):(h=r[1]+(m+f-s.displaySize[1])/2,p=h+s.displaySize[1]),{image:s,top:h,right:u,bottom:p,left:d,collisionPadding:a}}const mc=128,fc=32640;function gc(t,e){const{expression:i}=e;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new tr(t+1))};if("source"===i.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:n}=i;let r=0;for(;r<e.length&&e[r]<=t;)r++;r=Math.max(0,r-1);let o=r;for(;o<e.length&&e[o]<t+1;)o++;o=Math.min(e.length-1,o);const s=e[r],a=e[o];return"composite"===i.kind?{kind:"composite",minZoom:s,maxZoom:a,interpolationType:n}:{kind:"camera",minZoom:s,maxZoom:a,minSize:i.evaluate(new tr(s)),maxSize:i.evaluate(new tr(a)),interpolationType:n}}}function _c(t,e,i){let n="never";const r=t.get(e);return r?n=r:t.get(i)&&(n="always"),n}const yc=Ia.VectorTileFeature.types,vc=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function xc(t,e,i,n,r,o,s,a,l,c,h,u,p){const d=a?Math.min(fc,Math.round(a[0])):0,m=a?Math.min(fc,Math.round(a[1])):0;t.emplaceBack(e,i,Math.round(32*n),Math.round(32*r),o,s,(d<<1)+(l?1:0),m,16*c,16*h,256*u,256*p)}function bc(t,e,i){t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i)}function wc(t){for(const e of t.sections)if(Nn(e.text))return!0;return!1}class Tc{constructor(t){this.layoutVertexArray=new ho,this.indexArray=new go,this.programConfigurations=t,this.segments=new xo,this.dynamicLayoutVertexArray=new uo,this.opacityVertexArray=new po,this.hasVisibleVertices=!1,this.placedSymbolArray=new Wr}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,i,n){this.isEmpty()||(i&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ml.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,fl.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,vc,!0),this.opacityVertexBuffer.itemSize=1),(i||n)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}Cn("SymbolBuffers",Tc);class Ec{constructor(t,e,i){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new i,this.segments=new xo,this.collisionVertexArray=new fo}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,gl.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Cn("CollisionBuffers",Ec);class Sc{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((t=>t.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=ys([]),this.placementViewportMatrix=ys([]);const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=gc(this.zoom,i["text-size"]),this.iconSizeData=gc(this.zoom,i["icon-size"]);const n=this.layers[0].layout,r=n.get("symbol-sort-key"),o=n.get("symbol-z-order");this.canOverlap="never"!==_c(n,"text-overlap","text-allow-overlap")||"never"!==_c(n,"icon-overlap","icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&!r.isConstant(),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===n.get("symbol-placement")&&(this.writingModes=n.get("text-writing-mode").map((e=>t.WritingMode[e]))),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=e.sourceID}createArrays(){this.text=new Tc(new jo(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new Tc(new jo(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new Yr,this.lineVertexArray=new Jr,this.symbolInstances=new Kr,this.textAnchorOffsets=new to}calculateGlyphDependencies(t,e,i,n,r){for(let o=0;o<t.length;o++)if(e[t.charCodeAt(o)]=!0,(i||n)&&r){const i=xl[t.charAt(o)];i&&(e[i.charCodeAt(0)]=!0)}}populate(e,i,n){const r=this.layers[0],o=r.layout,s=o.get("text-font"),a=o.get("text-field"),l=o.get("icon-image"),c=("constant"!==a.value.kind||a.value.value instanceof $t&&!a.value.value.isEmpty()||a.value.value.toString().length>0)&&("constant"!==s.value.kind||s.value.value.length>0),h="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,u=o.get("symbol-sort-key");if(this.features=[],!c&&!h)return;const p=i.iconDependencies,d=i.glyphDependencies,m=i.availableImages,f=new tr(this.zoom);for(const{feature:i,id:a,index:l,sourceLayerIndex:g}of e){const e=r._featureFilter.needGeometry,_=Ko(i,e);if(!r._featureFilter.filter(f,_,n))continue;let y,v;if(e||(_.geometry=Xo(i)),c){const t=r.getValueAndResolveTokens("text-field",_,n,m),e=$t.factory(t);wc(e)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===Yn()||this.hasRTLText&&Qn.isParsed())&&(y=vl(e,r,_))}if(h){const t=r.getValueAndResolveTokens("icon-image",_,n,m);v=t instanceof Xt?t:Xt.fromString(t)}if(!y&&!v)continue;const x=this.sortFeaturesByKey?u.evaluate(_,{},n):void 0;if(this.features.push({id:a,text:y,icon:v,index:l,sourceLayerIndex:g,geometry:_.geometry,properties:i.properties,type:yc[i.type],sortKey:x}),v&&(p[v.name]=!0),y){const e=s.evaluate(_,{},n).join(","),i="viewport"!==o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(t.WritingMode.vertical)>=0;for(const t of y.sections)if(t.image)p[t.image.name]=!0;else{const n=Dn(y.toString()),r=t.fontStack||e,o=d[r]=d[r]||{};this.calculateGlyphDependencies(t.text,o,i,this.allowVerticalPlacement,n)}}}"line"===o.get("symbol-placement")&&(this.features=function(t){const e={},i={},n=[];let r=0;function o(e){n.push(t[e]),r++}function s(t,e,r){const o=i[t];return delete i[t],i[e]=o,n[o].geometry[0].pop(),n[o].geometry[0]=n[o].geometry[0].concat(r[0]),o}function a(t,i,r){const o=e[i];return delete e[i],e[t]=o,n[o].geometry[0].shift(),n[o].geometry[0]=r[0].concat(n[o].geometry[0]),o}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;c<t.length;c++){const h=t[c],u=h.geometry,p=h.text?h.text.toString():null;if(!p){o(c);continue}const d=l(p,u),m=l(p,u,!0);if(d in i&&m in e&&i[d]!==e[m]){const t=a(d,m,u),r=s(d,m,n[t].geometry);delete e[d],delete i[m],i[l(p,n[r].geometry,!0)]=r,n[t].geometry=null}else d in i?s(d,m,u):m in e?a(d,m,u):(o(c),e[d]=r-1,i[m]=r-1)}return n.filter((t=>t.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 r={};for(let n=t.segment+1;n<e.length;n++)r[n]={x:e[n].x,y:e[n].y,tileUnitDistanceFromAnchor:i},n<e.length-1&&(i+=e[n+1].dist(e[n]));for(let i=t.segment||0;i>=0;i--)r[i]={x:e[i].x,y:e[i].y,tileUnitDistanceFromAnchor:n},i>0&&(n+=e[i-1].dist(e[i]));for(let t=0;t<e.length;t++){const e=r[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,i,n,r,o,s,a,l,c,h,u,p){const d=e.indexArray,m=e.layoutVertexArray,f=e.segments.prepareSegment(4*i.length,m,d,this.canOverlap?s.sortKey:void 0),g=this.glyphOffsetArray.length,_=f.vertexLength,y=this.allowVerticalPlacement&&a===t.WritingMode.vertical?Math.PI/2:0,v=s.text&&s.text.sections;for(let t=0;t<i.length;t++){const{tl:r,tr:o,bl:a,br:c,tex:h,pixelOffsetTL:u,pixelOffsetBR:g,minFontScaleX:_,minFontScaleY:x,glyphOffset:b,isSDF:w,sectionIndex:T}=i[t],E=f.vertexLength,S=b[1];xc(m,l.x,l.y,r.x,S+r.y,h.x,h.y,n,w,u.x,u.y,_,x),xc(m,l.x,l.y,o.x,S+o.y,h.x+h.w,h.y,n,w,g.x,u.y,_,x),xc(m,l.x,l.y,a.x,S+a.y,h.x,h.y+h.h,n,w,u.x,g.y,_,x),xc(m,l.x,l.y,c.x,S+c.y,h.x+h.w,h.y+h.h,n,w,g.x,g.y,_,x),bc(e.dynamicLayoutVertexArray,l,y),d.emplaceBack(E,E+1,E+2),d.emplaceBack(E+1,E+2,E+3),f.vertexLength+=4,f.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(b[0]),t!==i.length-1&&T===i[t+1].sectionIndex||e.programConfigurations.populatePaintArrays(m.length,s,s.index,{},p,v&&v[T])}e.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,_,c,h,l.segment,n?n[0]:0,n?n[1]:0,r[0],r[1],a,0,!1,0,u)}_addCollisionDebugVertex(t,e,i,n,r,o){return e.emplaceBack(0,0),t.emplaceBack(i.x,i.y,n,r,Math.round(o.x),Math.round(o.y))}addCollisionDebugVertices(t,e,i,n,o,s,a){const l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),c=l.vertexLength,h=o.layoutVertexArray,u=o.collisionVertexArray,p=a.anchorX,d=a.anchorY;this._addCollisionDebugVertex(h,u,s,p,d,new r(t,e)),this._addCollisionDebugVertex(h,u,s,p,d,new r(i,e)),this._addCollisionDebugVertex(h,u,s,p,d,new r(i,n)),this._addCollisionDebugVertex(h,u,s,p,d,new r(t,n)),l.vertexLength+=4;const m=o.indexArray;m.emplaceBack(c,c+1),m.emplaceBack(c+1,c+2),m.emplaceBack(c+2,c+3),m.emplaceBack(c+3,c),l.primitiveLength+=4}addDebugCollisionBoxes(t,e,i,n){for(let r=t;r<e;r++){const t=this.collisionBoxArray.get(r);this.addCollisionDebugVertices(t.x1,t.y1,t.x2,t.y2,n?this.textCollisionBox:this.iconCollisionBox,t.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Ec(mo,_l.members,_o),this.iconCollisionBox=new Ec(mo,_l.members,_o);for(let t=0;t<this.symbolInstances.length;t++){const e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,i,n,r,o,s,a,l){const c={};for(let n=e;n<i;n++){const e=t.get(n);c.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},c.textFeatureIndex=e.featureIndex;break}for(let e=n;e<r;e++){const i=t.get(e);c.verticalTextBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},c.verticalTextFeatureIndex=i.featureIndex;break}for(let e=o;e<s;e++){const i=t.get(e);c.iconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},c.iconFeatureIndex=i.featureIndex;break}for(let e=a;e<l;e++){const i=t.get(e);c.verticalIconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},c.verticalIconFeatureIndex=i.featureIndex;break}return c}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){const i=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}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;e<n;e+=4)t.indexArray.emplaceBack(e,e+1,e+2),t.indexArray.emplaceBack(e+1,e+2,e+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const e=Math.sin(t),i=Math.cos(t),n=[],r=[],o=[];for(let t=0;t<this.symbolInstances.length;++t){o.push(t);const s=this.symbolInstances.get(t);n.push(0|Math.round(e*s.anchorX+i*s.anchorY)),r.push(s.featureIndex)}return o.sort(((t,e)=>n[t]-n[e]||r[e]-r[t])),o}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,zc;Cn("SymbolBucket",Sc,{omit:["layers","collisionBoxArray","features","compareText"]}),Sc.MAX_GLYPHS=65535,Sc.addDynamicAttributes=bc;var Cc={get paint(){return zc=zc||new mr({"icon-opacity":new hr(Z.paint_symbol["icon-opacity"]),"icon-color":new hr(Z.paint_symbol["icon-color"]),"icon-halo-color":new hr(Z.paint_symbol["icon-halo-color"]),"icon-halo-width":new hr(Z.paint_symbol["icon-halo-width"]),"icon-halo-blur":new hr(Z.paint_symbol["icon-halo-blur"]),"icon-translate":new cr(Z.paint_symbol["icon-translate"]),"icon-translate-anchor":new cr(Z.paint_symbol["icon-translate-anchor"]),"text-opacity":new hr(Z.paint_symbol["text-opacity"]),"text-color":new hr(Z.paint_symbol["text-color"],{runtimeType:lt,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new hr(Z.paint_symbol["text-halo-color"]),"text-halo-width":new hr(Z.paint_symbol["text-halo-width"]),"text-halo-blur":new hr(Z.paint_symbol["text-halo-blur"]),"text-translate":new cr(Z.paint_symbol["text-translate"]),"text-translate-anchor":new cr(Z.paint_symbol["text-translate-anchor"])})},get layout(){return Pc=Pc||new mr({"symbol-placement":new cr(Z.layout_symbol["symbol-placement"]),"symbol-spacing":new cr(Z.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new cr(Z.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new hr(Z.layout_symbol["symbol-sort-key"]),"symbol-z-order":new cr(Z.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new cr(Z.layout_symbol["icon-allow-overlap"]),"icon-overlap":new cr(Z.layout_symbol["icon-overlap"]),"icon-ignore-placement":new cr(Z.layout_symbol["icon-ignore-placement"]),"icon-optional":new cr(Z.layout_symbol["icon-optional"]),"icon-rotation-alignment":new cr(Z.layout_symbol["icon-rotation-alignment"]),"icon-size":new hr(Z.layout_symbol["icon-size"]),"icon-text-fit":new cr(Z.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new cr(Z.layout_symbol["icon-text-fit-padding"]),"icon-image":new hr(Z.layout_symbol["icon-image"]),"icon-rotate":new hr(Z.layout_symbol["icon-rotate"]),"icon-padding":new hr(Z.layout_symbol["icon-padding"]),"icon-keep-upright":new cr(Z.layout_symbol["icon-keep-upright"]),"icon-offset":new hr(Z.layout_symbol["icon-offset"]),"icon-anchor":new hr(Z.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new cr(Z.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new cr(Z.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new cr(Z.layout_symbol["text-rotation-alignment"]),"text-field":new hr(Z.layout_symbol["text-field"]),"text-font":new hr(Z.layout_symbol["text-font"]),"text-size":new hr(Z.layout_symbol["text-size"]),"text-max-width":new hr(Z.layout_symbol["text-max-width"]),"text-line-height":new cr(Z.layout_symbol["text-line-height"]),"text-letter-spacing":new hr(Z.layout_symbol["text-letter-spacing"]),"text-justify":new hr(Z.layout_symbol["text-justify"]),"text-radial-offset":new hr(Z.layout_symbol["text-radial-offset"]),"text-variable-anchor":new cr(Z.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new hr(Z.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new hr(Z.layout_symbol["text-anchor"]),"text-max-angle":new cr(Z.layout_symbol["text-max-angle"]),"text-writing-mode":new cr(Z.layout_symbol["text-writing-mode"]),"text-rotate":new hr(Z.layout_symbol["text-rotate"]),"text-padding":new cr(Z.layout_symbol["text-padding"]),"text-keep-upright":new cr(Z.layout_symbol["text-keep-upright"]),"text-transform":new hr(Z.layout_symbol["text-transform"]),"text-offset":new hr(Z.layout_symbol["text-offset"]),"text-allow-overlap":new cr(Z.layout_symbol["text-allow-overlap"]),"text-overlap":new cr(Z.layout_symbol["text-overlap"]),"text-ignore-placement":new cr(Z.layout_symbol["text-ignore-placement"]),"text-optional":new cr(Z.layout_symbol["text-optional"])})}};class Mc{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:rt,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}}Cn("FormatSectionOverride",Mc,{omit:["defaultValue"]});class Ic extends gr{constructor(t){super(t,Cc)}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 r=this.layout.get(t).evaluate(e,{},i,n),o=this._unevaluatedLayout._values[t];return o.isDataDriven()||zi(o.value)||!r?r:function(t,e){return e.replace(/{([^{}]+)}/g,((e,i)=>i in t?String(t[i]):""))}(e.properties,r)}createBucket(t){return new Sc(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Cc.paint.overridableProperties){if(!Ic.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),i=new Mc(e),n=new Pi(i,e.property.specification);let r=null;r="constant"===e.value.kind||"source"===e.value.kind?new Mi("source",n):new Ii("composite",n,e.value.zoomStops),this.paint._values[t]=new ar(e.property,r,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven())&&Ic.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const i=t.get("text-field"),n=Cc.paint.properties[e];let r=!1;const o=t=>{for(const e of t)if(n.overrides&&n.overrides.hasOverride(e))return void(r=!0)};if("constant"===i.value.kind&&i.value.value instanceof $t)o(i.value.value.sections);else if("source"===i.value.kind){const t=e=>{r||(e instanceof te&&Jt(e.value)===pt?o(e.value.sections):e instanceof ri?o(e.sections):e.eachChild(t))},e=i.value;e._styleExpression&&t(e._styleExpression.expression)}return r}}let Ac;var kc={get paint(){return Ac=Ac||new mr({"background-color":new cr(Z.paint_background["background-color"]),"background-pattern":new pr(Z.paint_background["background-pattern"]),"background-opacity":new cr(Z.paint_background["background-opacity"])})}};class Lc extends gr{constructor(t){super(t,kc)}}let Dc;var Bc={get paint(){return Dc=Dc||new mr({"raster-opacity":new cr(Z.paint_raster["raster-opacity"]),"raster-hue-rotate":new cr(Z.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new cr(Z.paint_raster["raster-brightness-min"]),"raster-brightness-max":new cr(Z.paint_raster["raster-brightness-max"]),"raster-saturation":new cr(Z.paint_raster["raster-saturation"]),"raster-contrast":new cr(Z.paint_raster["raster-contrast"]),"raster-resampling":new cr(Z.paint_raster["raster-resampling"]),"raster-fade-duration":new cr(Z.paint_raster["raster-fade-duration"])})}};class Rc extends gr{constructor(t){super(t,Bc)}}class Fc extends gr{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 Oc{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 Uc=6371008.8;class Vc{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 Vc(u(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,r=Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return Uc*Math.acos(Math.min(r,1))}static convert(t){if(t instanceof Vc)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Vc(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Vc(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: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const Nc=2*Math.PI*Uc;function Zc(t){return Nc*Math.cos(t*Math.PI/180)}function jc(t){return(180+t)/360}function qc(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function $c(t,e){return t/Zc(e)}function Gc(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}class Hc{constructor(t,e,i=0){this.x=+t,this.y=+e,this.z=+i}static fromLngLat(t,e=0){const i=Vc.convert(t);return new Hc(jc(i.lng),qc(i.lat),$c(e,i.lat))}toLngLat(){return new Vc(360*this.x-180,Gc(this.y))}toAltitude(){return this.z*Zc(Gc(this.y))}meterInMercatorCoordinateUnits(){return 1/Nc*(t=Gc(this.y),1/Math.cos(t*Math.PI/180));var t}}function Wc(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 Xc{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=Jc(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=(o=this.y,s=this.z,a=Wc(256*(r=this.x),256*(o=Math.pow(2,s)-o-1),s),l=Wc(256*(r+1),256*(o+1),s),a[0]+","+a[1]+","+l[0]+","+l[1]);var r,o,s,a,l;const c=function(t,e,i){let n,r="";for(let o=t;o>0;o--)n=1<<o-1,r+=(e&n?1:0)+(i&n?2:0);return r}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===i?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,e>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)*Go,(t.y*e-this.y)*Go)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Kc{constructor(t,e){this.wrap=t,this.canonical=e,this.key=Jc(t,e.z,e.z,e.x,e.y)}}class Yc{constructor(t,e,i,n,r){if(t<i)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${i}`);this.overscaledZ=t,this.wrap=e,this.canonical=new Xc(i,+n,+r),this.key=Jc(e,t,i,n,r)}clone(){return new Yc(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 Yc(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Yc(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?Jc(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):Jc(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<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new Yc(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 Yc(e,this.wrap,e,i,n),new Yc(e,this.wrap,e,i+1,n),new Yc(e,this.wrap,e,i,n+1),new Yc(e,this.wrap,e,i+1,n+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new Yc(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Yc(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Kc(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Hc(t.x-this.wrap,t.y))}}function Jc(t,e,i,n,r){(t*=2)<0&&(t=-1*t-1);const o=1<<i;return(o*o*t+o*r+n).toString(36)+i.toString(36)+e.toString(36)}Cn("CanonicalTileID",Xc),Cn("OverscaledTileID",Yc,{omit:["posMatrix"]});class Qc{constructor(t,e,i){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(i&&"mapbox"!==i&&"terrarium"!==i)return void y(`"${i}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=e.height;const n=this.dim=e.height-2;this.data=new Uint32Array(e.data.buffer),this.encoding=i||"mapbox";for(let t=0;t<n;t++)this.data[this._idx(-1,t)]=this.data[this._idx(0,t)],this.data[this._idx(n,t)]=this.data[this._idx(n-1,t)],this.data[this._idx(t,-1)]=this.data[this._idx(t,0)],this.data[this._idx(t,n)]=this.data[this._idx(t,n-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(n,-1)]=this.data[this._idx(n-1,0)],this.data[this._idx(-1,n)]=this.data[this._idx(0,n-1)],this.data[this._idx(n,n)]=this.data[this._idx(n-1,n-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let t=0;t<n;t++)for(let e=0;e<n;e++){const i=this.get(t,e);i>this.max&&(this.max=i),i<this.min&&(this.min=i)}}get(t,e){const i=new Uint8Array(this.data.buffer),n=4*this._idx(t,e);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(i[n],i[n+1],i[n+2])}getUnpackVector(){return"terrarium"===this.encoding?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(t,e){if(t<-1||t>=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)}_unpackMapbox(t,e,i){return(256*t*256+256*e+i)/10-1e4}_unpackTerrarium(t,e,i){return 256*t+e+i/256-32768}getPixels(){return new ks({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,r=e*this.dim+this.dim,o=i*this.dim,s=i*this.dim+this.dim;switch(e){case-1:n=r-1;break;case 1:r=n+1}switch(i){case-1:o=s-1;break;case 1:s=o+1}const a=-e*this.dim,l=-i*this.dim;for(let e=o;e<s;e++)for(let i=n;i<r;i++)this.data[this._idx(i,e)]=t.data[this._idx(i+a,e+l)]}}Cn("DEMData",Qc);class th{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){const i=t[e];this._stringToNumber[i]=e,this._numberToString[e]=i}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=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 eh{constructor(t,e,i,n,r){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=i,t._y=n,this.properties=t.properties,this.id=r}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 ih{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Pn(Go,16,0),this.grid3D=new Pn(Go,16,0),this.featureIndexArray=new io,this.promoteId=e}insert(t,e,i,n,r,o){const s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,n,r);const a=o?this.grid3D:this.grid;for(let t=0;t<e.length;t++){const i=e[t],n=[1/0,1/0,-1/0,-1/0];for(let t=0;t<i.length;t++){const e=i[t];n[0]=Math.min(n[0],e.x),n[1]=Math.min(n[1],e.y),n[2]=Math.max(n[2],e.x),n[3]=Math.max(n[3],e.y)}n[0]<Go&&n[1]<Go&&n[2]>=0&&n[3]>=0&&a.insert(s,n[0],n[1],n[2],n[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Ia.VectorTile(new ql(this.rawTileData)).layers,this.sourceLayerCoder=new th(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,i,n){this.loadVTLayers();const o=t.params||{},s=Go/t.tileSize/t.scale,a=Ri(o.filter),l=t.queryGeometry,c=t.queryPadding*s,h=rh(l),u=this.grid.query(h.minX-c,h.minY-c,h.maxX+c,h.maxY+c),p=rh(t.cameraQueryGeometry),d=this.grid3D.query(p.minX-c,p.minY-c,p.maxX+c,p.maxY+c,((e,i,n,o)=>function(t,e,i,n,o){for(const r of t)if(e<=r.x&&i<=r.y&&n>=r.x&&o>=r.y)return!0;const s=[new r(e,i),new r(e,o),new r(n,o),new r(n,i)];if(t.length>2)for(const e of s)if(ls(t,e))return!0;for(let e=0;e<t.length-1;e++)if(cs(t[e],t[e+1],s))return!0;return!1}(t.cameraQueryGeometry,e-c,i-c,n+c,o+c)));for(const t of d)u.push(t);u.sort(oh);const m={};let f;for(let r=0;r<u.length;r++){const c=u[r];if(c===f)continue;f=c;const h=this.featureIndexArray.get(c);let p=null;this.loadMatchingFeature(m,h.bucketIndex,h.sourceLayerIndex,h.featureIndex,a,o.layers,o.availableImages,e,i,n,((e,i,n)=>(p||(p=Xo(e)),i.queryIntersectsFeature(l,e,n,p,this.z,t.transform,s,t.pixelPosMatrix))))}return m}loadMatchingFeature(t,e,i,n,r,o,s,a,l,c,h){const u=this.bucketLayerIDs[e];if(o&&!function(t,e){for(let i=0;i<t.length;i++)if(e.indexOf(t[i])>=0)return!0;return!1}(o,u))return;const d=this.sourceLayerCoder.decode(i),m=this.vtLayers[d].feature(n);if(r.needGeometry){const t=Ko(m,!0);if(!r.filter(new tr(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!r.filter(new tr(this.tileID.overscaledZ),m))return;const f=this.getId(m,d);for(let e=0;e<u.length;e++){const i=u[e];if(o&&o.indexOf(i)<0)continue;const r=a[i];if(!r)continue;let d={};f&&c&&(d=c.getState(r.sourceLayer||"_geojsonTileLayer",f));const g=p({},l[i]);g.paint=nh(g.paint,r.paint,m,d,s),g.layout=nh(g.layout,r.layout,m,d,s);const _=!h||h(m,r,d);if(!_)continue;const y=new eh(m,this.z,this.x,this.y,f);y.layer=g;let v=t[i];void 0===v&&(v=t[i]=[]),v.push({featureIndex:n,feature:y,intersectionZ:_})}}lookupSymbolFeatures(t,e,i,n,r,o,s,a){const l={};this.loadVTLayers();const c=Ri(r);for(const r of t)this.loadMatchingFeature(l,i,n,r,c,o,s,a,e);return l}hasLayer(t){for(const e of this.bucketLayerIDs)for(const i of e)if(t===i)return!0;return!1}getId(t,e){let i=t.id;return this.promoteId&&(i=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]],"boolean"==typeof i&&(i=Number(i))),i}}function nh(t,e,i,n,r){return m(t,((t,o)=>{const s=e instanceof lr?e.get(o):null;return s&&s.evaluate?s.evaluate(i,n,r):s}))}function rh(t){let e=1/0,i=1/0,n=-1/0,r=-1/0;for(const o of t)e=Math.min(e,o.x),i=Math.min(i,o.y),n=Math.max(n,o.x),r=Math.max(r,o.y);return{minX:e,minY:i,maxX:n,maxY:r}}function oh(t,e){return e-t}function sh(t,e,i,n,o){const s=[];for(let a=0;a<t.length;a++){const l=t[a];let c;for(let t=0;t<l.length-1;t++){let a=l[t],h=l[t+1];a.x<e&&h.x<e||(a.x<e?a=new r(e,a.y+(e-a.x)/(h.x-a.x)*(h.y-a.y))._round():h.x<e&&(h=new r(e,a.y+(e-a.x)/(h.x-a.x)*(h.y-a.y))._round()),a.y<i&&h.y<i||(a.y<i?a=new r(a.x+(i-a.y)/(h.y-a.y)*(h.x-a.x),i)._round():h.y<i&&(h=new r(a.x+(i-a.y)/(h.y-a.y)*(h.x-a.x),i)._round()),a.x>=n&&h.x>=n||(a.x>=n?a=new r(n,a.y+(n-a.x)/(h.x-a.x)*(h.y-a.y))._round():h.x>=n&&(h=new r(n,a.y+(n-a.x)/(h.x-a.x)*(h.y-a.y))._round()),a.y>=o&&h.y>=o||(a.y>=o?a=new r(a.x+(o-a.y)/(h.y-a.y)*(h.x-a.x),o)._round():h.y>=o&&(h=new r(a.x+(o-a.y)/(h.y-a.y)*(h.x-a.x),o)._round()),c&&a.equals(c[c.length-1])||(c=[a],s.push(c)),c.push(h)))))}}return s}Cn("FeatureIndex",ih,{omit:["rawTileData","sourceLayerCoder"]});class ah extends r{constructor(t,e,i,n){super(t,e),this.angle=i,void 0!==n&&(this.segment=n)}clone(){return new ah(this.x,this.y,this.angle,this.segment)}}function lh(t,e,i,n,r){if(void 0===e.segment||0===i)return!0;let o=e,s=e.segment+1,a=0;for(;a>-i/2;){if(s--,s<0)return!1;a-=t[s].dist(o),o=t[s]}a+=t[s].dist(t[s+1]),s++;const l=[];let c=0;for(;a<i/2;){const e=t[s],i=t[s+1];if(!i)return!1;let o=t[s-1].angleTo(e)-e.angleTo(i);for(o=Math.abs((o+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:a,angleDelta:o}),c+=o;a-l[0].distance>n;)c-=l.shift().angleDelta;if(c>r)return!1;s++,a+=e.dist(i)}return!0}function ch(t){let e=0;for(let i=0;i<t.length-1;i++)e+=t[i].dist(t[i+1]);return e}function hh(t,e,i){return t?.6*e*i:0}function uh(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function ph(t,e,i,n,r,o){const s=hh(i,r,o),a=uh(i,n)*o;let l=0;const c=ch(t)/2;for(let i=0;i<t.length-1;i++){const n=t[i],r=t[i+1],o=n.dist(r);if(l+o>c){const h=(c-l)/o,u=Fe.number(n.x,r.x,h),p=Fe.number(n.y,r.y,h),d=new ah(u,p,r.angleTo(n),i);return d._round(),!s||lh(t,d,a,s,e)?d:void 0}l+=o}}function dh(t,e,i,n,r,o,s,a,l){const c=hh(n,o,s),h=uh(n,r),u=h*s,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-u<e/4&&(e=u+e/4),mh(t,p?e/2*a%e:(h/2+2*o)*s*a%e,e,c,i,u,p,!1,l)}function mh(t,e,i,n,r,o,s,a,l){const c=o/2,h=ch(t);let u=0,p=e-i,d=[];for(let e=0;e<t.length-1;e++){const s=t[e],a=t[e+1],m=s.dist(a),f=a.angleTo(s);for(;p+i<u+m;){p+=i;const g=(p-u)/m,_=Fe.number(s.x,a.x,g),y=Fe.number(s.y,a.y,g);if(_>=0&&_<l&&y>=0&&y<l&&p-c>=0&&p+c<=h){const i=new ah(_,y,f,e);i._round(),n&&!lh(t,i,o,n,r)||d.push(i)}}u+=m}return a||d.length||s||(d=mh(t,u/2,i,n,r,o,s,!0,l)),d}Cn("Anchor",ah);function fh(t,e,i,n){const o=[],s=t.image,a=s.pixelRatio,l=s.paddedRect.w-2,c=s.paddedRect.h-2,h=t.right-t.left,u=t.bottom-t.top,p=s.stretchX||[[0,l]],d=s.stretchY||[[0,c]],m=(t,e)=>t+e[1]-e[0],f=p.reduce(m,0),g=d.reduce(m,0),_=l-f,y=c-g;let v=0,x=f,b=0,w=g,T=0,E=_,S=0,P=y;if(s.content&&n){const t=s.content;v=gh(p,0,t[0]),b=gh(d,0,t[1]),x=gh(p,t[0],t[2]),w=gh(d,t[1],t[3]),T=t[0]-v,S=t[1]-b,E=t[2]-t[0]-x,P=t[3]-t[1]-w}const z=(n,o,l,c)=>{const p=yh(n.stretch-v,x,h,t.left),d=vh(n.fixed-T,E,n.stretch,f),m=yh(o.stretch-b,w,u,t.top),_=vh(o.fixed-S,P,o.stretch,g),y=yh(l.stretch-v,x,h,t.left),z=vh(l.fixed-T,E,l.stretch,f),C=yh(c.stretch-b,w,u,t.top),M=vh(c.fixed-S,P,c.stretch,g),I=new r(p,m),A=new r(y,m),k=new r(y,C),L=new r(p,C),D=new r(d/a,_/a),B=new r(z/a,M/a),R=e*Math.PI/180;if(R){const t=Math.sin(R),e=Math.cos(R),i=[e,-t,t,e];I._matMult(i),A._matMult(i),L._matMult(i),k._matMult(i)}const F=n.stretch+n.fixed,O=o.stretch+o.fixed;return{tl:I,tr:A,bl:L,br:k,tex:{x:s.paddedRect.x+1+F,y:s.paddedRect.y+1+O,w:l.stretch+l.fixed-F,h:c.stretch+c.fixed-O},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:D,pixelOffsetBR:B,minFontScaleX:E/a/h,minFontScaleY:P/a/u,isSDF:i}};if(n&&(s.stretchX||s.stretchY)){const t=_h(p,_,f),e=_h(d,y,g);for(let i=0;i<t.length-1;i++){const n=t[i],r=t[i+1];for(let t=0;t<e.length-1;t++)o.push(z(n,e[t],r,e[t+1]))}}else o.push(z({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:c+1}));return o}function gh(t,e,i){let n=0;for(const r of t)n+=Math.max(e,Math.min(i,r[1]))-Math.max(e,Math.min(i,r[0]));return n}function _h(t,e,i){const n=[{fixed:-1,stretch:0}];for(const[e,i]of t){const t=n[n.length-1];n.push({fixed:e-t.stretch,stretch:t.stretch}),n.push({fixed:e-t.stretch,stretch:t.stretch+(i-e)})}return n.push({fixed:e+1,stretch:i}),n}function yh(t,e,i,n){return t/e*i+n}function vh(t,e,i,n){return t-e*i/n}class xh{constructor(t,e,i,n,o,s,a,l,c,h){if(this.boxStartIndex=t.length,c){let t=s.top,e=s.bottom;const i=s.collisionPadding;i&&(t-=i[1],e+=i[3]);let n=e-t;n>0&&(n=Math.max(10,n),this.circleDiameter=n)}else{let c=s.top*a-l[0],u=s.bottom*a+l[2],p=s.left*a-l[3],d=s.right*a+l[1];const m=s.collisionPadding;if(m&&(p-=m[0]*a,c-=m[1]*a,d+=m[2]*a,u+=m[3]*a),h){const t=new r(p,c),e=new r(d,c),i=new r(p,u),n=new r(d,u),o=h*Math.PI/180;t._rotate(o),e._rotate(o),i._rotate(o),n._rotate(o),p=Math.min(t.x,e.x,i.x,n.x),d=Math.max(t.x,e.x,i.x,n.x),c=Math.min(t.y,e.y,i.y,n.y),u=Math.max(t.y,e.y,i.y,n.y)}t.emplaceBack(e.x,e.y,p,c,d,u,i,n,o)}this.boxEndIndex=t.length}}class bh{constructor(t=[],e=wh){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 r=t-1>>1,o=e[r];if(i(n,o)>=0)break;e[t]=o,t=r}e[t]=n}_down(t){const{data:e,compare:i}=this,n=this.length>>1,r=e[t];for(;t<n;){let n=1+(t<<1),o=e[n];const s=n+1;if(s<this.length&&i(e[s],o)<0&&(n=s,o=e[s]),i(o,r)>=0)break;e[t]=o,t=n}e[t]=r}}function wh(t,e){return t<e?-1:t>e?1:0}function Th(t,e=1,i=!1){let n=1/0,o=1/0,s=-1/0,a=-1/0;const l=t[0];for(let t=0;t<l.length;t++){const e=l[t];(!t||e.x<n)&&(n=e.x),(!t||e.y<o)&&(o=e.y),(!t||e.x>s)&&(s=e.x),(!t||e.y>a)&&(a=e.y)}const c=Math.min(s-n,a-o);let h=c/2;const u=new bh([],Eh);if(0===c)return new r(n,o);for(let e=n;e<s;e+=c)for(let i=o;i<a;i+=c)u.push(new Sh(e+h,i+h,h,t));let p=function(t){let e=0,i=0,n=0;const r=t[0];for(let t=0,o=r.length,s=o-1;t<o;s=t++){const o=r[t],a=r[s],l=o.x*a.y-a.x*o.y;i+=(o.x+a.x)*l,n+=(o.y+a.y)*l,e+=3*l}return new Sh(i/e,n/e,0,t)}(t),d=u.length;for(;u.length;){const n=u.pop();(n.d>p.d||!p.d)&&(p=n,i&&console.log("found best %d after %d probes",Math.round(1e4*n.d)/1e4,d)),n.max-p.d<=e||(h=n.h/2,u.push(new Sh(n.p.x-h,n.p.y-h,h,t)),u.push(new Sh(n.p.x+h,n.p.y-h,h,t)),u.push(new Sh(n.p.x-h,n.p.y+h,h,t)),u.push(new Sh(n.p.x+h,n.p.y+h,h,t)),d+=4)}return i&&(console.log(`num probes: ${d}`),console.log(`best distance: ${p.d}`)),p.p}function Eh(t,e){return e.max-t.max}function Sh(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 r=0;r<e.length;r++){const o=e[r];for(let e=0,r=o.length,s=r-1;e<r;s=e++){const r=o[e],a=o[s];r.y>t.y!=a.y>t.y&&t.x<(a.x-r.x)*(t.y-r.y)/(a.y-r.y)+r.x&&(i=!i),n=Math.min(n,ss(t,r,a))}}return(i?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}var Ph;t.TextAnchorEnum=void 0,(Ph=t.TextAnchorEnum||(t.TextAnchorEnum={}))[Ph.center=1]="center",Ph[Ph.left=2]="left",Ph[Ph.right=3]="right",Ph[Ph.top=4]="top",Ph[Ph.bottom=5]="bottom",Ph[Ph["top-left"]=6]="top-left",Ph[Ph["top-right"]=7]="top-right",Ph[Ph["bottom-left"]=8]="bottom-left",Ph[Ph["bottom-right"]=9]="bottom-right";const zh=Number.POSITIVE_INFINITY;function Ch(t,e){return e[1]!==zh?function(t,e,i){let n=0,r=0;switch(e=Math.abs(e),i=Math.abs(i),t){case"top-right":case"top-left":case"top":r=i-7;break;case"bottom-right":case"bottom-left":case"bottom":r=7-i}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,r]}(t,e[0],e[1]):function(t,e){let i=0,n=0;e<0&&(e=0);const r=e/Math.SQRT2;switch(t){case"top-right":case"top-left":n=r-7;break;case"bottom-right":case"bottom-left":n=7-r;break;case"bottom":n=7-e;break;case"top":n=e-7}switch(t){case"top-right":case"bottom-right":i=-r;break;case"top-left":case"bottom-left":i=r;break;case"left":i=e;break;case"right":i=-e}return[i,n]}(t,e[0])}function Mh(t,e,i){var n;const r=t.layout,o=null===(n=r.get("text-variable-anchor-offset"))||void 0===n?void 0:n.evaluate(e,{},i);if(o){const t=o.values,e=[];for(let i=0;i<t.length;i+=2){const n=e[i]=t[i],r=t[i+1].map((t=>t*bl));n.startsWith("top")?r[1]-=7:n.startsWith("bottom")&&(r[1]+=7),e[i+1]=r}return new Wt(e)}const s=r.get("text-variable-anchor");if(s){let n;n=void 0!==t._unevaluatedLayout.getValue("text-radial-offset")?[r.get("text-radial-offset").evaluate(e,{},i)*bl,zh]:r.get("text-offset").evaluate(e,{},i).map((t=>t*bl));const o=[];for(const t of s)o.push(t,Ch(t,n));return new Wt(o)}return null}function Ih(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 Ah(e,i,n,r,o,s,a,l,c,h,u){let p=s.textMaxSize.evaluate(i,{});void 0===p&&(p=a);const d=e.layers[0].layout,m=d.get("icon-offset").evaluate(i,{},u),f=Lh(n.horizontal),g=a/24,_=e.tilePixelRatio*g,v=e.tilePixelRatio*p/24,x=e.tilePixelRatio*l,b=e.tilePixelRatio*d.get("symbol-spacing"),w=d.get("text-padding")*e.tilePixelRatio,T=function(t,e,i,n=1){const r=t.get("icon-padding").evaluate(e,{},i),o=r&&r.values;return[o[0]*n,o[1]*n,o[2]*n,o[3]*n]}(d,i,u,e.tilePixelRatio),E=d.get("text-max-angle")/180*Math.PI,S="viewport"!==d.get("text-rotation-alignment")&&"point"!==d.get("symbol-placement"),P="map"===d.get("icon-rotation-alignment")&&"point"!==d.get("symbol-placement"),z=d.get("symbol-placement"),C=b/2,M=d.get("icon-text-fit");let I;r&&"none"!==M&&(e.allowVerticalPlacement&&n.vertical&&(I=dc(r,n.vertical,M,d.get("icon-text-fit-padding"),m,g)),f&&(r=dc(r,f,M,d.get("icon-text-fit-padding"),m,g)));const A=(l,p)=>{p.x<0||p.x>=Go||p.y<0||p.y>=Go||function(e,i,n,r,o,s,a,l,c,h,u,p,d,m,f,g,_,v,x,b,w,T,E,S,P){const z=e.addToLineVertexArray(i,n);let C,M,I,A,k=0,L=0,D=0,B=0,R=-1,F=-1;const O={};let U=Po("");if(e.allowVerticalPlacement&&r.vertical){const t=l.layout.get("text-rotate").evaluate(w,{},S)+90;I=new xh(c,i,h,u,p,r.vertical,d,m,f,t),a&&(A=new xh(c,i,h,u,p,a,_,v,f,t))}if(o){const n=l.layout.get("icon-rotate").evaluate(w,{}),r="none"!==l.layout.get("icon-text-fit"),s=fh(o,n,E,r),d=a?fh(a,n,E,r):void 0;M=new xh(c,i,h,u,p,o,_,v,!1,n),k=4*s.length;const m=e.iconSizeData;let f=null;"source"===m.kind?(f=[mc*l.layout.get("icon-size").evaluate(w,{})],f[0]>fc&&y(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===m.kind&&(f=[mc*T.compositeIconSizes[0].evaluate(w,{},S),mc*T.compositeIconSizes[1].evaluate(w,{},S)],(f[0]>fc||f[1]>fc)&&y(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),e.addSymbols(e.icon,s,f,b,x,w,t.WritingMode.none,i,z.lineStartIndex,z.lineLength,-1,S),R=e.icon.placedSymbolArray.length-1,d&&(L=4*d.length,e.addSymbols(e.icon,d,f,b,x,w,t.WritingMode.vertical,i,z.lineStartIndex,z.lineLength,-1,S),F=e.icon.placedSymbolArray.length-1)}const V=Object.keys(r.horizontal);for(const n of V){const o=r.horizontal[n];if(!C){U=Po(o.text);const t=l.layout.get("text-rotate").evaluate(w,{},S);C=new xh(c,i,h,u,p,o,d,m,f,t)}const a=1===o.positionedLines.length;if(D+=kh(e,i,o,s,l,f,w,g,z,r.vertical?t.WritingMode.horizontal:t.WritingMode.horizontalOnly,a?V:[n],O,R,T,S),a)break}r.vertical&&(B+=kh(e,i,r.vertical,s,l,f,w,g,z,t.WritingMode.vertical,["vertical"],O,F,T,S));const N=C?C.boxStartIndex:e.collisionBoxArray.length,Z=C?C.boxEndIndex:e.collisionBoxArray.length,j=I?I.boxStartIndex:e.collisionBoxArray.length,q=I?I.boxEndIndex:e.collisionBoxArray.length,$=M?M.boxStartIndex:e.collisionBoxArray.length,G=M?M.boxEndIndex:e.collisionBoxArray.length,H=A?A.boxStartIndex:e.collisionBoxArray.length,W=A?A.boxEndIndex:e.collisionBoxArray.length;let X=-1;const K=(t,e)=>t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;X=K(C,X),X=K(I,X),X=K(M,X),X=K(A,X);const Y=X>-1?1:0;Y&&(X*=P/bl),e.glyphOffsetArray.length>=Sc.MAX_GLYPHS&&y("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==w.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,w.sortKey);const J=Mh(l,w,S),[Q,tt]=function(e,i){const n=e.length,r=null==i?void 0:i.values;if((null==r?void 0:r.length)>0)for(let i=0;i<r.length;i+=2){const n=r[i+1];e.emplaceBack(t.TextAnchorEnum[r[i]],n[0],n[1])}return[n,e.length]}(e.textAnchorOffsets,J);e.symbolInstances.emplaceBack(i.x,i.y,O.right>=0?O.right:-1,O.center>=0?O.center:-1,O.left>=0?O.left:-1,O.vertical||-1,R,F,U,N,Z,j,q,$,G,H,W,h,D,B,k,L,Y,0,d,X,Q,tt)}(e,p,l,n,r,o,I,e.layers[0],e.collisionBoxArray,i.index,i.sourceLayerIndex,e.index,_,[w,w,w,w],S,c,x,T,P,m,i,s,h,u,a)};if("line"===z)for(const t of sh(i.geometry,0,0,Go,Go)){const i=dh(t,b,E,n.vertical||f,r,24,v,e.overscaling,Go);for(const n of i)f&&Dh(e,f.text,C,n)||A(t,n)}else if("line-center"===z){for(const t of i.geometry)if(t.length>1){const e=ph(t,E,n.vertical||f,r,24,v);e&&A(t,e)}}else if("Polygon"===i.type)for(const t of ya(i.geometry,0)){const e=Th(t,16);A(t[0],new ah(e.x,e.y,0))}else if("LineString"===i.type)for(const t of i.geometry)A(t,new ah(t[0].x,t[0].y,0));else if("Point"===i.type)for(const t of i.geometry)for(const e of t)A([e],new ah(e.x,e.y,0))}function kh(t,e,i,n,o,s,a,l,c,h,u,p,d,m,f){const g=function(t,e,i,n,o,s,a,l){const c=n.layout.get("text-rotate").evaluate(s,{})*Math.PI/180,h=[];for(const t of e.positionedLines)for(const n of t.positionedGlyphs){if(!n.rect)continue;const s=n.rect||{};let u=4,p=!0,d=1,m=0;const f=(o||l)&&n.vertical,g=n.metrics.advance*n.scale/2;if(l&&e.verticalizable&&(m=t.lineOffset/2-(n.imageName?-(bl-n.metrics.width*n.scale)/2:(n.scale-1)*bl)),n.imageName){const t=a[n.imageName];p=t.sdf,d=t.pixelRatio,u=1/d}const _=o?[n.x+g,n.y]:[0,0];let y=o?[0,0]:[n.x+g+i[0],n.y+i[1]-m],v=[0,0];f&&(v=y,y=[0,0]);const x=(n.metrics.left-u)*n.scale-g+y[0],b=(-n.metrics.top-u)*n.scale+y[1],w=x+s.w*n.scale/d,T=b+s.h*n.scale/d,E=new r(x,b),S=new r(w,b),P=new r(x,T),z=new r(w,T);if(f){const t=new r(-g,g-Jl),e=-Math.PI/2,i=12-g,o=new r(22-i,-(n.imageName?i:0)),s=new r(...v);E._rotateAround(e,t)._add(o)._add(s),S._rotateAround(e,t)._add(o)._add(s),P._rotateAround(e,t)._add(o)._add(s),z._rotateAround(e,t)._add(o)._add(s)}if(c){const t=Math.sin(c),e=Math.cos(c),i=[e,-t,t,e];E._matMult(i),S._matMult(i),P._matMult(i),z._matMult(i)}const C=new r(0,0),M=new r(0,0);h.push({tl:E,tr:S,bl:P,br:z,tex:s,writingMode:e.writingMode,glyphOffset:_,sectionIndex:n.sectionIndex,isSDF:p,pixelOffsetTL:C,pixelOffsetBR:M,minFontScaleX:0,minFontScaleY:0})}return h}(0,i,l,o,s,a,n,t.allowVerticalPlacement),_=t.textSizeData;let v=null;"source"===_.kind?(v=[mc*o.layout.get("text-size").evaluate(a,{})],v[0]>fc&&y(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===_.kind&&(v=[mc*m.compositeTextSizes[0].evaluate(a,{},f),mc*m.compositeTextSizes[1].evaluate(a,{},f)],(v[0]>fc||v[1]>fc)&&y(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,g,v,l,s,a,h,e,c.lineStartIndex,c.lineLength,d,f);for(const e of u)p[e]=t.text.placedSymbolArray.length-1;return 4*g.length}function Lh(t){for(const e in t)return t[e];return null}function Dh(t,e,i,n){const r=t.compareText;if(e in r){const t=r[e];for(let e=t.length-1;e>=0;e--)if(n.dist(t[e])<i)return!0}else r[e]=[];return r[e].push(n),!1}const Bh=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Rh{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,i]=new Uint8Array(t,0,2);if(219!==e)throw new Error("Data does not appear to be in a KDBush format.");const n=i>>4;if(1!==n)throw new Error(`Got v${n} data when expected v1.`);const r=Bh[15&i];if(!r)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[s]=new Uint32Array(t,4,1);return new Rh(s,o,r,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 r=Bh.indexOf(this.ArrayType),o=2*t*this.ArrayType.BYTES_PER_ELEMENT,s=t*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-s%8)%8;if(r<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+s+a,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+o+s+a),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+s+a,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+r]),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 Fh(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:r,coords:o,nodeSize:s}=this,a=[0,r.length-1,0],l=[];for(;a.length;){const c=a.pop()||0,h=a.pop()||0,u=a.pop()||0;if(h-u<=s){for(let s=u;s<=h;s++){const a=o[2*s],c=o[2*s+1];a>=t&&a<=i&&c>=e&&c<=n&&l.push(r[s])}continue}const p=u+h>>1,d=o[2*p],m=o[2*p+1];d>=t&&d<=i&&m>=e&&m<=n&&l.push(r[p]),(0===c?t<=d:e<=m)&&(a.push(u),a.push(p-1),a.push(1-c)),(0===c?i>=d:n>=m)&&(a.push(p+1),a.push(h),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:r,nodeSize:o}=this,s=[0,n.length-1,0],a=[],l=i*i;for(;s.length;){const c=s.pop()||0,h=s.pop()||0,u=s.pop()||0;if(h-u<=o){for(let i=u;i<=h;i++)Nh(r[2*i],r[2*i+1],t,e)<=l&&a.push(n[i]);continue}const p=u+h>>1,d=r[2*p],m=r[2*p+1];Nh(d,m,t,e)<=l&&a.push(n[p]),(0===c?t-i<=d:e-i<=m)&&(s.push(u),s.push(p-1),s.push(1-c)),(0===c?t+i>=d:e+i>=m)&&(s.push(p+1),s.push(h),s.push(1-c))}return a}}function Fh(t,e,i,n,r,o){if(r-n<=i)return;const s=n+r>>1;Oh(t,e,s,n,r,o),Fh(t,e,i,n,s-1,1-o),Fh(t,e,i,s+1,r,1-o)}function Oh(t,e,i,n,r,o){for(;r>n;){if(r-n>600){const s=r-n+1,a=i-n+1,l=Math.log(s),c=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*c*(s-c)/s)*(a-s/2<0?-1:1);Oh(t,e,i,Math.max(n,Math.floor(i-a*c/s+h)),Math.min(r,Math.floor(i+(s-a)*c/s+h)),o)}const s=e[2*i+o];let a=n,l=r;for(Uh(t,e,n,i),e[2*r+o]>s&&Uh(t,e,n,r);a<l;){for(Uh(t,e,a,l),a++,l--;e[2*a+o]<s;)a++;for(;e[2*l+o]>s;)l--}e[2*n+o]===s?Uh(t,e,n,l):(l++,Uh(t,e,l,r)),l<=i&&(n=l+1),i<=l&&(r=l-1)}}function Uh(t,e,i,n){Vh(t,i,n),Vh(e,2*i,2*n),Vh(e,2*i+1,2*n+1)}function Vh(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function Nh(t,e,i,n){const r=t-i,o=e-n;return r*r+o*o}var Zh;t.PerformanceMarkers=void 0,(Zh=t.PerformanceMarkers||(t.PerformanceMarkers={})).create="create",Zh.load="load",Zh.fullLoad="fullLoad";let jh=null,qh=[];const $h=1e3/60,Gh="loadTime",Hh="fullLoadTime",Wh={mark(t){performance.mark(t)},frame(t){const e=t;null!=jh&&qh.push(e-jh),jh=e},clearMetrics(){jh=null,qh=[],performance.clearMeasures(Gh),performance.clearMeasures(Hh);for(const e in t.PerformanceMarkers)performance.clearMarks(t.PerformanceMarkers[e])},getPerformanceMetrics(){performance.measure(Gh,t.PerformanceMarkers.create,t.PerformanceMarkers.load),performance.measure(Hh,t.PerformanceMarkers.create,t.PerformanceMarkers.fullLoad);const e=performance.getEntriesByName(Gh)[0].duration,i=performance.getEntriesByName(Hh)[0].duration,n=qh.length,r=1/(qh.reduce(((t,e)=>t+e),0)/n/1e3),o=qh.filter((t=>t>$h)).reduce(((t,e)=>t+(e-$h)/$h),0);return{loadTime:e,fullLoadTime:i,fps:r,percentDroppedFrames:o/(n+o)*100,totalFrames:n}}};t.AJAXError=I,t.ARRAY_TYPE=_s,t.Actor=class{constructor(t,e,i){this.receive=t=>{const e=t.data,i=e.id;if(i&&(!e.targetMapId||this.mapId===e.targetMapId))if("<cancel>"===e.type){delete this.tasks[i];const t=this.cancelCallbacks[i];delete this.cancelCallbacks[i],t&&t()}else b()||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 Oc(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=b()?t:window}send(t,e,i,n,r=!1){const o=Math.round(1e18*Math.random()).toString(36).substring(0,10);i&&(this.callbacks[o]=i);const s=T(this.globalScope)?void 0:[];return this.target.postMessage({id:o,type:t,hasCallback:!!i,targetMapId:n,mustQueue:r,sourceMapId:this.mapId,data:In(e,s)},s),{cancel:()=>{i&&delete this.callbacks[o],this.target.postMessage({id:o,type:"<cancel>",targetMapId:n,sourceMapId:this.mapId})}}}processTask(t,e){if("<response>"===e.type){const i=this.callbacks[t];delete this.callbacks[t],i&&(e.error?i(An(e.error)):i(null,An(e.data)))}else{let i=!1;const n=T(this.globalScope)?void 0:[],r=e.hasCallback?(e,r)=>{i=!0,delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:"<response>",sourceMapId:this.mapId,error:e?In(e):null,data:In(r,n)},n)}:t=>{i=!0};let o=null;const s=An(e.data);if(this.parent[e.type])o=this.parent[e.type](e.sourceMapId,s,r);else if(this.parent.getWorkerSource){const t=e.type.split(".");o=this.parent.getWorkerSource(e.sourceMapId,t[0],s.source)[t[1]](s,r)}else r(new Error(`Could not find function ${e.type}`));!i&&o&&o.cancel&&(this.cancelCallbacks[t]=o.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},t.AlphaImage=As,t.CanonicalTileID=Xc,t.CollisionBoxArray=Gr,t.CollisionCircleLayoutArray=class extends Dr{},t.Color=Zt,t.DEMData=Qc,t.DataConstantProperty=cr,t.DictionaryCoder=th,t.EXTENT=Go,t.ErrorEvent=V,t.EvaluationParameters=tr,t.Event=U,t.Evented=N,t.FeatureIndex=ih,t.FillBucket=wa,t.FillExtrusionBucket=$a,t.GeoJSONFeature=eh,t.ImageAtlas=Kl,t.ImagePosition=Xl,t.KDBush=Rh,t.LineBucket=sl,t.LineStripIndexArray=class extends jr{},t.LngLat=Vc,t.MercatorCoordinate=Hc,t.ONE_EM=bl,t.OverscaledTileID=Yc,t.PerformanceUtils=Wh,t.Point=r,t.Pos3dArray=class extends Tr{},t.PosArray=no,t.Properties=mr,t.Protobuf=ql,t.QuadTriangleArray=class extends Rr{},t.RGBAImage=ks,t.RasterBoundsArray=class extends Er{},t.RequestPerformance=class{constructor(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let t=performance.getEntriesByName(this._marks.measure);return 0===t.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),t=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),t}},t.SegmentVector=xo,t.SymbolBucket=Sc,t.Transitionable=nr,t.TriangleIndexArray=go,t.Uniform1f=ko,t.Uniform1i=class extends Ao{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}},t.Uniform2f=class extends Ao{constructor(t,e){super(t,e),this.current=[0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))}},t.Uniform3f=class extends Ao{constructor(t,e){super(t,e),this.current=[0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))}},t.Uniform4f=Lo,t.UniformColor=Do,t.UniformMatrix4f=class extends Ao{constructor(t,e){super(t,e),this.current=Bo}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(let e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}},t.UnwrappedTileID=Kc,t.ValidationError=tt,t.ZoomHistory=kn,t.addDynamicAttributes=bc,t.arrayBufferToImage=function(t,e){const i=new Image;i.onload=()=>{e(null,i),URL.revokeObjectURL(i.src),i.onload=null,window.requestAnimationFrame((()=>{i.src=S}))},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 n=new Blob([new Uint8Array(t)],{type:"image/png"});i.src=t.byteLength?URL.createObjectURL(n):S},t.arrayBufferToImageBitmap=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.asyncAll=function(t,e,i){if(!t.length)return i(null,[]);let n=t.length;const r=new Array(t.length);let o=null;t.forEach(((t,s)=>{e(t,((t,e)=>{t&&(o=t),r[s]=e,0==--n&&i(o,r)}))}))},t.bezier=l,t.browser=C,t.clamp=h,t.clipLine=sh,t.clone=function(t){var e=new _s(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.clone$1=g,t.collisionCircleLayout=yl,t.config=M,t.copy=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.create=function(){var t=new _s(16);return _s!=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.createExpression=Ci,t.createFilter=Ri,t.createLayout=xr,t.createStyleLayer=function(t){if("custom"===t.type)return new Fc(t);switch(t.type){case"background":return new Lc(t);case"circle":return new Ts(t);case"fill":return new Pa(t);case"fill-extrusion":return new Ka(t);case"heatmap":return new Ds(t);case"hillshade":return new Fs(t);case"line":return new pl(t);case"raster":return new Rc(t);case"symbol":return new Ic(t)}},t.deepEqual=function t(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(let n=0;n<e.length;n++)if(!t(e[n],i[n]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==i){if("object"!=typeof i)return!1;if(Object.keys(e).length!==Object.keys(i).length)return!1;for(const n in e)if(!t(e[n],i[n]))return!1;return!0}return e===i},t.defaultEasing=c,t.derefLayers=function(t){t=t.slice();const e=Object.create(null);for(let i=0;i<t.length;i++)e[t[i].id]=t[i];for(let i=0;i<t.length;i++)"ref"in t[i]&&(t[i]=q(t[i],e[t[i].ref]));return t},t.diffStyles=function(t,e){if(!t)return[{command:G.setStyle,args:[e]}];let i=[];try{if(!$(t.version,e.version))return[{command:G.setStyle,args:[e]}];$(t.center,e.center)||i.push({command:G.setCenter,args:[e.center]}),$(t.zoom,e.zoom)||i.push({command:G.setZoom,args:[e.zoom]}),$(t.bearing,e.bearing)||i.push({command:G.setBearing,args:[e.bearing]}),$(t.pitch,e.pitch)||i.push({command:G.setPitch,args:[e.pitch]}),$(t.sprite,e.sprite)||i.push({command:G.setSprite,args:[e.sprite]}),$(t.glyphs,e.glyphs)||i.push({command:G.setGlyphs,args:[e.glyphs]}),$(t.transition,e.transition)||i.push({command:G.setTransition,args:[e.transition]}),$(t.light,e.light)||i.push({command:G.setLight,args:[e.light]});const n={},r=[];!function(t,e,i,n){let r;for(r in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,r)&&(Object.prototype.hasOwnProperty.call(e,r)||W(r,i,n));for(r in e)Object.prototype.hasOwnProperty.call(e,r)&&(Object.prototype.hasOwnProperty.call(t,r)?$(t[r],e[r])||("geojson"===t[r].type&&"geojson"===e[r].type&&K(t,e,r)?i.push({command:G.setGeoJSONSourceData,args:[r,e[r].data]}):X(r,e,i,n)):H(r,e,i))}(t.sources,e.sources,r,n);const o=[];t.layers&&t.layers.forEach((t=>{n[t.source]?i.push({command:G.removeLayer,args:[t.id]}):o.push(t)})),i=i.concat(r),function(t,e,i){e=e||[];const n=(t=t||[]).map(J),r=e.map(J),o=t.reduce(Q,{}),s=e.reduce(Q,{}),a=n.slice(),l=Object.create(null);let c,h,u,p,d,m,f;for(c=0,h=0;c<n.length;c++)u=n[c],Object.prototype.hasOwnProperty.call(s,u)?h++:(i.push({command:G.removeLayer,args:[u]}),a.splice(a.indexOf(u,h),1));for(c=0,h=0;c<r.length;c++)u=r[r.length-1-c],a[a.length-1-c]!==u&&(Object.prototype.hasOwnProperty.call(o,u)?(i.push({command:G.removeLayer,args:[u]}),a.splice(a.lastIndexOf(u,a.length-h),1)):h++,m=a[a.length-c],i.push({command:G.addLayer,args:[s[u],m]}),a.splice(a.length-c,0,u),l[u]=!0);for(c=0;c<r.length;c++)if(u=r[c],p=o[u],d=s[u],!l[u]&&!$(p,d))if($(p.source,d.source)&&$(p["source-layer"],d["source-layer"])&&$(p.type,d.type)){for(f in Y(p.layout,d.layout,i,u,null,G.setLayoutProperty),Y(p.paint,d.paint,i,u,null,G.setPaintProperty),$(p.filter,d.filter)||i.push({command:G.setFilter,args:[u,d.filter]}),$(p.minzoom,d.minzoom)&&$(p.maxzoom,d.maxzoom)||i.push({command:G.setLayerZoomRange,args:[u,d.minzoom,d.maxzoom]}),p)Object.prototype.hasOwnProperty.call(p,f)&&"layout"!==f&&"paint"!==f&&"filter"!==f&&"metadata"!==f&&"minzoom"!==f&&"maxzoom"!==f&&(0===f.indexOf("paint.")?Y(p[f],d[f],i,u,f.slice(6),G.setPaintProperty):$(p[f],d[f])||i.push({command:G.setLayerProperty,args:[u,f,d[f]]}));for(f in d)Object.prototype.hasOwnProperty.call(d,f)&&!Object.prototype.hasOwnProperty.call(p,f)&&"layout"!==f&&"paint"!==f&&"filter"!==f&&"metadata"!==f&&"minzoom"!==f&&"maxzoom"!==f&&(0===f.indexOf("paint.")?Y(p[f],d[f],i,u,f.slice(6),G.setPaintProperty):$(p[f],d[f])||i.push({command:G.setLayerProperty,args:[u,f,d[f]]}))}else i.push({command:G.removeLayer,args:[u]}),m=a[a.lastIndexOf(u)+1],i.push({command:G.addLayer,args:[d,m]})}(o,e.layers,i)}catch(t){console.warn("Unable to compute style diff:",t),i=[{command:G.setStyle,args:[e]}]}return i},t.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},t.earthRadius=Uc,t.emitValidationErrors=Sn,t.emptyStyle=function(){const t={},e=Z.$version;for(const i in Z.$root){const n=Z.$root[i];if(n.required){let r=null;r="version"===i?e:"array"===n.type?[]:{},null!=r&&(t[i]=r)}}return t},t.equals=function(t,e){var i=t[0],n=t[1],r=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],h=t[8],u=t[9],p=t[10],d=t[11],m=t[12],f=t[13],g=t[14],_=t[15],y=e[0],v=e[1],x=e[2],b=e[3],w=e[4],T=e[5],E=e[6],S=e[7],P=e[8],z=e[9],C=e[10],M=e[11],I=e[12],A=e[13],k=e[14],L=e[15];return Math.abs(i-y)<=gs*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(n-v)<=gs*Math.max(1,Math.abs(n),Math.abs(v))&&Math.abs(r-x)<=gs*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(o-b)<=gs*Math.max(1,Math.abs(o),Math.abs(b))&&Math.abs(s-w)<=gs*Math.max(1,Math.abs(s),Math.abs(w))&&Math.abs(a-T)<=gs*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(l-E)<=gs*Math.max(1,Math.abs(l),Math.abs(E))&&Math.abs(c-S)<=gs*Math.max(1,Math.abs(c),Math.abs(S))&&Math.abs(h-P)<=gs*Math.max(1,Math.abs(h),Math.abs(P))&&Math.abs(u-z)<=gs*Math.max(1,Math.abs(u),Math.abs(z))&&Math.abs(p-C)<=gs*Math.max(1,Math.abs(p),Math.abs(C))&&Math.abs(d-M)<=gs*Math.max(1,Math.abs(d),Math.abs(M))&&Math.abs(m-I)<=gs*Math.max(1,Math.abs(m),Math.abs(I))&&Math.abs(f-A)<=gs*Math.max(1,Math.abs(f),Math.abs(A))&&Math.abs(g-k)<=gs*Math.max(1,Math.abs(g),Math.abs(k))&&Math.abs(_-L)<=gs*Math.max(1,Math.abs(_),Math.abs(L))},t.evaluateSizeForFeature=function(t,{uSize:e,uSizeT:i},{lowerSize:n,upperSize:r}){return"source"===t.kind?n/mc:"composite"===t.kind?Fe.number(n/mc,r/mc,i):e},t.evaluateSizeForZoom=function(t,e){let i=0,n=0;if("constant"===t.kind)n=t.layoutSize;else if("source"!==t.kind){const{interpolationType:r,minZoom:o,maxZoom:s}=t,a=r?h(Oe.interpolationFactor(r,e,o,s),0,1):0;"camera"===t.kind?n=Fe.number(t.minSize,t.maxSize,a):i=a}return{uSizeT:i,uSize:n}},t.evented=Kn,t.extend=p,t.filterObject=f,t.findLineIntersection=function(t,e,i,n){const o=e.y-t.y,s=e.x-t.x,a=n.y-i.y,l=n.x-i.x,c=a*s-l*o;if(0===c)return null;const h=(l*(t.y-i.y)-a*(t.x-i.x))/c;return new r(t.x+h*s,t.y+h*o)},t.fromScaling=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.getAnchorAlignment=hc,t.getAnchorJustification=Ih,t.getArrayBuffer=B,t.getDefaultExportFromCjs=e,t.getJSON=function(t,e){return D(p(t,{type:"json"}),e)},t.getOverlapMode=_c,t.getProtocolAction=k,t.getRTLTextPluginStatus=Yn,t.getReferrer=A,t.getVideo=function(t,e){const i=window.document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let e=0;e<t.length;e++){const n=window.document.createElement("source");R(t[e])||(i.crossOrigin="Anonymous"),n.src=t[e],i.appendChild(n)}return{cancel:()=>{}}},t.groupByLayout=function(t,e){const i={};for(let n=0;n<t.length;n++){const r=e&&e[t[n].id]||$i(t[n]);e&&(e[t[n].id]=r);let o=i[r];o||(o=i[r]=[]),o.push(t[n])}const n=[];for(const t in i)n.push(i[t]);return n},t.identity=ys,t.interpolate=Fe,t.invert=function(t,e){var i=e[0],n=e[1],r=e[2],o=e[3],s=e[4],a=e[5],l=e[6],c=e[7],h=e[8],u=e[9],p=e[10],d=e[11],m=e[12],f=e[13],g=e[14],_=e[15],y=i*a-n*s,v=i*l-r*s,x=i*c-o*s,b=n*l-r*a,w=n*c-o*a,T=r*c-o*l,E=h*f-u*m,S=h*g-p*m,P=h*_-d*m,z=u*g-p*f,C=u*_-d*f,M=p*_-d*g,I=y*M-v*C+x*z+b*P-w*S+T*E;return I?(t[0]=(a*M-l*C+c*z)*(I=1/I),t[1]=(r*C-n*M-o*z)*I,t[2]=(f*T-g*w+_*b)*I,t[3]=(p*w-u*T-d*b)*I,t[4]=(l*P-s*M-c*S)*I,t[5]=(i*M-r*P+o*S)*I,t[6]=(g*x-m*T-_*v)*I,t[7]=(h*T-p*x+d*v)*I,t[8]=(s*C-a*P+c*E)*I,t[9]=(n*P-i*C-o*E)*I,t[10]=(m*w-f*x+_*y)*I,t[11]=(u*x-h*w-d*y)*I,t[12]=(a*S-s*z-l*E)*I,t[13]=(i*z-n*S+r*E)*I,t[14]=(f*v-m*b-g*y)*I,t[15]=(h*b-u*v+p*y)*I,t):null},t.isImageBitmap=E,t.isSafari=T,t.isWorker=b,t.keysDifference=function(t,e){const i=[];for(const n in t)n in e||i.push(n);return i},t.lazyLoadRTLTextPlugin=function(){Qn.isLoading()||Qn.isLoaded()||"deferred"!==Yn()||Jn()},t.makeRequest=D,t.mapObject=m,t.mercatorXfromLng=jc,t.mercatorYfromLat=qc,t.mercatorZfromAltitude=$c,t.mul=bs,t.mul$1=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.multiply=vs,t.nextPowerOfTwo=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.operations=G,t.ortho=function(t,e,i,n,r,o,s){var a=1/(e-i),l=1/(n-r),c=1/(o-s);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+i)*a,t[13]=(r+n)*l,t[14]=(s+o)*c,t[15]=1,t},t.parseCacheControl=function(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((t,i,n,r)=>{const o=n||r;return e[i]=!o||o.toLowerCase(),""})),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e},t.parseGlyphPbf=function(t){return new ql(t).readFields($l,[])},t.pbf=wl,t.performSymbolLayout=function(e){e.bucket.createArrays(),e.bucket.tilePixelRatio=Go/(512*e.bucket.overscaling),e.bucket.compareText={},e.bucket.iconsNeedLinear=!1;const i=e.bucket.layers[0],n=i.layout,r=i._unevaluatedLayout._values,o={layoutIconSize:r["icon-size"].possiblyEvaluate(new tr(e.bucket.zoom+1),e.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new tr(e.bucket.zoom+1),e.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new tr(18))};if("composite"===e.bucket.textSizeData.kind){const{minZoom:t,maxZoom:i}=e.bucket.textSizeData;o.compositeTextSizes=[r["text-size"].possiblyEvaluate(new tr(t),e.canonical),r["text-size"].possiblyEvaluate(new tr(i),e.canonical)]}if("composite"===e.bucket.iconSizeData.kind){const{minZoom:t,maxZoom:i}=e.bucket.iconSizeData;o.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new tr(t),e.canonical),r["icon-size"].possiblyEvaluate(new tr(i),e.canonical)]}const s=n.get("text-line-height")*bl,a="viewport"!==n.get("text-rotation-alignment")&&"point"!==n.get("symbol-placement"),l=n.get("text-keep-upright"),c=n.get("text-size");for(const r of e.bucket.features){const h=n.get("text-font").evaluate(r,{},e.canonical).join(","),u=c.evaluate(r,{},e.canonical),p=o.layoutTextSize.evaluate(r,{},e.canonical),d=o.layoutIconSize.evaluate(r,{},e.canonical),m={horizontal:{},vertical:void 0},f=r.text;let g,_=[0,0];if(f){const o=f.toString(),c=n.get("text-letter-spacing").evaluate(r,{},e.canonical)*bl,d=Bn(o)?c:0,g=n.get("text-anchor").evaluate(r,{},e.canonical),y=Mh(i,r,e.canonical);if(!y){const t=n.get("text-radial-offset").evaluate(r,{},e.canonical);_=t?Ch(g,[t*bl,zh]):n.get("text-offset").evaluate(r,{},e.canonical).map((t=>t*bl))}let v=a?"center":n.get("text-justify").evaluate(r,{},e.canonical);const x=n.get("symbol-placement"),b="point"===x?n.get("text-max-width").evaluate(r,{},e.canonical)*bl:0,w=()=>{e.bucket.allowVerticalPlacement&&Dn(o)&&(m.vertical=ec(f,e.glyphMap,e.glyphPositions,e.imagePositions,h,b,s,g,"left",d,_,t.WritingMode.vertical,!0,x,p,u))};if(!a&&y){const i=new Set;if("auto"===v)for(let t=0;t<y.values.length;t+=2)i.add(Ih(y.values[t]));else i.add(v);let n=!1;for(const r of i)if(!m.horizontal[r])if(n)m.horizontal[r]=m.horizontal[0];else{const i=ec(f,e.glyphMap,e.glyphPositions,e.imagePositions,h,b,s,"center",r,d,_,t.WritingMode.horizontal,!1,x,p,u);i&&(m.horizontal[r]=i,n=1===i.positionedLines.length)}w()}else{"auto"===v&&(v=Ih(g));const i=ec(f,e.glyphMap,e.glyphPositions,e.imagePositions,h,b,s,g,v,d,_,t.WritingMode.horizontal,!1,x,p,u);i&&(m.horizontal[v]=i),w(),Dn(o)&&a&&l&&(m.vertical=ec(f,e.glyphMap,e.glyphPositions,e.imagePositions,h,b,s,g,v,d,_,t.WritingMode.vertical,!1,x,p,u))}}let v=!1;if(r.icon&&r.icon.name){const t=e.imageMap[r.icon.name];t&&(g=pc(e.imagePositions[r.icon.name],n.get("icon-offset").evaluate(r,{},e.canonical),n.get("icon-anchor").evaluate(r,{},e.canonical)),v=!!t.sdf,void 0===e.bucket.sdfIcons?e.bucket.sdfIcons=v:e.bucket.sdfIcons!==v&&y("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(t.pixelRatio!==e.bucket.pixelRatio||0!==n.get("icon-rotate").constantOr(1))&&(e.bucket.iconsNeedLinear=!0))}const x=Lh(m.horizontal)||m.vertical;e.bucket.iconsInText=!!x&&x.iconsInText,(x||g)&&Ah(e.bucket,r,m,g,e.imageMap,o,p,d,_,v,e.canonical)}e.showCollisionBoxes&&e.bucket.generateCollisionDebugBuffers()},t.perspective=function(t,e,i,n,r){var o,s=1/Math.tan(e/2);return t[0]=s/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,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!=r&&r!==1/0?(t[10]=(r+n)*(o=1/(n-r)),t[14]=2*r*n*o):(t[10]=-1,t[14]=-2*n),t},t.pick=function(t,e){const i={};for(let n=0;n<e.length;n++){const r=e[n];r in t&&(i[r]=t[r])}return i},t.plugin=Qn,t.pointGeometry=i,t.polygonIntersectsPolygon=Qo,t.potpack=Wl,t.register=Cn,t.registerForPluginStateChange=function(t){return t({pluginStatus:Gn,pluginURL:Hn}),Kn.on("pluginStateChange",t),t},t.renderColorRamp=Ls,t.rotateX=function(t,e,i){var n=Math.sin(i),r=Math.cos(i),o=e[4],s=e[5],a=e[6],l=e[7],c=e[8],h=e[9],u=e[10],p=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]=o*r+c*n,t[5]=s*r+h*n,t[6]=a*r+u*n,t[7]=l*r+p*n,t[8]=c*r-o*n,t[9]=h*r-s*n,t[10]=u*r-a*n,t[11]=p*r-l*n,t},t.rotateZ=function(t,e,i){var n=Math.sin(i),r=Math.cos(i),o=e[0],s=e[1],a=e[2],l=e[3],c=e[4],h=e[5],u=e[6],p=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]=o*r+c*n,t[1]=s*r+h*n,t[2]=a*r+u*n,t[3]=l*r+p*n,t[4]=c*r-o*n,t[5]=h*r-s*n,t[6]=u*r-a*n,t[7]=p*r-l*n,t},t.sameOrigin=R,t.scale=function(t,e,i){var n=i[0],r=i[1],o=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]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.setRTLTextPlugin=function(t,e,i=!1){if(Gn===Zn||Gn===jn||Gn===qn)throw new Error("setRTLTextPlugin cannot be called multiple times.");Hn=C.resolveURL(t),Gn=Zn,$n=e,Xn(),i||Jn()},t.sphericalToCartesian=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.toEvaluationFeature=Ko,t.transformMat4=ws,t.translate=function(t,e,i){var n,r,o,s,a,l,c,h,u,p,d,m,f=i[0],g=i[1],_=i[2];return e===t?(t[12]=e[0]*f+e[4]*g+e[8]*_+e[12],t[13]=e[1]*f+e[5]*g+e[9]*_+e[13],t[14]=e[2]*f+e[6]*g+e[10]*_+e[14],t[15]=e[3]*f+e[7]*g+e[11]*_+e[15]):(r=e[1],o=e[2],s=e[3],a=e[4],l=e[5],c=e[6],h=e[7],u=e[8],p=e[9],d=e[10],m=e[11],t[0]=n=e[0],t[1]=r,t[2]=o,t[3]=s,t[4]=a,t[5]=l,t[6]=c,t[7]=h,t[8]=u,t[9]=p,t[10]=d,t[11]=m,t[12]=n*f+a*g+u*_+e[12],t[13]=r*f+l*g+p*_+e[13],t[14]=o*f+c*g+d*_+e[14],t[15]=s*f+h*g+m*_+e[15]),t},t.triggerPluginCompletionEvent=Wn,t.unicodeBlockLookup=Ln,t.uniqueId=function(){return d++},t.v8Spec=Z,t.validateCustomStyleLayer=function(t){const e=[],i=t.id;return void 0===i&&e.push({message:`layers.${i}: missing required property "id"`}),void 0===t.render&&e.push({message:`layers.${i}: missing required method "render"`}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},t.validateLight=wn,t.validateStyle=bn,t.vectorTile=Ia,t.warnOnce=y,t.wrap=u})),n(0,(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.createStyleLayer(i);e._featureFilter=t.createFilter(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.groupByLayout(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 r=this.familiesBySource[n];r||(r=this.familiesBySource[n]={});const o=i.sourceLayer||"_geojsonTileLayer";let s=r[o];s||(s=r[o]=[]),s.push(e)}}}class i{constructor(e){const i={},n=[];for(const t in e){const r=e[t],o=i[t]={};for(const t in r){const e=r[+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),o[t]={rect:i,metrics:e.metrics}}}const{w:r,h:o}=t.potpack(n),s=new t.AlphaImage({width:r||1,height:o||1});for(const n in e){const r=e[n];for(const e in r){const o=r[+e];if(!o||0===o.bitmap.width||0===o.bitmap.height)continue;const a=i[n][e].rect;t.AlphaImage.copy(o.bitmap,s,{x:0,y:0},{x:a.x+1,y:a.y+1},o.bitmap)}}this.image=s,this.positions=i}}t.register("GlyphAtlas",i);class n{constructor(e){this.tileID=new t.OverscaledTileID(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,n,o,s,a){this.status="parsing",this.data=e,this.collisionBoxArray=new t.CollisionBoxArray;const l=new t.DictionaryCoder(Object.keys(e.layers).sort()),c=new t.FeatureIndex(this.tileID,this.promoteId);c.bucketLayerIDs=[];const h={},u={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:o},p=n.familiesBySource[this.source];for(const i in p){const n=e.layers[i];if(!n)continue;1===n.version&&t.warnOnce(`Vector tile source "${this.source}" layer "${i}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const s=l.encode(i),a=[];for(let t=0;t<n.length;t++){const e=n.feature(t),r=c.getId(e,i);a.push({feature:e,id:r,index:t,sourceLayerIndex:s})}for(const e of p[i]){const i=e[0];i.source!==this.source&&t.warnOnce(`layer.source = ${i.source} does not equal this.source = ${this.source}`),i.minzoom&&this.zoom<Math.floor(i.minzoom)||i.maxzoom&&this.zoom>=i.maxzoom||"none"!==i.visibility&&(r(e,this.zoom,o),(h[i.id]=i.createBucket({index:c.bucketLayerIDs.length,layers:e,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:s,sourceID:this.source})).populate(a,u,this.tileID.canonical),c.bucketLayerIDs.push(e.map((t=>t.id))))}}let d,m,f,g;const _=t.mapObject(u.glyphDependencies,(t=>Object.keys(t).map(Number)));this.inFlightDependencies.forEach((t=>null==t?void 0:t.cancel())),this.inFlightDependencies=[];const y=++this.dependencySentinel;Object.keys(_).length?this.inFlightDependencies.push(s.send("getGlyphs",{uid:this.uid,stacks:_,source:this.source,tileID:this.tileID,type:"glyphs"},((t,e)=>{y===this.dependencySentinel&&(d||(d=t,m=e,b.call(this)))}))):m={};const v=Object.keys(u.iconDependencies);v.length?this.inFlightDependencies.push(s.send("getImages",{icons:v,source:this.source,tileID:this.tileID,type:"icons"},((t,e)=>{y===this.dependencySentinel&&(d||(d=t,f=e,b.call(this)))}))):f={};const x=Object.keys(u.patternDependencies);function b(){if(d)return a(d);if(m&&f&&g){const e=new i(m),n=new t.ImageAtlas(f,g);for(const i in h){const s=h[i];s instanceof t.SymbolBucket?(r(s.layers,this.zoom,o),t.performSymbolLayout({bucket:s,glyphMap:m,glyphPositions:e.positions,imageMap:f,imagePositions:n.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):s.hasPattern&&(s instanceof t.LineBucket||s instanceof t.FillBucket||s instanceof t.FillExtrusionBucket)&&(r(s.layers,this.zoom,o),s.addFeatures(u,this.tileID.canonical,n.patternPositions))}this.status="done",a(null,{buckets:Object.values(h).filter((t=>!t.isEmpty())),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,imageAtlas:n,glyphMap:this.returnDependencies?m:null,iconMap:this.returnDependencies?f:null,glyphPositions:this.returnDependencies?e.positions:null})}}x.length?this.inFlightDependencies.push(s.send("getImages",{icons:x,source:this.source,tileID:this.tileID,type:"patterns"},((t,e)=>{y===this.dependencySentinel&&(d||(d=t,g=e,b.call(this)))}))):g={},b.call(this)}}function r(e,i,n){const r=new t.EvaluationParameters(i);for(const t of e)t.recalculate(r,n)}function o(e,i){const n=t.getArrayBuffer(e.request,((e,n,r,o)=>{e?i(e):n&&i(null,{vectorTile:new t.vectorTile.VectorTile(new t.Protobuf(n)),rawData:n,cacheControl:r,expires:o})}));return()=>{n.cancel(),i()}}class s{constructor(t,e,i,n){this.actor=t,this.layerIndex=e,this.availableImages=i,this.loadVectorData=n||o,this.fetching={},this.loading={},this.loaded={}}loadTile(e,i){const r=e.uid;this.loading||(this.loading={});const o=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.RequestPerformance(e.request),s=this.loading[r]=new n(e);s.abort=this.loadVectorData(e,((e,n)=>{if(delete this.loading[r],e||!n)return s.status="done",this.loaded[r]=s,i(e);const a=n.rawData,l={};n.expires&&(l.expires=n.expires),n.cacheControl&&(l.cacheControl=n.cacheControl);const c={};if(o){const t=o.finish();t&&(c.resourceTiming=JSON.parse(JSON.stringify(t)))}s.vectorTile=n.vectorTile,s.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor,((e,n)=>{if(delete this.fetching[r],e||!n)return i(e);i(null,t.extend({rawTileData:a.slice(0)},n,l,c))})),this.loaded=this.loaded||{},this.loaded[r]=s,this.fetching[r]={rawTileData:a,cacheControl:l,resourceTiming:c}}))}reloadTile(e,i){const n=this.loaded,r=e.uid;if(n&&n[r]){const o=n[r];o.showCollisionBoxes=e.showCollisionBoxes,"parsing"===o.status?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,((e,n)=>{if(e||!n)return i(e,n);let o;if(this.fetching[r]){const{rawTileData:e,cacheControl:i,resourceTiming:s}=this.fetching[r];delete this.fetching[r],o=t.extend({rawTileData:e.slice(0)},n,i,s)}else o=n;i(null,o)})):"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,i):i())}}abortTile(t,e){const i=this.loading,n=t.uid;i&&i[n]&&i[n].abort&&(i[n].abort(),delete i[n]),e()}removeTile(t,e){const i=this.loaded,n=t.uid;i&&i[n]&&delete i[n],e()}}class a{constructor(){this.loaded={}}loadTile(e,i){const{uid:n,encoding:r,rawImageData:o}=e,s=t.isImageBitmap(o)?this.getImageData(o):o,a=new t.DEMData(n,s,r);this.loaded=this.loaded||{},this.loaded[n]=a,i(null,a)}getImageData(e){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);const i=this.offscreenCanvasContext.getImageData(-1,-1,e.width+2,e.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new t.RGBAImage({width:i.width,height:i.height},i.data)}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<t.length;i++)c(t[i],!e)}}function c(t,e){for(var i=0,n=0,r=0,o=t.length,s=o-1;r<o;s=r++){var a=(t[r][0]-t[s][0])*(t[s][1]+t[r][1]),l=i+a;n+=Math.abs(i)>=Math.abs(a)?i-l+a:a-l+i,i=l}i+n>=0!=!!e&&t.reverse()}var h=t.getDefaultExportFromCjs((function t(e,i){var n,r=e&&e.type;if("FeatureCollection"===r)for(n=0;n<e.features.length;n++)t(e.features[n],i);else if("GeometryCollection"===r)for(n=0;n<e.geometries.length;n++)t(e.geometries[n],i);else if("Feature"===r)t(e.geometry,i);else if("Polygon"===r)l(e.coordinates,i);else if("MultiPolygon"===r)for(n=0;n<e.coordinates.length;n++)l(e.coordinates[n],i);return e}));const u=t.vectorTile.VectorTileFeature.prototype.toGeoJSON;var p={exports:{}},d=t.pointGeometry,m=t.vectorTile.VectorTileFeature,f=g;function g(t,e){this.options=e||{},this.features=t,this.length=t.length}function _(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}g.prototype.feature=function(t){return new _(this.features[t],this.options.extent)},_.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var i=t[e],n=[],r=0;r<i.length;r++)n.push(new d(i[r][0],i[r][1]));this.geometry.push(n)}return this.geometry},_.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,i=-1/0,n=1/0,r=-1/0,o=0;o<t.length;o++)for(var s=t[o],a=0;a<s.length;a++){var l=s[a];e=Math.min(e,l.x),i=Math.max(i,l.x),n=Math.min(n,l.y),r=Math.max(r,l.y)}return[e,n,i,r]},_.prototype.toGeoJSON=m.prototype.toGeoJSON;var y=t.pbf,v=f;function x(t){var e=new y;return function(t,e){for(var i in t.layers)e.writeMessage(3,b,t.layers[i])}(t,e),e.finish()}function b(t,e){var i;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var n={keys:[],values:[],keycache:{},valuecache:{}};for(i=0;i<t.length;i++)n.feature=t.feature(i),e.writeMessage(2,w,n);var r=n.keys;for(i=0;i<r.length;i++)e.writeStringField(3,r[i]);var o=n.values;for(i=0;i<o.length;i++)e.writeMessage(4,z,o[i])}function w(t,e){var i=t.feature;void 0!==i.id&&e.writeVarintField(1,i.id),e.writeMessage(2,T,t),e.writeVarintField(3,i.type),e.writeMessage(4,P,i)}function T(t,e){var i=t.feature,n=t.keys,r=t.values,o=t.keycache,s=t.valuecache;for(var a in i.properties){var l=i.properties[a],c=o[a];if(null!==l){void 0===c&&(n.push(a),o[a]=c=n.length-1),e.writeVarint(c);var h=typeof l;"string"!==h&&"boolean"!==h&&"number"!==h&&(l=JSON.stringify(l));var u=h+":"+l,p=s[u];void 0===p&&(r.push(l),s[u]=p=r.length-1),e.writeVarint(p)}}}function E(t,e){return(e<<3)+(7&t)}function S(t){return t<<1^t>>31}function P(t,e){for(var i=t.loadGeometry(),n=t.type,r=0,o=0,s=i.length,a=0;a<s;a++){var l=i[a],c=1;1===n&&(c=l.length),e.writeVarint(E(1,c));for(var h=3===n?l.length-1:l.length,u=0;u<h;u++){1===u&&1!==n&&e.writeVarint(E(2,h-1));var p=l[u].x-r,d=l[u].y-o;e.writeVarint(S(p)),e.writeVarint(S(d)),r+=p,o+=d}3===n&&e.writeVarint(E(7,1))}}function z(t,e){var i=typeof t;"string"===i?e.writeStringField(1,t):"boolean"===i?e.writeBooleanField(7,t):"number"===i&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}p.exports=x,p.exports.fromVectorTileJs=x,p.exports.fromGeojsonVt=function(t,e){e=e||{};var i={};for(var n in t)i[n]=new v(t[n].features,e),i[n].name=n,i[n].version=e.version,i[n].extent=e.extent;return x({layers:i})},p.exports.GeoJSONWrapper=v;var C=t.getDefaultExportFromCjs(p.exports);const M={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},I=Math.fround||(A=new Float32Array(1),t=>(A[0]=+t,A[0]));var A;class k{constructor(t){this.options=Object.assign(Object.create(M),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 r=`prepare ${t.length} points`;e&&console.time(r),this.points=t;const o=[];for(let e=0;e<t.length;e++){const i=t[e];if(!i.geometry)continue;const[n,r]=i.geometry.coordinates,s=I(B(n)),a=I(R(r));o.push(s,a,1/0,e,-1,1),this.options.reduce&&o.push(0)}let s=this.trees[n+1]=this._createTree(o);e&&console.timeEnd(r);for(let t=n;t>=i;t--){const i=+Date.now();s=this.trees[t]=this._createTree(this._cluster(s,t)),e&&console.log("z%d: %d clusters in %dms",t,s.numItems,+Date.now()-i)}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 r=180===t[2]?180:((t[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)i=-180,r=180;else if(i>r){const t=this.getClusters([i,n,180,o],e),s=this.getClusters([-180,n,r,o],e);return t.concat(s)}const s=this.trees[this._limitZoom(e)],a=s.range(B(i),R(o),B(r),R(n)),l=s.data,c=[];for(const t of a){const e=this.stride*t;c.push(l[e+5]>1?L(l,e,this.clusterProps):this.points[l[e+3]])}return c}getChildren(t){const e=this._getOriginId(t),i=this._getOriginZoom(t),n="No cluster with the specified id.",r=this.trees[i];if(!r)throw new Error(n);const o=r.data;if(e*this.stride>=o.length)throw new Error(n);const s=this.options.radius/(this.options.extent*Math.pow(2,i-1)),a=r.within(o[e*this.stride],o[e*this.stride+1],s),l=[];for(const e of a){const i=e*this.stride;o[i+4]===t&&l.push(o[i+5]>1?L(o,i,this.clusterProps):this.points[o[i+3]])}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)],r=Math.pow(2,t),{extent:o,radius:s}=this.options,a=s/o,l=(i-a)/r,c=(i+1+a)/r,h={features:[]};return this._addTileFeatures(n.range((e-a)/r,l,(e+1+a)/r,c),n.data,e,i,r,h),0===e&&this._addTileFeatures(n.range(1-a/r,l,1,c),n.data,r,i,r,h),e===r-1&&this._addTileFeatures(n.range(0,l,a/r,c),n.data,-1,i,r,h),h.features.length?h: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,r){const o=this.getChildren(e);for(const e of o){const o=e.properties;if(o&&o.cluster?r+o.point_count<=n?r+=o.point_count:r=this._appendLeaves(t,o.cluster_id,i,n,r):r<n?r++:t.push(e),t.length===i)break}return r}_createTree(e){const i=new t.KDBush(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let t=0;t<e.length;t+=this.stride)i.add(e[t],e[t+1]);return i.finish(),i.data=e,i}_addTileFeatures(t,e,i,n,r,o){for(const s of t){const t=s*this.stride,a=e[t+5]>1;let l,c,h;if(a)l=D(e,t,this.clusterProps),c=e[t],h=e[t+1];else{const i=this.points[e[t+3]];l=i.properties;const[n,r]=i.geometry.coordinates;c=B(n),h=R(r)}const u={type:1,geometry:[[Math.round(this.options.extent*(c*r-i)),Math.round(this.options.extent*(h*r-n))]],tags:l};let p;p=a||this.options.generateId?e[t+3]:this.points[e[t+3]].id,void 0!==p&&(u.id=p),o.features.push(u)}}_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:r,minPoints:o}=this.options,s=i/(n*Math.pow(2,e)),a=t.data,l=[],c=this.stride;for(let i=0;i<a.length;i+=c){if(a[i+2]<=e)continue;a[i+2]=e;const n=a[i],h=a[i+1],u=t.within(a[i],a[i+1],s),p=a[i+5];let d=p;for(const t of u){const i=t*c;a[i+2]>e&&(d+=a[i+5])}if(d>p&&d>=o){let t,o=n*p,s=h*p,m=-1;const f=((i/c|0)<<5)+(e+1)+this.points.length;for(const n of u){const l=n*c;if(a[l+2]<=e)continue;a[l+2]=e;const h=a[l+5];o+=a[l]*h,s+=a[l+1]*h,a[l+4]=f,r&&(t||(t=this._map(a,i,!0),m=this.clusterProps.length,this.clusterProps.push(t)),r(t,this._map(a,l)))}a[i+4]=f,l.push(o/d,s/d,1/0,f,-1,d),r&&l.push(m)}else{for(let t=0;t<c;t++)l.push(a[i+t]);if(d>1)for(const t of u){const i=t*c;if(!(a[i+2]<=e)){a[i+2]=e;for(let t=0;t<c;t++)l.push(a[i+t])}}}}return l}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e,i){if(t[e+5]>1){const n=this.clusterProps[t[e+6]];return i?Object.assign({},n):n}const n=this.points[t[e+3]].properties,r=this.options.map(n);return i&&r===n?Object.assign({},r):r}}function L(t,e,i){return{type:"Feature",id:t[e+3],properties:D(t,e,i),geometry:{type:"Point",coordinates:[(n=t[e],360*(n-.5)),F(t[e+1])]}};var n}function D(t,e,i){const n=t[e+5],r=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?Math.round(n/100)/10+"k":n,o=t[e+6],s=-1===o?{}:Object.assign({},i[o]);return Object.assign(s,{cluster:!0,cluster_id:t[e+3],point_count:n,point_count_abbreviated:r})}function B(t){return t/360+.5}function R(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 F(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function O(t,e,i,n){for(var r,o=n,s=i-e>>1,a=i-e,l=t[e],c=t[e+1],h=t[i],u=t[i+1],p=e+3;p<i;p+=3){var d=U(t[p],t[p+1],l,c,h,u);if(d>o)r=p,o=d;else if(d===o){var m=Math.abs(p-s);m<a&&(r=p,a=m)}}o>n&&(r-e>3&&O(t,e,r,n),t[r+2]=o,i-r>3&&O(t,r,i,n))}function U(t,e,i,n,r,o){var s=r-i,a=o-n;if(0!==s||0!==a){var l=((t-i)*s+(e-n)*a)/(s*s+a*a);l>1?(i=r,n=o):l>0&&(i+=s*l,n+=a*l)}return(s=t-i)*s+(a=e-n)*a}function V(t,e,i,n){var r={id:void 0===t?null:t,type:e,geometry:i,tags:n,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)N(t,e);else if("Polygon"===i||"MultiLineString"===i)for(var n=0;n<e.length;n++)N(t,e[n]);else if("MultiPolygon"===i)for(n=0;n<e.length;n++)for(var r=0;r<e[n].length;r++)N(t,e[n][r])}(r),r}function N(t,e){for(var i=0;i<e.length;i+=3)t.minX=Math.min(t.minX,e[i]),t.minY=Math.min(t.minY,e[i+1]),t.maxX=Math.max(t.maxX,e[i]),t.maxY=Math.max(t.maxY,e[i+1])}function Z(t,e,i,n){if(e.geometry){var r=e.geometry.coordinates,o=e.geometry.type,s=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),a=[],l=e.id;if(i.promoteId?l=e.properties[i.promoteId]:i.generateId&&(l=n||0),"Point"===o)j(r,a);else if("MultiPoint"===o)for(var c=0;c<r.length;c++)j(r[c],a);else if("LineString"===o)q(r,a,s,!1);else if("MultiLineString"===o){if(i.lineMetrics){for(c=0;c<r.length;c++)q(r[c],a=[],s,!1),t.push(V(l,"LineString",a,e.properties));return}$(r,a,s,!1)}else if("Polygon"===o)$(r,a,s,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(c=0;c<e.geometry.geometries.length;c++)Z(t,{id:l,geometry:e.geometry.geometries[c],properties:e.properties},i,n);return}throw new Error("Input data is not a valid GeoJSON object.")}for(c=0;c<r.length;c++){var h=[];$(r[c],h,s,!0),a.push(h)}}t.push(V(l,o,a,e.properties))}}function j(t,e){e.push(G(t[0])),e.push(H(t[1])),e.push(0)}function q(t,e,i,n){for(var r,o,s=0,a=0;a<t.length;a++){var l=G(t[a][0]),c=H(t[a][1]);e.push(l),e.push(c),e.push(0),a>0&&(s+=n?(r*c-l*o)/2:Math.sqrt(Math.pow(l-r,2)+Math.pow(c-o,2))),r=l,o=c}var h=e.length-3;e[2]=1,O(e,0,h,i),e[h+2]=1,e.size=Math.abs(s),e.start=0,e.end=e.size}function $(t,e,i,n){for(var r=0;r<t.length;r++){var o=[];q(t[r],o,i,n),e.push(o)}}function G(t){return t/360+.5}function H(t){var 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 W(t,e,i,n,r,o,s,a){if(n/=e,o>=(i/=e)&&s<n)return t;if(s<i||o>=n)return null;for(var l=[],c=0;c<t.length;c++){var h=t[c],u=h.geometry,p=h.type,d=0===r?h.minX:h.minY,m=0===r?h.maxX:h.maxY;if(d>=i&&m<n)l.push(h);else if(!(m<i||d>=n)){var f=[];if("Point"===p||"MultiPoint"===p)X(u,f,i,n,r);else if("LineString"===p)K(u,f,i,n,r,!1,a.lineMetrics);else if("MultiLineString"===p)J(u,f,i,n,r,!1);else if("Polygon"===p)J(u,f,i,n,r,!0);else if("MultiPolygon"===p)for(var g=0;g<u.length;g++){var _=[];J(u[g],_,i,n,r,!0),_.length&&f.push(_)}if(f.length){if(a.lineMetrics&&"LineString"===p){for(g=0;g<f.length;g++)l.push(V(h.id,p,f[g],h.tags));continue}"LineString"!==p&&"MultiLineString"!==p||(1===f.length?(p="LineString",f=f[0]):p="MultiLineString"),"Point"!==p&&"MultiPoint"!==p||(p=3===f.length?"Point":"MultiPoint"),l.push(V(h.id,p,f,h.tags))}}}return l.length?l:null}function X(t,e,i,n,r){for(var o=0;o<t.length;o+=3){var s=t[o+r];s>=i&&s<=n&&(e.push(t[o]),e.push(t[o+1]),e.push(t[o+2]))}}function K(t,e,i,n,r,o,s){for(var a,l,c=Y(t),h=0===r?tt:et,u=t.start,p=0;p<t.length-3;p+=3){var d=t[p],m=t[p+1],f=t[p+2],g=t[p+3],_=t[p+4],y=0===r?d:m,v=0===r?g:_,x=!1;s&&(a=Math.sqrt(Math.pow(d-g,2)+Math.pow(m-_,2))),y<i?v>i&&(l=h(c,d,m,g,_,i),s&&(c.start=u+a*l)):y>n?v<n&&(l=h(c,d,m,g,_,n),s&&(c.start=u+a*l)):Q(c,d,m,f),v<i&&y>=i&&(l=h(c,d,m,g,_,i),x=!0),v>n&&y<=n&&(l=h(c,d,m,g,_,n),x=!0),!o&&x&&(s&&(c.end=u+a*l),e.push(c),c=Y(t)),s&&(u+=a)}var b=t.length-3;d=t[b],m=t[b+1],f=t[b+2],(y=0===r?d:m)>=i&&y<=n&&Q(c,d,m,f),b=c.length-3,o&&b>=3&&(c[b]!==c[0]||c[b+1]!==c[1])&&Q(c,c[0],c[1],c[2]),c.length&&e.push(c)}function Y(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function J(t,e,i,n,r,o){for(var s=0;s<t.length;s++)K(t[s],e,i,n,r,o,!1)}function Q(t,e,i,n){t.push(e),t.push(i),t.push(n)}function tt(t,e,i,n,r,o){var s=(o-e)/(n-e);return t.push(o),t.push(i+(r-i)*s),t.push(1),s}function et(t,e,i,n,r,o){var s=(o-i)/(r-i);return t.push(e+(n-e)*s),t.push(o),t.push(1),s}function it(t,e){for(var i=[],n=0;n<t.length;n++){var r,o=t[n],s=o.type;if("Point"===s||"MultiPoint"===s||"LineString"===s)r=nt(o.geometry,e);else if("MultiLineString"===s||"Polygon"===s){r=[];for(var a=0;a<o.geometry.length;a++)r.push(nt(o.geometry[a],e))}else if("MultiPolygon"===s)for(r=[],a=0;a<o.geometry.length;a++){for(var l=[],c=0;c<o.geometry[a].length;c++)l.push(nt(o.geometry[a][c],e));r.push(l)}i.push(V(o.id,s,r,o.tags))}return i}function nt(t,e){var i=[];i.size=t.size,void 0!==t.start&&(i.start=t.start,i.end=t.end);for(var n=0;n<t.length;n+=3)i.push(t[n]+e,t[n+1],t[n+2]);return i}function rt(t,e){if(t.transformed)return t;var i,n,r,o=1<<t.z,s=t.x,a=t.y;for(i=0;i<t.features.length;i++){var l=t.features[i],c=l.geometry,h=l.type;if(l.geometry=[],1===h)for(n=0;n<c.length;n+=2)l.geometry.push(ot(c[n],c[n+1],e,o,s,a));else for(n=0;n<c.length;n++){var u=[];for(r=0;r<c[n].length;r+=2)u.push(ot(c[n][r],c[n][r+1],e,o,s,a));l.geometry.push(u)}}return t.transformed=!0,t}function ot(t,e,i,n,r,o){return[Math.round(i*(t*n-r)),Math.round(i*(e*n-o))]}function st(t,e,i,n,r){for(var o=e===r.maxZoom?0:r.tolerance/((1<<e)*r.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:i,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},a=0;a<t.length;a++){s.numFeatures++,at(s,t[a],o,r);var l=t[a].minX,c=t[a].minY,h=t[a].maxX,u=t[a].maxY;l<s.minX&&(s.minX=l),c<s.minY&&(s.minY=c),h>s.maxX&&(s.maxX=h),u>s.maxY&&(s.maxY=u)}return s}function at(t,e,i,n){var r=e.geometry,o=e.type,s=[];if("Point"===o||"MultiPoint"===o)for(var a=0;a<r.length;a+=3)s.push(r[a]),s.push(r[a+1]),t.numPoints++,t.numSimplified++;else if("LineString"===o)lt(s,r,t,i,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(a=0;a<r.length;a++)lt(s,r[a],t,i,"Polygon"===o,0===a);else if("MultiPolygon"===o)for(var l=0;l<r.length;l++){var c=r[l];for(a=0;a<c.length;a++)lt(s,c[a],t,i,!0,0===a)}if(s.length){var h=e.tags||null;if("LineString"===o&&n.lineMetrics){for(var u in h={},e.tags)h[u]=e.tags[u];h.mapbox_clip_start=r.start/r.size,h.mapbox_clip_end=r.end/r.size}var p={geometry:s,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:h};null!==e.id&&(p.id=e.id),t.features.push(p)}}function lt(t,e,i,n,r,o){var s=n*n;if(n>0&&e.size<(r?s:n))i.numPoints+=e.length/3;else{for(var a=[],l=0;l<e.length;l+=3)(0===n||e[l+2]>s)&&(i.numSimplified++,a.push(e[l]),a.push(e[l+1])),i.numPoints++;r&&function(t,e){for(var i=0,n=0,r=t.length,o=r-2;n<r;o=n,n+=2)i+=(t[n]-t[o])*(t[n+1]+t[o+1]);if(i>0===e)for(n=0,r=t.length;n<r/2;n+=2){var s=t[n],a=t[n+1];t[n]=t[r-2-n],t[n+1]=t[r-1-n],t[r-2-n]=s,t[r-1-n]=a}}(a,o),t.push(a)}}function ct(t,e){var i=(e=this.options=function(t,e){for(var i in e)t[i]=e[i];return t}(Object.create(this.options),e)).debug;if(i&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)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 n=function(t,e){var i=[];if("FeatureCollection"===t.type)for(var n=0;n<t.features.length;n++)Z(i,t.features[n],e,n);else Z(i,"Feature"===t.type?t:{geometry:t},e);return i}(t,e);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),n=function(t,e){var i=e.buffer/e.extent,n=t,r=W(t,1,-1-i,i,0,-1,2,e),o=W(t,1,1-i,2+i,0,-1,2,e);return(r||o)&&(n=W(t,1,-i,1+i,0,-1,2,e)||[],r&&(n=it(r,1).concat(n)),o&&(n=n.concat(it(o,-1)))),n}(n,e),n.length&&this.splitTile(n,0,0,0),i&&(n.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function ht(t,e,i){return 32*((1<<t)*i+e)+t}function ut(t,e){return e?t.properties[e]:t.id}function pt(t,e){if(null==t)return!0;if("Feature"===t.type)return null!=ut(t,e);if("FeatureCollection"===t.type){const i=new Set;for(const n of t.features){const t=ut(n,e);if(null==t)return!1;if(i.has(t))return!1;i.add(t)}return!0}return!1}function dt(t,e){const i=new Map;if(null==t);else if("Feature"===t.type)i.set(ut(t,e),t);else for(const n of t.features)i.set(ut(n,e),n);return i}function mt(e,i){const n=e.tileID.canonical;if(!this._geoJSONIndex)return i(null,null);const r=this._geoJSONIndex.getTile(n.z,n.x,n.y);if(!r)return i(null,null);const o=new class{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=t.EXTENT,this.length=e.length,this._features=e}feature(e){return new class{constructor(e){this._feature=e,this.extent=t.EXTENT,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.Point(i[0],i[1])]);return e}{const e=[];for(const i of this._feature.geometry){const n=[];for(const e of i)n.push(new t.Point(e[0],e[1]));e.push(n)}return e}}toGeoJSON(t,e,i){return u.call(this,t,e,i)}}(this._features[e])}}(r.features);let s=C(o);0===s.byteOffset&&s.byteLength===s.buffer.byteLength||(s=new Uint8Array(s)),i(null,{vectorTile:o,rawData:s.buffer})}ct.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},ct.prototype.splitTile=function(t,e,i,n,r,o,s){for(var a=[t,e,i,n],l=this.options,c=l.debug;a.length;){n=a.pop(),i=a.pop(),e=a.pop(),t=a.pop();var h=1<<e,u=ht(e,i,n),p=this.tiles[u];if(!p&&(c>1&&console.time("creation"),p=this.tiles[u]=st(t,e,i,n,l),this.tileCoords.push({z:e,x:i,y:n}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,i,n,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var d="z"+e;this.stats[d]=(this.stats[d]||0)+1,this.total++}if(p.source=t,r){if(e===l.maxZoom||e===r)continue;var m=1<<r-e;if(i!==Math.floor(o/m)||n!==Math.floor(s/m))continue}else if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue;if(p.source=null,0!==t.length){c>1&&console.time("clipping");var f,g,_,y,v,x,b=.5*l.buffer/l.extent,w=.5-b,T=.5+b,E=1+b;f=g=_=y=null,v=W(t,h,i-b,i+T,0,p.minX,p.maxX,l),x=W(t,h,i+w,i+E,0,p.minX,p.maxX,l),t=null,v&&(f=W(v,h,n-b,n+T,1,p.minY,p.maxY,l),g=W(v,h,n+w,n+E,1,p.minY,p.maxY,l),v=null),x&&(_=W(x,h,n-b,n+T,1,p.minY,p.maxY,l),y=W(x,h,n+w,n+E,1,p.minY,p.maxY,l),x=null),c>1&&console.timeEnd("clipping"),a.push(f||[],e+1,2*i,2*n),a.push(g||[],e+1,2*i,2*n+1),a.push(_||[],e+1,2*i+1,2*n),a.push(y||[],e+1,2*i+1,2*n+1)}}},ct.prototype.getTile=function(t,e,i){var n=this.options,r=n.extent,o=n.debug;if(t<0||t>24)return null;var s=1<<t,a=ht(t,e=(e%s+s)%s,i);if(this.tiles[a])return rt(this.tiles[a],r);o>1&&console.log("drilling down to z%d-%d-%d",t,e,i);for(var l,c=t,h=e,u=i;!l&&c>0;)c--,h=Math.floor(h/2),u=Math.floor(u/2),l=this.tiles[ht(c,h,u)];return l&&l.source?(o>1&&console.log("found parent tile z%d-%d-%d",c,h,u),o>1&&console.time("drilling down"),this.splitTile(l.source,c,h,u,t,e,i),o>1&&console.timeEnd("drilling down"),this.tiles[a]?rt(this.tiles[a],r):null):null};class ft extends s{constructor(e,i,n,r){super(e,i,n,mt),this._dataUpdateable=new Map,this.loadGeoJSON=(e,i)=>{const{promoteId:n}=e;if(e.request)return t.getJSON(e.request,((t,e,r,o)=>{this._dataUpdateable=pt(e,n)?dt(e,n):void 0,i(t,e,r,o)}));if("string"==typeof e.data)try{const t=JSON.parse(e.data);this._dataUpdateable=pt(t,n)?dt(t,n):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 n,r,o,s;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=ut(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===(r=i.addOrUpdateProperties)||void 0===r?void 0:r.length)>0);if((i.newGeometry||i.removeAllProperties||a)&&(e={...e},t.set(i.id,e),a&&(e.properties={...e.properties})),i.newGeometry&&(e.geometry=i.newGeometry),i.removeAllProperties)e.properties={};else if((null===(o=i.removeProperties)||void 0===o?void 0:o.length)>0)for(const t of i.removeProperties)Object.prototype.hasOwnProperty.call(e.properties,t)&&delete e.properties[t];if((null===(s=i.addOrUpdateProperties)||void 0===s?void 0:s.length)>0)for(const{key:t,value:n}of i.addOrUpdateProperties)e.properties[t]=n}}(this._dataUpdateable,e.dataDiff,n),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:()=>{}}},r&&(this.loadGeoJSON=r)}loadData(e,i){var n;null===(n=this._pendingRequest)||void 0===n||n.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const r=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.RequestPerformance(e.request);this._pendingCallback=i,this._pendingRequest=this.loadGeoJSON(e,((n,o)=>{if(delete this._pendingCallback,delete this._pendingRequest,n||!o)return i(n);if("object"!=typeof o)return i(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`));{h(o,!0);try{if(e.filter){const i=t.createExpression(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 n=o.features.filter((t=>i.value.evaluate({zoom:0},t)));o={type:"FeatureCollection",features:n}}this._geoJSONIndex=e.cluster?new k(function({superclusterOptions:e,clusterProperties:i}){if(!i||!e)return e;const n={},r={},o={accumulated:null,zoom:0},s={properties:null},a=Object.keys(i);for(const e of a){const[o,s]=i[e],a=t.createExpression(s),l=t.createExpression("string"==typeof o?[o,["accumulated"],["get",e]]:o);n[e]=a.value,r[e]=l.value}return e.map=t=>{s.properties=t;const e={};for(const t of a)e[t]=n[t].evaluate(o,s);return e},e.reduce=(t,e)=>{s.properties=e;for(const e of a)o.accumulated=t[e],t[e]=r[e].evaluate(o,s)},e}(e)).load(o.features):function(t,e){return new ct(t,e)}(o,e.geojsonVtOptions)}catch(n){return i(n)}this.loaded={};const s={};if(r){const t=r.finish();t&&(s.resourceTiming={},s.resourceTiming[e.source]=JSON.parse(JSON.stringify(t)))}i(null,s)}}))}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 gt{constructor(e){this.self=e,this.actor=new t.Actor(e,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:s,geojson:ft},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.plugin.isParsed())throw new Error("RTL text plugin already registered.");t.plugin.applyArabicShaping=e.applyArabicShaping,t.plugin.processBidirectionalText=e.processBidirectionalText,t.plugin.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 n=this.workerSources[t][i];for(const t in n)n[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 n=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==n.removeSource?n.removeSource(e,i):i()}loadWorkerSource(t,e,i){try{this.self.importScripts(e.url),i()}catch(t){i(t.toString())}}syncRTLPluginState(e,i,n){try{t.plugin.setState(i);const e=t.plugin.getPluginURL();if(t.plugin.isLoaded()&&!t.plugin.isParsed()&&null!=e){this.self.importScripts(e);const i=t.plugin.isParsed();n(i?void 0:new Error(`RTL Text Plugin failed to import scripts from ${e}`),i)}}catch(t){n(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){if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),!this.workerSources[t][e][i]){const n={send:(e,i,n)=>{this.actor.send(e,i,n,t)}};this.workerSources[t][e][i]=new this.workerSourceTypes[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 a),this.demWorkerSources[t][e]}}return t.isWorker()&&(self.worker=new gt(self)),gt})),n(0,(function(t){class e{static testProp(t){if(!e.docStyle)return t[0];for(let i=0;i<t.length;i++)if(t[i]in e.docStyle)return t[i];return t[0]}static create(t,e,i){const n=window.document.createElement(t);return void 0!==e&&(n.className=e),i&&i.appendChild(n),n}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){e.docStyle&&e.selectProp&&(e.userSelect=e.docStyle[e.selectProp],e.docStyle[e.selectProp]="none")}static enableDrag(){e.docStyle&&e.selectProp&&(e.docStyle[e.selectProp]=e.userSelect)}static setTransform(t,i){t.style[e.transformProp]=i}static addEventListener(t,e,i,n={}){t.addEventListener(e,i,"passive"in n?n:n.capture)}static removeEventListener(t,e,i,n={}){t.removeEventListener(e,i,"passive"in n?n:n.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",e.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",e.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",e.suppressClickInternal,!0)}),0)}static mousePos(e,i){const n=e.getBoundingClientRect();return new t.Point(i.clientX-n.left-e.clientLeft,i.clientY-n.top-e.clientTop)}static touchPos(e,i){const n=e.getBoundingClientRect(),r=[];for(let o=0;o<i.length;o++)r.push(new t.Point(i[o].clientX-n.left-e.clientLeft,i[o].clientY-n.top-e.clientTop));return r}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}e.docStyle="undefined"!=typeof window&&window.document&&window.document.documentElement.style,e.selectProp=e.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),e.transformProp=e.testProp(["transform","WebkitTransform"]);const i={supported:!1,testSupport:function(t){!o&&r&&(s?a(t):n=t)}};let n,r,o=!1,s=!1;function a(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r),t.isContextLost())return;i.supported=!0}catch(t){}t.deleteTexture(e),o=!0}var l,c;"undefined"!=typeof document&&(r=document.createElement("img"),r.onload=function(){n&&a(n),n=null,s=!0},r.onerror=function(){o=!0,n=null},r.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(e){let n,r,o,s;e.resetRequestQueue=()=>{n=[],r=0,o=0,s={}},e.addThrottleControl=t=>{const e=o++;return s[e]=t,e},e.removeThrottleControl=t=>{delete s[t],c()},e.getImage=(t,e,o=!0)=>{i.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*");const s={requestParameters:t,supportImageRefresh:o,callback:e,cancelled:!1,completed:!1,cancel:()=>{s.completed||s.cancelled||(s.cancelled=!0,s.innerRequest&&(s.innerRequest.cancel(),r--),c())}};return n.push(s),c(),s};const a=e=>{const{requestParameters:i,supportImageRefresh:n,callback:r}=e;return t.extend(i,{type:"image"}),(!1!==n||t.isWorker()||t.getProtocolAction(i.url)||i.headers&&!Object.keys(i.headers).reduce(((t,e)=>t&&"accept"===e),!0)?t.makeRequest:h)(i,((t,i,n,o)=>{l(e,r,t,i,n,o)}))},l=(e,i,n,o,s,a)=>{n?i(n):o instanceof HTMLImageElement||t.isImageBitmap(o)?i(null,o):o&&((e,i)=>{"function"==typeof createImageBitmap?t.arrayBufferToImageBitmap(e,i):t.arrayBufferToImage(e,i)})(o,((t,e)=>{null!=t?i(t):null!=e&&i(null,e,{cacheControl:s,expires:a})})),e.cancelled||(e.completed=!0,r--,c())},c=()=>{const e=(()=>{const t=Object.keys(s);let e=!1;if(t.length>0)for(const i of t)if(e=s[i](),e)break;return e})()?t.config.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:t.config.MAX_PARALLEL_IMAGE_REQUESTS;for(let t=r;t<e&&n.length>0;t++){const e=n.shift();if(e.cancelled){t--;continue}const i=a(e);r++,e.innerRequest=i}},h=(e,i)=>{const n=new Image,r=e.url;let o=!1;const s=e.credentials;return s&&"include"===s?n.crossOrigin="use-credentials":(s&&"same-origin"===s||!t.sameOrigin(r))&&(n.crossOrigin="anonymous"),n.fetchPriority="high",n.onload=()=>{i(null,n),n.onerror=n.onload=null},n.onerror=()=>{o||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.")),n.onerror=n.onload=null},n.src=r,{cancel:()=>{o=!0,n.src=""}}}}(l||(l={})),l.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"}(c||(c={}));class h{constructor(t){this._transformRequestFn=t}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}normalizeSpriteURL(t,e,i){const n=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 n.path+=`${e}${i}`,function(t){const e=t.params.length?`?${t.params.join("&")}`:"";return`${t.protocol}://${t.authority}${t.path}${e}`}(n)}setTransformRequest(t){this._transformRequestFn=t}}const u=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function p(e){var i=new t.ARRAY_TYPE(3);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i}var d,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};d=new t.ARRAY_TYPE(3),t.ARRAY_TYPE!=Float32Array&&(d[0]=0,d[1]=0,d[2]=0);var f=function(t){var e=t[0],i=t[1];return e*e+i*i};function g(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:r}of t){const t=`${n}${r}`;-1===i.indexOf(t)&&(i.push(t),e.push({id:n,url:r}))}}return e}function _(e,i,n,r,o){if(r)return void e(r);if(o!==Object.values(i).length||o!==Object.values(n).length)return;const s={};for(const e in i){s[e]={};const r=t.browser.getImageCanvasContext(n[e]),o=i[e];for(const t in o){const{width:i,height:n,x:a,y:l,sdf:c,pixelRatio:h,stretchX:u,stretchY:p,content:d}=o[t];s[e][t]={data:null,pixelRatio:h,sdf:c,stretchX:u,stretchY:p,content:d,spriteData:{width:i,height:n,x:a,y:l,context:r}}}}e(null,s)}!function(){var e=new t.ARRAY_TYPE(2);t.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0)}();class y{constructor(t,e,i,n){this.context=t,this.format=i,this.texture=t.gl.createTexture(),this.update(e,n)}update(e,i,n){const{width:r,height:o}=e,s=!(this.size&&this.size[0]===r&&this.size[1]===o||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)),s)this.size=[r,o],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.isImageBitmap(e)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,e):l.texImage2D(l.TEXTURE_2D,0,this.format,r,o,0,this.format,l.UNSIGNED_BYTE,e.data);else{const{x:i,y:s}=n||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.isImageBitmap(e)?l.texSubImage2D(l.TEXTURE_2D,0,i,s,l.RGBA,l.UNSIGNED_BYTE,e):l.texSubImage2D(l.TEXTURE_2D,0,i,s,r,o,l.RGBA,l.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D)}bind(t,e,i){const{context:n}=this,{gl:r}=n;r.bindTexture(r.TEXTURE_2D,this.texture),i!==r.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=r.LINEAR),t!==this.filter&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,i||t),this.filter=t),e!==this.wrap&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,e),r.texParameteri(r.TEXTURE_2D,r.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 v(t){const{userImage:e}=t;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}class x extends t.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({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.RGBAImage({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 n=!0;const r=i.data||i.spriteData;return this._validateStretch(i.stretchX,r&&r.width)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "stretchX" value`))),n=!1),this._validateStretch(i.stretchY,r&&r.height)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "stretchY" value`))),n=!1),this._validateContent(i.content,i)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" 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]<i||n[1]<n[0]||e<n[1])return!1;i=n[1]}return!0}_validateContent(t,e){if(!t)return!0;if(4!==t.length)return!1;const i=e.spriteData,n=i&&i.width||e.data.width,r=i&&i.height||e.data.height;return!(t[0]<0||n<t[0]||t[1]<0||r<t[1]||t[2]<0||n<t[2]||t[3]<0||r<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,e,i=!0){const n=this.getImage(t);if(i&&(n.data.width!==e.data.width||n.data.height!==e.data.height))throw new Error(`size mismatch between old image (${n.data.width}x${n.data.height}) and new image (${e.data.width}x${e.data.height}).`);e.version=n.version+1,this.images[t]=e,this.updatedImages[t]=!0}removeImage(t){const e=this.images[t];delete this.images[t],delete this.patterns[t],e.userImage&&e.userImage.onRemove&&e.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,e){let i=!0;if(!this.isLoaded())for(const e of t)this.images[e]||(i=!1);this.isLoaded()||i?this._notify(t,e):this.requestors.push({ids:t,callback:e})}_notify(e,i){const n={};for(const i of e){let e=this.getImage(i);e||(this.fire(new t.Event("styleimagemissing",{id:i})),e=this.getImage(i)),e?n[i]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,hasRenderCallback:Boolean(e.userImage&&e.userImage.render)}:t.warnOnce(`Image "${i}" 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.`)}i(null,n)}getPixelSize(){const{width:t,height:e}=this.atlasImage;return{width:t,height:e}}getPattern(e){const i=this.patterns[e],n=this.getImage(e);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},r=new t.ImagePosition(i,n);this.patterns[e]={bin:i,position:r}}return this._updatePatternAtlas(),this.patterns[e].position}bind(t){const e=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new y(t,this.atlasImage,e.RGBA),this.atlasTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const t in this.patterns)e.push(this.patterns[t].bin);const{w:i,h:n}=t.potpack(e),r=this.atlasImage;r.resize({width:i||1,height:n||1});for(const e in this.patterns){const{bin:i}=this.patterns[e],n=i.x+1,o=i.y+1,s=this.getImage(e).data,a=s.width,l=s.height;t.RGBAImage.copy(s,r,{x:0,y:0},{x:n,y:o},{width:a,height:l}),t.RGBAImage.copy(s,r,{x:0,y:l-1},{x:n,y:o-1},{width:a,height:1}),t.RGBAImage.copy(s,r,{x:0,y:0},{x:n,y:o+l},{width:a,height:1}),t.RGBAImage.copy(s,r,{x:a-1,y:0},{x:n-1,y:o},{width:1,height:l}),t.RGBAImage.copy(s,r,{x:0,y:0},{x:n+a,y:o},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const i of e){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const e=this.getImage(i);e||t.warnOnce(`Image with ID: "${i}" was not found`),v(e)&&this.updateImage(i,e)}}}const b=1e20;function w(t,e,i,n,r,o,s,a,l){for(let c=e;c<e+n;c++)T(t,i*o+c,o,r,s,a,l);for(let c=i;c<i+r;c++)T(t,c*o+e,1,n,s,a,l)}function T(t,e,i,n,r,o,s){o[0]=0,s[0]=-b,s[1]=b,r[0]=t[e];for(let a=1,l=0,c=0;a<n;a++){r[a]=t[e+a*i];const n=a*a;do{const t=o[l];c=(r[a]-r[t]+n-t*t)/(a-t)/2}while(c<=s[l]&&--l>-1);l++,o[l]=a,s[l]=c,s[l+1]=b}for(let a=0,l=0;a<n;a++){for(;s[l+1]<a;)l++;const n=o[l],c=a-n;t[e+a*i]=r[n]+c*c}}class E{constructor(t,e){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={}}setURL(t){this.url=t}getGlyphs(e,i){const n=[];for(const t in e)for(const i of e[t])n.push({stack:t,id:i});t.asyncAll(n,(({stack:t,id:e},i)=>{let n=this.entries[t];n||(n=this.entries[t]={glyphs:{},requests:{},ranges:{}});let r=n.glyphs[e];if(void 0!==r)return void i(null,{stack:t,id:e,glyph:r});if(r=this._tinySDF(n,t,e),r)return n.glyphs[e]=r,void i(null,{stack:t,id:e,glyph:r});const o=Math.floor(e/256);if(256*o>65535)return void i(new Error("glyphs > 65535 not supported"));if(n.ranges[o])return void i(null,{stack:t,id:e,glyph:r});if(!this.url)return void i(new Error("glyphsUrl is not set"));let s=n.requests[o];s||(s=n.requests[o]=[],E.loadGlyphRange(t,o,this.url,this.requestManager,((t,e)=>{if(e){for(const t in e)this._doesCharSupportLocalGlyph(+t)||(n.glyphs[+t]=e[+t]);n.ranges[o]=!0}for(const i of s)i(t,e);delete n.requests[o]}))),s.push(((n,r)=>{n?i(n):r&&i(null,{stack:t,id:e,glyph:r[e]||null})}))}),((t,e)=>{if(t)i(t);else if(e){const t={};for(const{stack:i,id:n,glyph:r}of e)(t[i]||(t[i]={}))[n]=r&&{id:r.id,bitmap:r.bitmap.clone(),metrics:r.metrics};i(null,t)}}))}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(t.unicodeBlockLookup["CJK Unified Ideographs"](e)||t.unicodeBlockLookup["Hangul Syllables"](e)||t.unicodeBlockLookup.Hiragana(e)||t.unicodeBlockLookup.Katakana(e))}_tinySDF(e,i,n){const r=this.localIdeographFontFamily;if(!r)return;if(!this._doesCharSupportLocalGlyph(n))return;let o=e.tinySDF;if(!o){let t="400";/bold/i.test(i)?t="900":/medium/i.test(i)?t="500":/light/i.test(i)&&(t="200"),o=e.tinySDF=new E.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:r,fontWeight:t})}const s=o.draw(String.fromCharCode(n));return{id:n,bitmap:new t.AlphaImage({width:s.width||30,height:s.height||30},s.data),metrics:{width:s.glyphWidth||24,height:s.glyphHeight||24,left:s.glyphLeft||0,top:s.glyphTop-27||-8,advance:s.glyphAdvance||24}}}}E.loadGlyphRange=function(e,i,n,r,o){const s=256*i,a=s+255,l=r.transformRequest(n.replace("{fontstack}",e).replace("{range}",`${s}-${a}`),c.Glyphs);t.getArrayBuffer(l,((e,i)=>{if(e)o(e);else if(i){const e={};for(const n of t.parseGlyphPbf(i))e[n.id]=n;o(null,e)}}))},E.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:n=.25,fontFamily:r="sans-serif",fontWeight:o="normal",fontStyle:s="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=`${s} ${o} ${t}px ${r}`,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:r,actualBoundingBoxRight:o}=this.ctx.measureText(t),s=Math.ceil(i),a=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-r))),l=Math.min(this.size-this.buffer,s+Math.ceil(n)),c=a+2*this.buffer,h=l+2*this.buffer,u=Math.max(c*h,0),p=new Uint8ClampedArray(u),d={data:p,width:c,height:h,glyphWidth:a,glyphHeight:l,glyphTop:s,glyphLeft:0,glyphAdvance:e};if(0===a||0===l)return d;const{ctx:m,buffer:f,gridInner:g,gridOuter:_}=this;m.clearRect(f,f,a,l),m.fillText(t,f,f+s);const y=m.getImageData(f,f,a,l);_.fill(b,0,u),g.fill(0,0,u);for(let t=0;t<l;t++)for(let e=0;e<a;e++){const i=y.data[4*(t*a+e)+3]/255;if(0===i)continue;const n=(t+f)*c+e+f;if(1===i)_[n]=0,g[n]=b;else{const t=.5-i;_[n]=t>0?t*t:0,g[n]=t<0?t*t:0}}w(_,0,0,c,h,c,this.f,this.v,this.z),w(g,f,f,a,l,c,this.f,this.v,this.z);for(let t=0;t<u;t++){const e=Math.sqrt(_[t])-Math.sqrt(g[t]);p[t]=Math.round(255-255*(e/this.radius+this.cutoff))}return d}};class S{constructor(){this.specification=t.v8Spec.light.position}possiblyEvaluate(e,i){return t.sphericalToCartesian(e.expression.evaluate(i))}interpolate(e,i,n){return{x:t.interpolate.number(e.x,i.x,n),y:t.interpolate.number(e.y,i.y,n),z:t.interpolate.number(e.z,i.z,n)}}}let P,z;class C extends t.Evented{constructor(e){super(),P=P||new t.Properties({anchor:new t.DataConstantProperty(t.v8Spec.light.anchor),position:new S,color:new t.DataConstantProperty(t.v8Spec.light.color),intensity:new t.DataConstantProperty(t.v8Spec.light.intensity)}),this._transitionable=new t.Transitionable(P),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i={}){if(!this._validate(t.validateLight,e,i))for(const t in e){const i=e[t];t.endsWith("-transition")?this._transitionable.setTransition(t.slice(0,-11),i):this._transitionable.setValue(t,i)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(e,i,n){return(!n||!1!==n.validate)&&t.emitValidationErrors(this,e.call(t.validateStyle,t.extend({value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.v8Spec})))}}class M{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,e){const i=t.join(",")+String(e);return this.dashEntry[i]||(this.dashEntry[i]=this.addDash(t,e)),this.dashEntry[i]}getDashRanges(t,e,i){const n=[];let r=t.length%2==1?-t[t.length-1]*i:0,o=t[0]*i,s=!0;n.push({left:r,right:o,isDash:s,zeroLength:0===t[0]});let a=t[0];for(let e=1;e<t.length;e++){s=!s;const l=t[e];r=a*i,a+=l,o=a*i,n.push({left:r,right:o,isDash:s,zeroLength:0===l})}return n}addRoundDash(t,e,i){const n=e/2;for(let e=-i;e<=i;e++){const r=this.width*(this.nextRow+i+e);let o=0,s=t[o];for(let a=0;a<this.width;a++){a/s.right>1&&(s=t[++o]);const l=Math.abs(a-s.left),c=Math.abs(a-s.right),h=Math.min(l,c);let u;const p=e/i*(n+1);if(s.isDash){const t=n-Math.abs(p);u=Math.sqrt(h*h+t*t)}else u=n-Math.sqrt(h*h+p*p);this.data[r+a]=Math.max(0,Math.min(255,u+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 r=0,o=t[r];for(let e=0;e<this.width;e++){e/o.right>1&&(o=t[++r]);const i=Math.abs(e-o.left),s=Math.abs(e-o.right),a=Math.min(i,s);this.data[n+e]=Math.max(0,Math.min(255,(o.isDash?a:-a)+128))}}addDash(e,i){const n=i?7:0,r=2*n+1;if(this.nextRow+r>this.height)return t.warnOnce("LineAtlas out of space"),null;let o=0;for(let t=0;t<e.length;t++)o+=e[t];if(0!==o){const t=this.width/o,r=this.getDashRanges(e,this.width,t);i?this.addRoundDash(r,t,n):this.addRegularDash(r)}const s={y:(this.nextRow+n+.5)/this.height,height:2*n/this.height,width:o};return this.nextRow+=r,this.dirty=!0,s}bind(t){const e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.ALPHA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,this.width,this.height,0,e.ALPHA,e.UNSIGNED_BYTE,this.data))}}class I{constructor(t,e,i){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=i;const n=this.workerPool.acquire(i);for(let t=0;t<n.length;t++){const r=new I.Actor(n[t],e,i);r.name=`Worker ${t}`,this.actors.push(r)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,i,n){t.asyncAll(this.actors,((t,n)=>{t.send(e,i,n)}),n=n||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 A(e,i,n){const r=function(i,r){if(i)return n(i);if(r){const i=t.pick(t.extend(r,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);r.vector_layers&&(i.vectorLayers=r.vector_layers,i.vectorLayerIds=i.vectorLayers.map((t=>t.id))),n(null,i)}};return e.url?t.getJSON(i.transformRequest(e.url,c.Source),r):t.browser.frame((()=>r(null,e)))}I.Actor=t.Actor;class k{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.LngLat?new t.LngLat(e.lng,e.lat):t.LngLat.convert(e),this}setSouthWest(e){return this._sw=e instanceof t.LngLat?new t.LngLat(e.lng,e.lat):t.LngLat.convert(e),this}extend(e){const i=this._sw,n=this._ne;let r,o;if(e instanceof t.LngLat)r=e,o=e;else{if(!(e instanceof k))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(k.convert(e)):this.extend(t.LngLat.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(t.LngLat.convert(e)):this;if(r=e._sw,o=e._ne,!r||!o)return this}return i||n?(i.lng=Math.min(r.lng,i.lng),i.lat=Math.min(r.lat,i.lat),n.lng=Math.max(o.lng,n.lng),n.lat=Math.max(o.lat,n.lat)):(this._sw=new t.LngLat(r.lng,r.lat),this._ne=new t.LngLat(o.lng,o.lat)),this}getCenter(){return new t.LngLat((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.LngLat(this.getWest(),this.getNorth())}getSouthEast(){return new t.LngLat(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:n}=t.LngLat.convert(e);let r=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(r=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&r}static convert(t){return t instanceof k?t:t?new k(t):t}static fromLngLat(e,i=0){const n=360*i/40075017,r=n/Math.cos(Math.PI/180*e.lat);return new k(new t.LngLat(e.lng-r,e.lat-n),new t.LngLat(e.lng+r,e.lat+n))}}class L{constructor(t,e,i){this.bounds=k.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),n=Math.floor(t.mercatorXfromLng(this.bounds.getWest())*i),r=Math.floor(t.mercatorYfromLat(this.bounds.getNorth())*i),o=Math.ceil(t.mercatorXfromLng(this.bounds.getEast())*i),s=Math.ceil(t.mercatorYfromLat(this.bounds.getSouth())*i);return e.x>=n&&e.x<o&&e.y>=r&&e.y<s}}class D extends t.Evented{constructor(e,i,n,r){if(super(),this.load=()=>{this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=A(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.ErrorEvent(e)):i&&(t.extend(this,i),i.bounds&&(this.tileBounds=new L(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))}))},this.serialize=()=>t.extend({},this._options),this.id=e,this.dispatcher=n,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.extend(this,t.pick(i,["url","scheme","tileSize","promoteId"])),this._options=t.extend({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(r)}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),n={request:this.map._requestManager.transformRequest(i,c.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 r(i,n){return delete t.request,t.aborted?e(null):i&&404!==i.status?e(i):(n&&n.resourceTiming&&(t.resourceTiming=n.resourceTiming),this.map._refreshExpiredTiles&&n&&t.setExpiryData(n),t.loadVectorData(n,this.map.painter),e(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}n.request.collectResourceTiming=this._collectResourceTiming,t.actor&&"expired"!==t.state?"loading"===t.state?t.reloadCallback=e:t.request=t.actor.send("reloadTile",n,r.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",n,r.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 B extends t.Evented{constructor(e,i,n,r){super(),this.id=e,this.dispatcher=n,this.setEventedParent(r),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=t.extend({type:"raster"},i),t.extend(this,t.pick(i,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=A(this._options,this.map._requestManager,((e,i)=>{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):i&&(t.extend(this,i),i.bounds&&(this.tileBounds=new L(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("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)}serialize(){return t.extend({},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=l.getImage(this.map._requestManager.transformRequest(i,c.Tile),((i,n,r)=>{if(delete t.request,t.aborted)t.state="unloaded",e(null);else if(i)t.state="errored",e(i);else if(n){this.map._refreshExpiredTiles&&r&&t.setExpiryData(r);const i=this.map.painter.context,o=i.gl;t.texture=this.map.painter.getTileTexture(n.width),t.texture?t.texture.update(n,{useMipmap:!0}):(t.texture=new y(i,n,o.RGBA,{useMipmap:!0}),t.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),i.extTextureFilterAnisotropic&&o.texParameterf(o.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 R extends B{constructor(e,i,n,r){super(e,i,n,r),this.type="raster-dem",this.maxzoom=22,this._options=t.extend({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox"}loadTile(e,i){const n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function r(t,n){t&&(e.state="errored",i(t)),n&&(e.dem=n,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded",i(null))}e.request=l.getImage(this.map._requestManager.transformRequest(n,c.Tile),function(n,o){if(delete e.request,e.aborted)e.state="unloaded",i(null);else if(n)e.state="errored",i(n);else if(o){this.map._refreshExpiredTiles&&e.setExpiryData(o),delete o.cacheControl,delete o.expires;const i=t.isImageBitmap(o)&&(null==z&&(z="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),z)?o:t.browser.getImageData(o,1),n={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:i,encoding:this.encoding};e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",n,r.bind(this)))}}.bind(this),this.map._refreshExpiredTiles),e.neighboringTiles=this._getNeighboringTiles(e.tileID)}_getNeighboringTiles(e){const i=e.canonical,n=Math.pow(2,i.z),r=(i.x-1+n)%n,o=0===i.x?e.wrap-1:e.wrap,s=(i.x+1+n)%n,a=i.x+1===n?e.wrap+1:e.wrap,l={};return l[new t.OverscaledTileID(e.overscaledZ,o,i.z,r,i.y).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,a,i.z,s,i.y).key]={backfilled:!1},i.y>0&&(l[new t.OverscaledTileID(e.overscaledZ,o,i.z,r,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,a,i.z,s,i.y-1).key]={backfilled:!1}),i.y+1<n&&(l[new t.OverscaledTileID(e.overscaledZ,o,i.z,r,i.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,a,i.z,s,i.y+1).key]={backfilled:!1}),l}unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})}}class F extends t.Evented{constructor(e,i,n,r){super(),this.load=()=>{this._updateWorkerData()},this.serialize=()=>t.extend({},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=n.getActor(),this.setEventedParent(r),this._data=i.data,this._options=t.extend({},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 o=t.EXTENT/this.tileSize;this.workerOptions=t.extend({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:(void 0!==i.buffer?i.buffer:128)*o,tolerance:(void 0!==i.tolerance?i.tolerance:.375)*o,extent:t.EXTENT,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.EXTENT,radius:(i.clusterRadius||50)*o,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,n){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:i},n),this}_updateWorkerData(e){const i=t.extend({},this.workerOptions);e?i.dataDiff=e:"string"==typeof this._data?(i.request=this.map._requestManager.transformRequest(t.browser.resolveURL(this._data),c.Source),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new t.Event("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.Event("dataabort",{dataType:"source"}));let n=null;if(i&&i.resourceTiming&&i.resourceTiming[this.id]&&(n=i.resourceTiming[this.id].slice(0)),e)return void this.fire(new t.ErrorEvent(e));const r={dataType:"source"};this._collectResourceTiming&&n&&n.length>0&&t.extend(r,{resourceTiming:n}),this.fire(new t.Event("data",{...r,sourceDataType:"metadata"})),this.fire(new t.Event("data",{...r,sourceDataType:"content"}))}))}loaded(){return 0===this._pendingLoads}loadTile(t,e){const i=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const n={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,n,((n,r)=>(delete t.request,t.unloadVectorData(),t.aborted?e(null):n?e(n):(t.loadVectorData(r,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 O=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class U extends t.Evented{constructor(e,i,n,r){super(),this.load=(e,i)=>{this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=l.getImage(this.map._requestManager.transformRequest(this.url,c.Image),((n,r)=>{this._request=null,this._loaded=!0,n?this.fire(new t.ErrorEvent(n)):r&&(this.image=r,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,O.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new y(e,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 t.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"image",url:this.options.url,coordinates:this.coordinates}),this.id=e,this.dispatcher=n,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),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.Event("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.MercatorCoordinate.fromLngLat);this.tileID=function(e){let i=1/0,n=1/0,r=-1/0,o=-1/0;for(const t of e)i=Math.min(i,t.x),n=Math.min(n,t.y),r=Math.max(r,t.x),o=Math.max(o,t.y);const s=Math.max(r-i,o-n),a=Math.max(0,Math.floor(-Math.log(s)/Math.LN2)),l=Math.pow(2,a);return new t.CanonicalTileID(a,Math.floor((i+r)/2*l),Math.floor((n+o)/2*l))}(i),this.minzoom=this.maxzoom=this.tileID.z;const n=i.map((t=>this.tileID.getTilePoint(t)._round()));return this._boundsArray=new t.RasterBoundsArray,this._boundsArray.emplaceBack(n[0].x,n[0].y,0,0),this._boundsArray.emplaceBack(n[1].x,n[1].y,t.EXTENT,0),this._boundsArray.emplaceBack(n[3].x,n[3].y,0,t.EXTENT),this._boundsArray.emplaceBack(n[2].x,n[2].y,t.EXTENT,t.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new t.Event("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 V extends U{constructor(e,i,n,r){super(e,i,n,r),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,c.Source).url);t.getVideo(this.urls,((e,i)=>{this._loaded=!0,e?this.fire(new t.ErrorEvent(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,O.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.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 y(e,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 t.Event("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;e<i.start(0)||e>i.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError(`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 N extends U{constructor(e,i,n,r){super(e,i,n,r),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.ErrorEvent(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,n=i.gl;this.boundsBuffer||(this.boundsBuffer=i.createVertexBuffer(this._boundsArray,O.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new y(i,this.canvas,n.RGBA,{premultiply:!0});let r=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,r=!0)}r&&this.fire(new t.Event("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.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new t.ErrorEvent(new t.ValidationError(`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.ErrorEvent(new t.ValidationError(`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.ErrorEvent(new t.ValidationError(`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 Z={},j=t=>{switch(t){case"geojson":return F;case"image":return U;case"raster":return B;case"raster-dem":return R;case"vector":return D;case"video":return V;case"canvas":return N}return Z[t]};function q(e,i){const n=t.create();return t.translate(n,n,[1,1,0]),t.scale(n,n,[.5*e.width,.5*e.height,1]),t.multiply(n,n,e.calculatePosMatrix(i.toUnwrapped()))}function $(t,e,i,n,r,o){const s=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}(r&&r.layers,e,t.id),a=o.maxPitchScaleFactor(),l=t.tilesIn(n,a,s);l.sort(G);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,r,o,a,q(t.transform,n.tileID))});const h=function(t){const e={},i={};for(const n of t){const t=n.queryResults,r=n.wrappedTileID,o=i[r]=i[r]||{};for(const i in t){const n=t[i],r=o[i]=o[i]||{},s=e[i]=e[i]||[];for(const t of n)r[t.featureIndex]||(r[t.featureIndex]=!0,s.push(t))}}return e}(c);for(const e in h)h[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 h}function G(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}class H{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=t.uniqueId(),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;e<this.fadeEndTime||(this.fadeEndTime=e)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,i,n){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(t,e){const i={};if(!e)return i;for(const n of t){const t=n.layerIds.map((t=>e.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}(e.buckets,i.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.SymbolBucket){if(this.hasSymbolBuckets=!0,!n)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.SymbolBucket&&i.hasRTLText){this.hasRTLText=!0,t.lazyLoadRTLTextPlugin();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.CollisionBoxArray}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 y(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new y(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,i,n,r,o,s,a,l,c){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:n,cameraQueryGeometry:r,scale:o,tileSize:this.tileSize,pixelPosMatrix:c,transform:a,params:s,queryPadding:this.queryPadding*l},t,e,i):{}}querySourceFeatures(e,i){const n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;const r=n.loadVTLayers(),o=i&&i.sourceLayer?i.sourceLayer:"",s=r._geojsonTileLayer||r[o];if(!s)return;const a=t.createFilter(i&&i.filter),{z:l,x:c,y:h}=this.tileID.canonical,u={z:l,x:c,y:h};for(let i=0;i<s.length;i++){const r=s.feature(i);if(a.needGeometry){const e=t.toEvaluationFeature(r,!0);if(!a.filter(new t.EvaluationParameters(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!a.filter(new t.EvaluationParameters(this.tileID.overscaledZ),r))continue;const p=n.getId(r,o),d=new t.GeoJSONFeature(r,l,c,h,p);d.tile=u,e.push(d)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const i=this.expirationTime;if(e.cacheControl){const i=t.parseCacheControl(e.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const t=Date.now();let e=!1;if(this.expirationTime>t)e=!1;else if(i)if(this.expirationTime<i)e=!0;else{const n=this.expirationTime-i;n?this.expirationTime=t+Math.max(n,3e4):e=!0}else e=!0;e?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)}setFeatureState(t,e){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(t).length)return;const i=this.latestFeatureIndex.loadVTLayers();for(const n in this.buckets){if(!e.style.hasLayer(n))continue;const r=this.buckets[n],o=r.layers[0].sourceLayer||"_geojsonTileLayer",s=i[o],a=t[o];if(!s||!a||0===Object.keys(a).length)continue;r.update(a,s,this.imageAtlas&&this.imageAtlas.patternPositions||{});const l=e&&e.style&&e.style.getLayer(n);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(r)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<t.browser.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=t.browser.now()+e}setDependencies(t,e){const i={};for(const t of e)i[t]=!0;this.dependencies[t]=i}hasDependency(t,e){for(const i of t){const t=this.dependencies[i];if(t)for(const i of e)if(t[i])return!0}return!1}}class W{constructor(t,e){this.max=t,this.onRemove=e,this.reset()}reset(){for(const t in this.data)for(const e of this.data[t])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(t,e,i){const n=t.wrapped().key;void 0===this.data[n]&&(this.data[n]=[]);const r={value:e,timeout:void 0};if(void 0!==i&&(r.timeout=setTimeout((()=>{this.remove(t,r)}),i)),this.data[n].push(r),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),r=this.data[i][n];return this.data[i].splice(n,1),r.timeout&&clearTimeout(r.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(r.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 X{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,n){const r=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][r]=this.stateChanges[e][r]||{},t.extend(this.stateChanges[e][r],n),null===this.deletedStates[e]){this.deletedStates[e]={};for(const t in this.state[e])t!==r&&(this.deletedStates[e][t]=null)}else if(this.deletedStates[e]&&null===this.deletedStates[e][r]){this.deletedStates[e][r]={};for(const t in this.state[e][r])n[t]||(this.deletedStates[e][r][t]=null)}else for(const t in n)this.deletedStates[e]&&this.deletedStates[e][r]&&null===this.deletedStates[e][r][t]&&delete this.deletedStates[e][r][t]}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(e,i){const n=String(i),r=t.extend({},(this.state[e]||{})[n],(this.stateChanges[e]||{})[n]);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 r[e]}return r}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(e,i){const n={};for(const e in this.stateChanges){this.state[e]=this.state[e]||{};const i={};for(const n in this.stateChanges[e])this.state[e][n]||(this.state[e][n]={}),t.extend(this.state[e][n],this.stateChanges[e][n]),i[n]=this.state[e][n];n[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]}n[e]=n[e]||{},t.extend(n[e],i)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(n).length)for(const t in e)e[t].setFeatureState(n,i)}}class K extends t.Evented{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,n)=>{const r=new(j(e.type))(t,e,i,n);if(r.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${r.id}`);return r})(t,e,i,this),this._tiles={},this._cache=new W(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new X,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.Event("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(Y).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 n=e.tileID,r=i.tileID,o=new t.Point(n.canonical.x,n.canonical.y)._rotate(this.transform.angle),s=new t.Point(r.canonical.x,r.canonical.y)._rotate(this.transform.angle);return n.overscaledZ-r.overscaledZ||s.y-o.y||s.x-o.x})).map((t=>t.tileID.key)):i.map((t=>t.tileID)).sort(Y).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,n,r){if(r)return e.state="errored",void(404!==r.status?this._source.fire(new t.ErrorEvent(r,{tile:e})):this.update(this.transform,this.terrain));e.timeAdded=t.browser.now(),"expired"===n&&(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.Event("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(t){const e=this.getRenderableIds();for(let n=0;n<e.length;n++){const r=e[n];if(t.neighboringTiles&&t.neighboringTiles[r]){const e=this.getTileByID(r);i(t,e),i(e,t)}}function i(t,e){t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0;let i=e.tileID.canonical.x-t.tileID.canonical.x;const n=e.tileID.canonical.y-t.tileID.canonical.y,r=Math.pow(2,t.tileID.canonical.z),o=e.tileID.key;0===i&&0===n||Math.abs(n)>1||(Math.abs(i)>1&&(1===Math.abs(i+r)?i+=r:1===Math.abs(i-r)&&(i-=r)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,n),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,i,n){for(const r in this._tiles){let o=this._tiles[r];if(n[r]||!o.hasData()||o.tileID.overscaledZ<=e||o.tileID.overscaledZ>i)continue;let s=o.tileID;for(;o&&o.tileID.overscaledZ>e+1;){const t=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[t.key],o&&o.hasData()&&(s=t)}let a=s;for(;a.overscaledZ>e;)if(a=a.scaledTo(a.overscaledZ-1),t[a.key]){n[s.key]=s;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}}_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,n=Math.ceil(e.height/this._source.tileSize)+1,r=Math.floor(i*n*(null===this._maxTileCacheZoomLevels?t.config.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),o="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,r):r;this._cache.setMaxSize(o)}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])}}update(e,i){if(this.transform=e,this.terrain=i,!this._sourceLoaded||this._paused)return;let n;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?n=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(n=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&&(n=n.filter((t=>this._source.hasTile(t))))):n=[];const r=e.coveringZoomLevel(this._source),o=Math.max(r-K.maxOverzooming,this._source.minzoom),s=Math.max(r+K.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 t.Event("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const l=this._updateRetainedTiles(n,r);if(J(this._source.type)){const e={},a={},c=Object.keys(l),h=t.browser.now();for(const t of c){const i=l[t],n=this._tiles[t];if(!n||0!==n.fadeEndTime&&n.fadeEndTime<=h)continue;const r=this.findLoadedParent(i,o);r&&(this._addTile(r.tileID),e[r.tileID.key]=r.tileID),a[t]=i}this._retainLoadedChildren(a,r,s,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 n)this._tiles[i.key].hasData()?t[i.key]=i:e[i.key]=i;for(const i in e){const n=e[i].children(this._source.maxzoom);this._tiles[n[0].key]&&this._tiles[n[1].key]&&this._tiles[n[2].key]&&this._tiles[n[3].key]&&(t[n[0].key]=l[n[0].key]=n[0],t[n[1].key]=l[n[1].key]=n[1],t[n[2].key]=l[n[2].key]=n[2],t[n[3].key]=l[n[3].key]=n[3],delete e[i])}for(const i in e){const n=this.findLoadedParent(e[i],this._source.minzoom);if(n){t[n.tileID.key]=l[n.tileID.key]=n.tileID;for(const e in t)t[e].isChildOf(n.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.keysDifference(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={},n={},r=Math.max(e-K.maxOverzooming,this._source.minzoom),o=Math.max(e+K.maxUnderzooming,this._source.minzoom),s={};for(const n of t){const t=this._addTile(n);i[n.key]=n,t.hasData()||e<this._source.maxzoom&&(s[n.key]=n)}this._retainLoadedChildren(s,e,o,i);for(const o of t){let t=this._tiles[o.key];if(t.hasData())continue;if(e+1>this._source.maxzoom){const t=o.children(this._source.maxzoom)[0],e=this.getTile(t);if(e&&e.hasData()){i[t.key]=t;continue}}else{const t=o.children(this._source.maxzoom);if(i[t[0].key]&&i[t[1].key]&&i[t[2].key]&&i[t[3].key])continue}let s=t.wasRequested();for(let e=o.overscaledZ-1;e>=r;--e){const r=o.scaledTo(e);if(n[r.key])break;if(n[r.key]=!0,t=this.getTile(r),!t&&s&&(t=this._addTile(r)),t){const e=t.hasData();if((s||e)&&(i[r.key]=r),s=t.wasRequested(),e)break}}}return i}_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}}_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 n=i;return i||(i=new H(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,n||this._source.fire(new t.Event("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,n){const r=[],o=this.transform;if(!o)return r;const s=n?o.getCameraQueryGeometry(e):e,a=e.map((t=>o.pointCoordinate(t,this.terrain))),l=s.map((t=>o.pointCoordinate(t,this.terrain))),c=this.getIds();let h=1/0,u=1/0,p=-1/0,d=-1/0;for(const t of l)h=Math.min(h,t.x),u=Math.min(u,t.y),p=Math.max(p,t.x),d=Math.max(d,t.y);for(let e=0;e<c.length;e++){const n=this._tiles[c[e]];if(n.holdingForFade())continue;const s=n.tileID,m=Math.pow(2,o.zoom-n.tileID.overscaledZ),f=i*n.queryPadding*t.EXTENT/n.tileSize/m,g=[s.getTilePoint(new t.MercatorCoordinate(h,u)),s.getTilePoint(new t.MercatorCoordinate(p,d))];if(g[0].x-f<t.EXTENT&&g[0].y-f<t.EXTENT&&g[1].x+f>=0&&g[1].y+f>=0){const t=a.map((t=>s.getTilePoint(t))),e=l.map((t=>s.getTilePoint(t)));r.push({tile:n,tileID:s,queryGeometry:t,cameraQueryGeometry:e,scale:m})}}return r}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(J(this._source.type)){const e=t.browser.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 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 Y(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 J(t){return"raster"===t||"image"===t||"video"===t}K.maxOverzooming=10,K.maxUnderzooming=3;const Q="mapboxgl_preloaded_worker_pool";class tt{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<tt.workerCount;)this.workers.push(new Worker(t.config.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(t){delete this.active[t],0===this.numActive()&&(this.workers.forEach((t=>{t.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[Q]}numActive(){return Object.keys(this.active).length}}const et=Math.floor(t.browser.hardwareConcurrency/2);let it;function nt(){return it||(it=new tt),it}tt.workerCount=t.isSafari(globalThis)?Math.max(Math.min(et,3),1):1;class rt{constructor(t,e){this.reset(t,e)}reset(t,e){this.points=t||[],this._distances=[0];for(let t=1;t<this.points.length;t++)this._distances[t]=this._distances[t-1]+this.points[t].dist(this.points[t-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(1===this.points.length)return this.points[0];e=t.clamp(e,0,1);let i=1,n=this._distances[i];const r=e*this.paddedLength+this.padding;for(;n<r&&i<this._distances.length;)n=this._distances[++i];const o=i-1,s=this._distances[o],a=n-s,l=a>0?(r-s)/a:0;return this.points[o].mult(1-l).add(this.points[i].mult(l))}}function ot(t,e){let i=!0;return"always"===t||"never"!==t&&"never"!==e||(i=!1),i}class st{constructor(t,e,i){const n=this.boxCells=[],r=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(let t=0;t<this.xCellCount*this.yCellCount;t++)n.push([]),r.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,e,i,n,r){this._forEachCell(e,i,n,r,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(r)}insertCircle(t,e,i,n){this._forEachCell(e-n,i-n,e+n,i+n,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(i),this.circles.push(n)}_insertBoxCell(t,e,i,n,r,o){this.boxCells[r].push(o)}_insertCircleCell(t,e,i,n,r,o){this.circleCells[r].push(o)}_query(t,e,i,n,r,o,s){if(i<0||t>this.width||n<0||e>this.height)return[];const a=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=n){if(r)return[{key:null,x1:t,y1:e,x2:i,y2:n}];for(let t=0;t<this.boxKeys.length;t++)a.push({key:this.boxKeys[t],x1:this.bboxes[4*t],y1:this.bboxes[4*t+1],x2:this.bboxes[4*t+2],y2:this.bboxes[4*t+3]});for(let t=0;t<this.circleKeys.length;t++){const e=this.circles[3*t],i=this.circles[3*t+1],n=this.circles[3*t+2];a.push({key:this.circleKeys[t],x1:e-n,y1:i-n,x2:e+n,y2:i+n})}}else this._forEachCell(t,e,i,n,this._queryCell,a,{hitTest:r,overlapMode:o,seenUids:{box:{},circle:{}}},s);return a}query(t,e,i,n){return this._query(t,e,i,n,!1,null)}hitTest(t,e,i,n,r,o){return this._query(t,e,i,n,!0,r,o).length>0}hitTestCircle(t,e,i,n,r){const o=t-i,s=t+i,a=e-i,l=e+i;if(s<0||o>this.width||l<0||a>this.height)return!1;const c=[];return this._forEachCell(o,a,s,l,this._queryCellCircle,c,{hitTest:!0,overlapMode:n,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},r),c.length>0}_queryCell(t,e,i,n,r,o,s,a){const{seenUids:l,hitTest:c,overlapMode:h}=s,u=this.boxCells[r];if(null!==u){const r=this.bboxes;for(const s of u)if(!l.box[s]){l.box[s]=!0;const u=4*s,p=this.boxKeys[s];if(t<=r[u+2]&&e<=r[u+3]&&i>=r[u+0]&&n>=r[u+1]&&(!a||a(p))&&(!c||!ot(h,p.overlapMode))&&(o.push({key:p,x1:r[u],y1:r[u+1],x2:r[u+2],y2:r[u+3]}),c))return!0}}const p=this.circleCells[r];if(null!==p){const r=this.circles;for(const s of p)if(!l.circle[s]){l.circle[s]=!0;const u=3*s,p=this.circleKeys[s];if(this._circleAndRectCollide(r[u],r[u+1],r[u+2],t,e,i,n)&&(!a||a(p))&&(!c||!ot(h,p.overlapMode))){const t=r[u],e=r[u+1],i=r[u+2];if(o.push({key:p,x1:t-i,y1:e-i,x2:t+i,y2:e+i}),c)return!0}}}return!1}_queryCellCircle(t,e,i,n,r,o,s,a){const{circle:l,seenUids:c,overlapMode:h}=s,u=this.boxCells[r];if(null!==u){const t=this.bboxes;for(const e of u)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))&&!ot(h,n.overlapMode))return o.push(!0),!0}}const p=this.circleCells[r];if(null!==p){const t=this.circles;for(const e of p)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))&&!ot(h,n.overlapMode))return o.push(!0),!0}}}_forEachCell(t,e,i,n,r,o,s,a){const l=this._convertToXCellCoord(t),c=this._convertToYCellCoord(e),h=this._convertToXCellCoord(i),u=this._convertToYCellCoord(n);for(let p=l;p<=h;p++)for(let l=c;l<=u;l++)if(r.call(this,t,e,i,n,this.xCellCount*l+p,o,s,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,r,o){const s=n-t,a=r-e,l=i+o;return l*l>s*s+a*a}_circleAndRectCollide(t,e,i,n,r,o,s){const a=(o-n)/2,l=Math.abs(t-(n+a));if(l>a+i)return!1;const c=(s-r)/2,h=Math.abs(e-(r+c));if(h>c+i)return!1;if(l<=a||h<=c)return!0;const u=l-a,p=h-c;return u*u+p*p<=i*i}}function at(e,i,n,r,o){const s=t.create();return i?(t.scale(s,s,[1/o,1/o,1]),n||t.rotateZ(s,s,r.angle)):t.multiply(s,r.labelPlaneMatrix,e),s}function lt(e,i,n,r,o){if(i){const i=t.clone(e);return t.scale(i,i,[o,o,1]),n||t.rotateZ(i,i,-r.angle),i}return r.glCoordMatrix}function ct(e,i,n){let r;n?(r=[e.x,e.y,n(e.x,e.y),1],t.transformMat4(r,r,i)):(r=[e.x,e.y,0,1],Tt(r,r,i));const o=r[3];return{point:new t.Point(r[0]/o,r[1]/o),signedDistanceFromCamera:o}}function ht(t,e){return.5+t/e*.5}function ut(t,e){const i=t[0]/t[3],n=t[1]/t[3];return i>=-e[0]&&i<=e[0]&&n>=-e[1]&&n<=e[1]}function pt(e,i,n,r,o,s,a,l,c,h){const u=r?e.textSizeData:e.iconSizeData,p=t.evaluateSizeForZoom(u,n.transform.zoom),d=[256/n.width*2+1,256/n.height*2+1],m=r?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;m.clear();const f=e.lineVertexArray,g=r?e.text.placedSymbolArray:e.icon.placedSymbolArray,_=n.transform.width/n.transform.height;let y=!1;for(let r=0;r<g.length;r++){const v=g.get(r);if(v.hidden||v.writingMode===t.WritingMode.vertical&&!y){wt(v.numGlyphs,m);continue}let x;if(y=!1,h?(x=[v.anchorX,v.anchorY,h(v.anchorX,v.anchorY),1],t.transformMat4(x,x,i)):(x=[v.anchorX,v.anchorY,0,1],Tt(x,x,i)),!ut(x,d)){wt(v.numGlyphs,m);continue}const b=ht(n.transform.cameraToCenterDistance,x[3]),w=t.evaluateSizeForFeature(u,p,v),T=a?w/b:w*b,E=new t.Point(v.anchorX,v.anchorY),S=ct(E,o,h).point,P={projections:{},offsets:{}},z=ft(v,T,!1,l,i,o,s,e.glyphOffsetArray,f,m,S,E,P,_,c,h);y=z.useVertical,(z.notEnoughRoom||y||z.needsFlipping&&ft(v,T,!0,l,i,o,s,e.glyphOffsetArray,f,m,S,E,P,_,c,h).notEnoughRoom)&&wt(v.numGlyphs,m)}r?e.text.dynamicLayoutVertexBuffer.updateData(m):e.icon.dynamicLayoutVertexBuffer.updateData(m)}function dt(t,e,i,n,r,o,s,a,l,c,h,u,p){const d=a.glyphStartIndex+a.numGlyphs,m=a.lineStartIndex,f=a.lineStartIndex+a.lineLength,g=e.getoffsetX(a.glyphStartIndex),_=e.getoffsetX(d-1),y=xt(t*g,i,n,r,o,s,a.segment,m,f,l,c,h,u,p);if(!y)return null;const v=xt(t*_,i,n,r,o,s,a.segment,m,f,l,c,h,u,p);return v?{first:y,last:v}:null}function mt(e,i,n,r){return e===t.WritingMode.horizontal&&Math.abs(n.y-i.y)>Math.abs(n.x-i.x)*r?{useVertical:!0}:(e===t.WritingMode.vertical?i.y<n.y:i.x>n.x)?{needsFlipping:!0}:null}function ft(e,i,n,r,o,s,a,l,c,h,u,p,d,m,f,g){const _=i/24,y=e.lineOffsetX*_,v=e.lineOffsetY*_;let x;if(e.numGlyphs>1){const t=e.glyphStartIndex+e.numGlyphs,i=e.lineStartIndex,o=e.lineStartIndex+e.lineLength,h=dt(_,l,y,v,n,u,p,e,c,s,d,f,g);if(!h)return{notEnoughRoom:!0};const b=ct(h.first.point,a,g).point,w=ct(h.last.point,a,g).point;if(r&&!n){const t=mt(e.writingMode,b,w,m);if(t)return t}x=[h.first];for(let r=e.glyphStartIndex+1;r<t-1;r++)x.push(xt(_*l.getoffsetX(r),y,v,n,u,p,e.segment,i,o,c,s,d,f,g));x.push(h.last)}else{if(r&&!n){const i=ct(p,o,g).point,n=e.lineStartIndex+e.segment+1,r=new t.Point(c.getx(n),c.gety(n)),s=ct(r,o,g),a=s.signedDistanceFromCamera>0?s.point:gt(p,r,i,1,o,g),l=mt(e.writingMode,i,a,m);if(l)return l}const i=xt(_*l.getoffsetX(e.glyphStartIndex),y,v,n,u,p,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,c,s,d,f,g);if(!i)return{notEnoughRoom:!0};x=[i]}for(const e of x)t.addDynamicAttributes(h,e.point,e.angle);return{}}function gt(t,e,i,n,r,o){const s=ct(t.add(t.sub(e)._unit()),r,o).point,a=i.sub(s);return i.add(a._mult(n/a.mag()))}function _t(e,i){const{projectionCache:n,lineVertexArray:r,labelPlaneMatrix:o,tileAnchorPoint:s,distanceFromAnchor:a,getElevation:l,previousVertex:c,direction:h,absOffsetX:u}=i;if(n.projections[e])return n.projections[e];const p=new t.Point(r.getx(e),r.gety(e)),d=ct(p,o,l);if(d.signedDistanceFromCamera>0)return n.projections[e]=d.point,d.point;const m=e-h;return gt(0===a?s:new t.Point(r.getx(m),r.gety(m)),p,c,u-a+1,o,l)}function yt(t,e,i){return t._unit()._perp()._mult(e*i)}function vt(e,i,n,r,o,s,a,l){const{projectionCache:c,direction:h}=l;if(c.offsets[e])return c.offsets[e];const u=n.add(i);if(e+h<r||e+h>=o)return c.offsets[e]=u,u;const p=_t(e+h,l),d=yt(p.sub(n),a,h),m=n.add(d),f=p.add(d);return c.offsets[e]=t.findLineIntersection(s,u,m,f)||u,c.offsets[e]}function xt(t,e,i,n,r,o,s,a,l,c,h,u,p,d){const m=n?t-e:t+e;let f=m>0?1:-1,g=0;n&&(f*=-1,g=Math.PI),f<0&&(g+=Math.PI);let _,y,v=f>0?a+s:a+s+1,x=r,b=r,w=0,T=0;const E=Math.abs(m),S=[];let P;for(;w+T<=E;){if(v+=f,v<a||v>=l)return null;w+=T,b=x,y=_;const t={projectionCache:u,lineVertexArray:c,labelPlaneMatrix:h,tileAnchorPoint:o,distanceFromAnchor:w,getElevation:d,previousVertex:b,direction:f,absOffsetX:E};if(x=_t(v,t),0===i)S.push(b),P=x.sub(b);else{let e;const n=x.sub(b);e=0===n.mag()?yt(_t(v+f,t).sub(x),i,f):yt(n,i,f),y||(y=b.add(e)),_=vt(v,e,x,a,l,y,i,t),S.push(y),P=_.sub(y)}T=P.mag()}const z=P._mult((E-w)/T)._add(y||b),C=g+Math.atan2(x.y-b.y,x.x-b.x);return S.push(z),{point:z,angle:p?C:0,path:S}}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 wt(t,e){for(let i=0;i<t;i++){const t=e.length;e.resize(t+4),e.float32.set(bt,3*t)}}function Tt(t,e,i){const n=e[0],r=e[1];return t[0]=i[0]*n+i[4]*r+i[12],t[1]=i[1]*n+i[5]*r+i[13],t[3]=i[3]*n+i[7]*r+i[15],t}const Et=100;class St{constructor(t,e=new st(t.width+200,t.height+200,25),i=new st(t.width+200,t.height+200,25)){this.transform=t,this.grid=e,this.ignoredGrid=i,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Et,this.screenBottomBoundary=t.height+Et,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,e,i,n,r,o){const s=this.projectAndGetPerspectiveRatio(n,t.anchorPointX,t.anchorPointY,o),a=i*s.perspectiveRatio,l=t.x1*a+s.point.x,c=t.y1*a+s.point.y,h=t.x2*a+s.point.x,u=t.y2*a+s.point.y;return!this.isInsideGrid(l,c,h,u)||"always"!==e&&this.grid.hitTest(l,c,h,u,e,r)||s.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[l,c,h,u],offscreen:this.isOffscreen(l,c,h,u)}}placeCollisionCircles(e,i,n,r,o,s,a,l,c,h,u,p,d,m){const f=[],g=new t.Point(i.anchorX,i.anchorY),_=ct(g,s,m),y=ht(this.transform.cameraToCenterDistance,_.signedDistanceFromCamera),v=(h?o/y:o*y)/t.ONE_EM,x=ct(g,a,m).point,b=dt(v,r,i.lineOffsetX*v,i.lineOffsetY*v,!1,x,g,i,n,a,{projections:{},offsets:{}},!1,m);let w=!1,T=!1,E=!0;if(b){const i=.5*p*y+d,n=new t.Point(-100,-100),r=new t.Point(this.screenRightBoundary,this.screenBottomBoundary),o=new rt,s=b.first,a=b.last;let h=[];for(let t=s.path.length-1;t>=1;t--)h.push(s.path[t]);for(let t=1;t<a.path.length;t++)h.push(a.path[t]);const g=2.5*i;if(l){const t=h.map((t=>ct(t,l,m)));h=t.some((t=>t.signedDistanceFromCamera<=0))?[]:t.map((t=>t.point))}let _=[];if(h.length>0){const e=h[0].clone(),i=h[0].clone();for(let t=1;t<h.length;t++)e.x=Math.min(e.x,h[t].x),e.y=Math.min(e.y,h[t].y),i.x=Math.max(i.x,h[t].x),i.y=Math.max(i.y,h[t].y);_=e.x>=n.x&&i.x<=r.x&&e.y>=n.y&&i.y<=r.y?[h]:i.x<n.x||e.x>r.x||i.y<n.y||e.y>r.y?[]:t.clipLine([h],n.x,n.y,r.x,r.y)}for(const t of _){o.reset(t,.25*i);let n=0;n=o.length<=.5*i?1:Math.ceil(o.paddedLength/g)+1;for(let t=0;t<n;t++){const r=t/Math.max(n-1,1),s=o.lerp(r),a=s.x+Et,l=s.y+Et;f.push(a,l,i,0);const h=a-i,p=l-i,d=a+i,m=l+i;if(E=E&&this.isOffscreen(h,p,d,m),T=T||this.isInsideGrid(h,p,d,m),"always"!==e&&this.grid.hitTestCircle(a,l,i,e,u)&&(w=!0,!c))return{circles:[],offscreen:!1,collisionDetected:w}}}}return{circles:!c&&w||!T||y<this.perspectiveRatioCutoff?[]:f,offscreen:E,collisionDetected:w}}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const i=[];let n=1/0,r=1/0,o=-1/0,s=-1/0;for(const a of e){const e=new t.Point(a.x+Et,a.y+Et);n=Math.min(n,e.x),r=Math.min(r,e.y),o=Math.max(o,e.x),s=Math.max(s,e.y),i.push(e)}const a=this.grid.query(n,r,o,s).concat(this.ignoredGrid.query(n,r,o,s)),l={},c={};for(const e of a){const n=e.key;if(void 0===l[n.bucketInstanceId]&&(l[n.bucketInstanceId]={}),l[n.bucketInstanceId][n.featureIndex])continue;const r=[new t.Point(e.x1,e.y1),new t.Point(e.x2,e.y1),new t.Point(e.x2,e.y2),new t.Point(e.x1,e.y2)];t.polygonIntersectsPolygon(i,r)&&(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,r,o){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:n,featureIndex:r,collisionGroupID:o,overlapMode:e},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,e,i,n,r,o){const s=i?this.ignoredGrid:this.grid,a={bucketInstanceId:n,featureIndex:r,collisionGroupID:o,overlapMode:e};for(let e=0;e<t.length;e+=4)s.insertCircle(a,t[e],t[e+1],t[e+2])}projectAndGetPerspectiveRatio(e,i,n,r){let o;return r?(o=[i,n,r(i,n),1],t.transformMat4(o,o,e)):(o=[i,n,0,1],Tt(o,o,e)),{point:new t.Point((o[0]/o[3]+1)/2*this.transform.width+Et,(-o[1]/o[3]+1)/2*this.transform.height+Et),perspectiveRatio:.5+this.transform.cameraToCenterDistance/o[3]*.5}}isOffscreen(t,e,i,n){return i<Et||t>=this.screenRightBoundary||n<Et||e>this.screenBottomBoundary}isInsideGrid(t,e,i,n){return i>=0&&t<this.gridRightBoundary&&n>=0&&e<this.gridBottomBoundary}getViewportMatrix(){const e=t.identity([]);return t.translate(e,e,[-100,-100,0]),e}}function Pt(e,i,n){return i*(t.EXTENT/(e.tileSize*Math.pow(2,n-e.tileID.overscaledZ)))}class zt{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 Ct{constructor(t,e,i,n,r){this.text=new zt(t?t.text:null,e,i,r),this.icon=new zt(t?t.icon:null,e,n,r)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Mt{constructor(t,e,i){this.text=t,this.icon=e,this.skipFade=i}}class It{constructor(){this.invProjMatrix=t.create(),this.viewportMatrix=t.create(),this.circles=[]}}class At{constructor(t,e,i,n,r){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=i,this.bucketIndex=n,this.tileID=r}}class kt{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(e,i,n,r,o){const{horizontalAlign:s,verticalAlign:a}=t.getAnchorAlignment(e);return new t.Point(-(s-.5)*i+r[0]*o,-(a-.5)*n+r[1]*o)}function Dt(e,i,n,r,o,s){const{x1:a,x2:l,y1:c,y2:h,anchorPointX:u,anchorPointY:p}=e,d=new t.Point(i,n);return r&&d._rotate(o?s:-s),{x1:a+d.x,y1:c+d.y,x2:l+d.x,y2:h+d.y,anchorPointX:u,anchorPointY:p}}class Bt{constructor(t,e,i,n,r){this.transform=t.clone(),this.terrain=e,this.collisionIndex=new St(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new kt(n),this.collisionCircleArrays={},this.prevPlacement=r,r&&(r.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(e,i,n,r){const o=n.getBucket(i),s=n.latestFeatureIndex;if(!o||!s||i.id!==o.layerIds[0])return;const a=n.collisionBoxArray,l=o.layers[0].layout,c=Math.pow(2,this.transform.zoom-n.tileID.overscaledZ),h=n.tileSize/t.EXTENT,u=this.transform.calculatePosMatrix(n.tileID.toUnwrapped()),p="map"===l.get("text-pitch-alignment"),d="map"===l.get("text-rotation-alignment"),m=Pt(n,1,this.transform.zoom),f=at(u,p,d,this.transform,m);let g=null;if(p){const e=lt(u,p,d,this.transform,m);g=t.multiply([],this.transform.labelPlaneMatrix,e)}this.retainedQueryData[o.bucketInstanceId]=new At(o.bucketInstanceId,s,o.sourceLayerIndex,o.index,n.tileID);const _={bucket:o,layout:l,posMatrix:u,textLabelPlaneMatrix:f,labelToScreenMatrix:g,scale:c,textPixelRatio:h,holdingForFade:n.holdingForFade(),collisionBoxArray:a,partiallyEvaluatedTextSize:t.evaluateSizeForZoom(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(r)for(const t of o.sortKeyRanges){const{sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:r}=t;e.push({sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:r,parameters:_})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:_})}attemptAnchorPlacement(e,i,n,r,o,s,a,l,c,h,u,p,d,m,f,g){const _=t.TextAnchorEnum[e.textAnchor],y=[e.textOffset0,e.textOffset1],v=Lt(_,n,r,y,o),x=this.collisionIndex.placeCollisionBox(Dt(i,v.x,v.y,s,a,this.transform.angle),u,l,c,h.predicate,g);if((!f||0!==this.collisionIndex.placeCollisionBox(Dt(f,v.x,v.y,s,a,this.transform.angle),u,l,c,h.predicate,g).box.length)&&x.box.length>0){let t;if(this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(t=this.prevPlacement.variableOffsets[p.crossTileID].anchor),0===p.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[p.crossTileID]={textOffset:y,width:n,height:r,anchor:_,textBoxScale:o,prevAnchor:t},this.markUsedJustification(d,_,p,m),d.allowVerticalPlacement&&(this.markUsedOrientation(d,m,p),this.placedOrientations[p.crossTileID]=m),{shift:v,placedGlyphBoxes:x}}}placeLayerBucketPart(e,i,n){const{bucket:r,layout:o,posMatrix:s,textLabelPlaneMatrix:a,labelToScreenMatrix:l,textPixelRatio:c,holdingForFade:h,collisionBoxArray:u,partiallyEvaluatedTextSize:p,collisionGroup:d}=e.parameters,m=o.get("text-optional"),f=o.get("icon-optional"),g=t.getOverlapMode(o,"text-overlap","text-allow-overlap"),_="always"===g,y=t.getOverlapMode(o,"icon-overlap","icon-allow-overlap"),v="always"===y,x="map"===o.get("text-rotation-alignment"),b="map"===o.get("text-pitch-alignment"),w="none"!==o.get("icon-text-fit"),T="viewport-y"===o.get("symbol-z-order"),E=_&&(v||!r.hasIconData()||f),S=v&&(_||!r.hasTextData()||m);!r.collisionArrays&&u&&r.deserializeCollisionBoxes(u);const P=this.retainedQueryData[r.bucketInstanceId].tileID,z=this.terrain?(t,e)=>this.terrain.getElevation(P,t,e):null,C=(e,u)=>{var v,T;if(i[e.crossTileID])return;if(h)return void(this.placements[e.crossTileID]=new Mt(!1,!1,!1));let P=!1,C=!1,M=!0,I=null,A={box:null,offscreen:null},k={box:null,offscreen:null},L=null,D=null,B=null,R=0,F=0,O=0;u.textFeatureIndex?R=u.textFeatureIndex:e.useRuntimeCollisionCircles&&(R=e.featureIndex),u.verticalTextFeatureIndex&&(F=u.verticalTextFeatureIndex);const U=u.textBox;if(U){const i=i=>{let n=t.WritingMode.horizontal;if(r.allowVerticalPlacement&&!i&&this.prevPlacement){const t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,n=t,this.markUsedOrientation(r,n,e))}return n},n=(i,n)=>{if(r.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&u.verticalTextBox){for(const e of r.writingModes)if(e===t.WritingMode.vertical?(A=n(),k=A):A=i(),A&&A.box&&A.box.length)break}else A=i()},o=e.textAnchorOffsetStartIndex,a=e.textAnchorOffsetEndIndex;if(a===o){const o=(t,i)=>{const n=this.collisionIndex.placeCollisionBox(t,g,c,s,d.predicate,z);return n&&n.box&&n.box.length&&(this.markUsedOrientation(r,i,e),this.placedOrientations[e.crossTileID]=i),n};n((()=>o(U,t.WritingMode.horizontal)),(()=>{const i=u.verticalTextBox;return r.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i?o(i,t.WritingMode.vertical):{box:null,offscreen:null}})),i(A&&A.box&&A.box.length)}else{let l=t.TextAnchorEnum[null===(T=null===(v=this.prevPlacement)||void 0===v?void 0:v.variableOffsets[e.crossTileID])||void 0===T?void 0:T.anchor];const h=(t,i,n)=>{const h=t.x2-t.x1,u=t.y2-t.y1,p=e.textBoxScale,m=w&&"never"===y?i:null;let f={box:[],offscreen:!1},_="never"===g?1:2,v="never";l&&_++;for(let i=0;i<_;i++){for(let i=o;i<a;i++){const o=r.textAnchorOffsets.get(i);if(l&&o.textAnchor!==l)continue;const a=this.attemptAnchorPlacement(o,t,h,u,p,x,b,c,s,d,v,e,r,n,m,z);if(a&&(f=a.placedGlyphBoxes,f&&f.box&&f.box.length))return P=!0,I=a.shift,f}l?l=null:v=g}return f};n((()=>h(U,u.iconBox,t.WritingMode.horizontal)),(()=>{const i=u.verticalTextBox;return r.allowVerticalPlacement&&!(A&&A.box&&A.box.length)&&e.numVerticalGlyphVertices>0&&i?h(i,u.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}})),A&&(P=A.box,M=A.offscreen);const p=i(A&&A.box);if(!P&&this.prevPlacement){const t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(r,t.anchor,e,p))}}}if(L=A,P=L&&L.box&&L.box.length>0,M=L&&L.offscreen,e.useRuntimeCollisionCircles){const i=r.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),c=t.evaluateSizeForFeature(r.textSizeData,p,i),h=o.get("text-padding");D=this.collisionIndex.placeCollisionCircles(g,i,r.lineVertexArray,r.glyphOffsetArray,c,s,a,l,n,b,d.predicate,e.collisionCircleDiameter,h,z),D.circles.length&&D.collisionDetected&&!n&&t.warnOnce("Collisions detected, but collision boxes are not shown"),P=_||D.circles.length>0&&!D.collisionDetected,M=M&&D.offscreen}if(u.iconFeatureIndex&&(O=u.iconFeatureIndex),u.iconBox){const t=t=>{const e=w&&I?Dt(t,I.x,I.y,x,b,this.transform.angle):t;return this.collisionIndex.placeCollisionBox(e,y,c,s,d.predicate,z)};k&&k.box&&k.box.length&&u.verticalIconBox?(B=t(u.verticalIconBox),C=B.box.length>0):(B=t(u.iconBox),C=B.box.length>0),M=M&&B.offscreen}const V=m||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,N=f||0===e.numIconVertices;if(V||N?N?V||(C=C&&P):P=C&&P:C=P=C&&P,P&&L&&L.box&&this.collisionIndex.insertCollisionBox(L.box,g,o.get("text-ignore-placement"),r.bucketInstanceId,k&&k.box&&F?F:R,d.ID),C&&B&&this.collisionIndex.insertCollisionBox(B.box,y,o.get("icon-ignore-placement"),r.bucketInstanceId,O,d.ID),D&&(P&&this.collisionIndex.insertCollisionCircles(D.circles,g,o.get("text-ignore-placement"),r.bucketInstanceId,R,d.ID),n)){const t=r.bucketInstanceId;let e=this.collisionCircleArrays[t];void 0===e&&(e=this.collisionCircleArrays[t]=new It);for(let t=0;t<D.circles.length;t+=4)e.circles.push(D.circles[t+0]),e.circles.push(D.circles[t+1]),e.circles.push(D.circles[t+2]),e.circles.push(D.collisionDetected?1:0)}if(0===e.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===r.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[e.crossTileID]=new Mt(P||E,C||S,M||r.justReloaded),i[e.crossTileID]=!0};if(T){if(0!==e.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");const t=r.getSortedSymbolIndexes(this.transform.angle);for(let e=t.length-1;e>=0;--e){const i=t[e];C(r.symbolInstances.get(i),r.collisionArrays[i])}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)C(r.symbolInstances.get(t),r.collisionArrays[t]);if(n&&r.bucketInstanceId in this.collisionCircleArrays){const e=this.collisionCircleArrays[r.bucketInstanceId];t.invert(e.invProjMatrix,s),e.viewportMatrix=this.collisionIndex.getViewportMatrix()}r.justReloaded=!1}markUsedJustification(e,i,n,r){let o;o=r===t.WritingMode.vertical?n.verticalPlacedTextSymbolIndex:{left:n.leftJustifiedTextSymbolIndex,center:n.centerJustifiedTextSymbolIndex,right:n.rightJustifiedTextSymbolIndex}[t.getAnchorJustification(i)];const s=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex,n.verticalPlacedTextSymbolIndex];for(const t of s)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=o>=0&&t!==o?0:n.crossTileID)}markUsedOrientation(e,i,n){const r=i===t.WritingMode.horizontal||i===t.WritingMode.horizontalOnly?i:0,o=i===t.WritingMode.vertical?i:0,s=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex];for(const t of s)e.text.placedSymbolArray.get(t).placedOrientation=r;n.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).placedOrientation=o)}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,r=e?e.opacities:{},o=e?e.variableOffsets:{},s=e?e.placedOrientations:{};for(const t in this.placements){const e=this.placements[t],o=r[t];o?(this.opacities[t]=new Ct(o,n,e.text,e.icon),i=i||e.text!==o.text.placed||e.icon!==o.icon.placed):(this.opacities[t]=new Ct(null,n,e.text,e.icon,e.skipFade),i=i||e.text||e.icon)}for(const t in r){const e=r[t];if(!this.opacities[t]){const r=new Ct(e,n,!1,!1);r.isHidden()||(this.opacities[t]=r,i=i||e.text.placed||e.icon.placed)}}for(const t in o)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=o[t]);for(const t in s)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=s[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,i,n.collisionBoxArray)}}updateBucketOpacities(e,i,n){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 r=e.layers[0],o=r.layout,s=new Ct(null,0,!1,!1,!0),a=o.get("text-allow-overlap"),l=o.get("icon-allow-overlap"),c=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"),p="none"!==o.get("icon-text-fit"),d=new Ct(null,0,a&&(l||!e.hasIconData()||o.get("icon-optional")),l&&(a||!e.hasTextData()||o.get("text-optional")),!0);!e.collisionArrays&&n&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(n);const m=(t,e,i)=>{for(let n=0;n<e/4;n++)t.opacityVertexArray.emplaceBack(i);t.hasVisibleVertices=t.hasVisibleVertices||i!==$t};for(let n=0;n<e.symbolInstances.length;n++){const r=e.symbolInstances.get(n),{numHorizontalGlyphVertices:o,numVerticalGlyphVertices:a,crossTileID:l}=r;let f=this.opacities[l];i[l]?f=s:f||(f=d,this.opacities[l]=f),i[l]=!0;const g=r.numIconVertices>0,_=this.placedOrientations[r.crossTileID],y=_===t.WritingMode.vertical,v=_===t.WritingMode.horizontal||_===t.WritingMode.horizontalOnly;if(o>0||a>0){const t=qt(f.text);m(e.text,o,y?$t:t),m(e.text,a,v?$t:t);const i=f.text.isHidden();[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex].forEach((t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=i||y?1:0)})),r.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).hidden=i||v?1:0);const n=this.variableOffsets[r.crossTileID];n&&this.markUsedJustification(e,n.anchor,r,_);const s=this.placedOrientations[r.crossTileID];s&&(this.markUsedJustification(e,"left",r,s),this.markUsedOrientation(e,s,r))}if(g){const t=qt(f.icon),i=!(p&&r.verticalPlacedIconSymbolIndex&&y);r.placedIconSymbolIndex>=0&&(m(e.icon,r.numIconVertices,i?t:$t),e.icon.placedSymbolArray.get(r.placedIconSymbolIndex).hidden=f.icon.isHidden()),r.verticalPlacedIconSymbolIndex>=0&&(m(e.icon,r.numVerticalIconVertices,i?$t:t),e.icon.placedSymbolArray.get(r.verticalPlacedIconSymbolIndex).hidden=f.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const i=e.collisionArrays[n];if(i){let n=new t.Point(0,0);if(i.textBox||i.verticalTextBox){let t=!0;if(c){const e=this.variableOffsets[l];e?(n=Lt(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),h&&n._rotate(u?this.transform.angle:-this.transform.angle)):t=!1}i.textBox&&Rt(e.textCollisionBox.collisionVertexArray,f.text.placed,!t||y,n.x,n.y),i.verticalTextBox&&Rt(e.textCollisionBox.collisionVertexArray,f.text.placed,!t||v,n.x,n.y)}const r=Boolean(!v&&i.verticalIconBox);i.iconBox&&Rt(e.iconCollisionBox.collisionVertexArray,f.icon.placed,r,p?n.x:0,p?n.y:0),i.verticalIconBox&&Rt(e.iconCollisionBox.collisionVertexArray,f.icon.placed,!r,p?n.x:0,p?n.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.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,e){const i=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*i>t}setStale(){this.stale=!0}}function Rt(t,e,i,n,r){t.emplaceBack(e?1:0,i?1:0,n||0,r||0),t.emplaceBack(e?1:0,i?1:0,n||0,r||0),t.emplaceBack(e?1:0,i?1:0,n||0,r||0),t.emplaceBack(e?1:0,i?1:0,n||0,r||0)}const Ft=Math.pow(2,25),Ot=Math.pow(2,24),Ut=Math.pow(2,17),Vt=Math.pow(2,16),Nt=Math.pow(2,9),Zt=Math.pow(2,8),jt=Math.pow(2,1);function qt(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*Ft+e*Ot+i*Ut+e*Vt+i*Nt+e*Zt+i*jt+e}const $t=0;class Gt{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,r){const o=this._bucketParts;for(;this._currentTileIndex<t.length;)if(e.getBucketParts(o,n,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,r())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort(((t,e)=>t.sortKey-e.sortKey)));this._currentPartIndex<o.length;)if(e.placeLayerBucketPart(o[this._currentPartIndex],this._seenCrossTileIDs,i),this._currentPartIndex++,r())return!0;return!1}}class Ht{constructor(t,e,i,n,r,o,s,a){this.placement=new Bt(t,e,o,s,a),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=n,this._showCollisionBoxes=r,this._done=!1}isDone(){return this._done}continuePlacement(e,i,n){const r=t.browser.now(),o=()=>!this._forceFullPlacement&&t.browser.now()-r>2;for(;this._currentPlacementIndex>=0;){const t=i[e[this._currentPlacementIndex]],r=this.placement.collisionIndex.transform.zoom;if("symbol"===t.type&&(!t.minzoom||t.minzoom<=r)&&(!t.maxzoom||t.maxzoom>r)){if(this._inProgressLayer||(this._inProgressLayer=new Gt(t)),this._inProgressLayer.continuePlacement(n[t.source],this.placement,this._showCollisionBoxes,t,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Wt=512/t.EXTENT/2;class Xt{constructor(e,i,n){this.tileID=e,this.bucketInstanceId=n,this._symbolsByKey={};const r=new Map;for(let t=0;t<i.length;t++){const e=i.get(t),n=e.key,o=r.get(n);o?o.push(e):r.set(n,[e])}for(const[e,i]of r){const n={positions:i.map((t=>({x:Math.floor(t.anchorX*Wt),y:Math.floor(t.anchorY*Wt)}))),crossTileIDs:i.map((t=>t.crossTileID))};if(n.positions.length>128){const e=new t.KDBush(n.positions.length,16,Uint16Array);for(const{x:t,y:i}of n.positions)e.add(t,i);e.finish(),delete n.positions,n.index=e}this._symbolsByKey[e]=n}}getScaledCoordinates(e,i){const{x:n,y:r,z:o}=this.tileID.canonical,{x:s,y:a,z:l}=i.canonical,c=Wt/Math.pow(2,l-o),h=(a*t.EXTENT+e.anchorY)*c,u=r*t.EXTENT*Wt;return{x:Math.floor((s*t.EXTENT+e.anchorX)*c-n*t.EXTENT*Wt),y:Math.floor(h-u)}}findMatches(t,e,i){const n=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z);for(let r=0;r<t.length;r++){const o=t.get(r);if(o.crossTileID)continue;const s=this._symbolsByKey[o.key];if(!s)continue;const a=this.getScaledCoordinates(o,e);if(s.index){const t=s.index.range(a.x-n,a.y-n,a.x+n,a.y+n).sort();for(const e of t){const t=s.crossTileIDs[e];if(!i[t]){i[t]=!0,o.crossTileID=t;break}}}else if(s.positions)for(let t=0;t<s.positions.length;t++){const e=s.positions[t],r=s.crossTileIDs[t];if(Math.abs(e.x-a.x)<=n&&Math.abs(e.y-a.y)<=n&&!i[r]){i[r]=!0,o.crossTileID=r;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:t})=>t))}}class Kt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Yt{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 r=i[t];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+e),n[r.tileID.key]=r}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;t<e.symbolInstances.length;t++)e.symbolInstances.get(t).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const n=this.usedCrossTileIDs[t.overscaledZ];for(const i in this.indexes){const r=this.indexes[i];if(Number(i)>t.overscaledZ)for(const i in r){const o=r[i];o.tileID.isChildOf(t)&&o.findMatches(e.symbolInstances,t,n)}else{const o=r[t.scaledTo(Number(i)).key];o&&o.findMatches(e.symbolInstances,t,n)}}for(let t=0;t<e.symbolInstances.length;t++){const r=e.symbolInstances.get(t);r.crossTileID||(r.crossTileID=i.generate(),n[r.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Xt(t,e.symbolInstances,e.bucketInstanceId),!0}removeBucketCrossTileIDs(t,e){for(const i of e.getCrossTileIDsLists())for(const e of i)delete this.usedCrossTileIDs[t][e]}removeStaleBuckets(t){let e=!1;for(const i in this.indexes){const n=this.indexes[i];for(const r in n)t[n[r].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,n[r]),delete n[r],e=!0)}return e}}class Jt{constructor(){this.layerIndexes={},this.crossTileIDs=new Kt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,e,i){let n=this.layerIndexes[t.id];void 0===n&&(n=this.layerIndexes[t.id]=new Yt);let r=!1;const o={};n.handleWrapJump(i);for(const i of e){const e=i.getBucket(t);e&&t.id===e.layerIds[0]&&(e.bucketInstanceId||(e.bucketInstanceId=++this.maxBucketInstanceId),n.addBucket(i.tileID,e,this.crossTileIDs)&&(r=!0),o[e.bucketInstanceId]=!0)}return n.removeStaleBuckets(o)&&(r=!0),r}pruneUnusedLayers(t){const e={};t.forEach((t=>{e[t]=!0}));for(const t in this.layerIndexes)e[t]||delete this.layerIndexes[t]}}const Qt=(e,i)=>t.emitValidationErrors(e,i&&i.filter((t=>"source.canvas"!==t.identifier))),te=t.pick(t.operations,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),ee=t.pick(t.operations,["setCenter","setZoom","setBearing","setPitch"]),ie=t.emptyStyle();class ne extends t.Evented{constructor(e,i={}){super(),this.map=e,this.dispatcher=new I(nt(),this,e._getMapId()),this.imageManager=new x,this.imageManager.setEventedParent(this),this.glyphManager=new E(e._requestManager,i.localIdeographFontFamily),this.lineAtlas=new M(256,512),this.crossTileSymbolIndex=new Jt,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",t.getReferrer());const n=this;this._rtlTextPluginCallback=ne.registerForPluginStateChange((e=>{n.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:e.pluginStatus,pluginURL:e.pluginURL},((e,i)=>{if(t.triggerPluginCompletionEvent(e),i&&i.every((t=>t)))for(const t in n.sourceCaches){const e=n.sourceCaches[t].getSource().type;"vector"!==e&&"geojson"!==e||n.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={},n){this.fire(new t.Event("dataloading",{dataType:"style"})),i.validate="boolean"!=typeof i.validate||i.validate;const r=this.map._requestManager.transformRequest(e,c.Style);this._request=t.getJSON(r,((e,r)=>{this._request=null,e?this.fire(new t.ErrorEvent(e)):r&&this._load(r,i,n)}))}loadJSON(e,i={},n){this.fire(new t.Event("dataloading",{dataType:"style"})),this._request=t.browser.frame((()=>{this._request=null,i.validate=!1!==i.validate,this._load(e,i,n)}))}loadEmpty(){this.fire(new t.Event("dataloading",{dataType:"style"})),this._load(ie,{validate:!1})}_load(e,i,n){var r;const o=i.transformStyle?i.transformStyle(n,e):e;if(!i.validate||!Qt(this,t.validateStyle(o))){this._loaded=!0,this.stylesheet=o;for(const t in o.sources)this.addSource(t,o.sources[t],{validate:!1});o.sprite?this._loadSprite(o.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(o.glyphs),this._createLayers(),this.light=new C(this.stylesheet.light),this.map.setTerrain(null!==(r=this.stylesheet.terrain)&&void 0!==r?r:null),this.fire(new t.Event("data",{dataType:"style"})),this.fire(new t.Event("style.load"))}}_createLayers(){const e=t.derefLayers(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.createStyleLayer(i);e.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=e}}_loadSprite(e,i=!1,n){this.imageManager.setLoaded(!1),this._spriteRequest=function(e,i,n,r){const o=g(e),s=o.length,a=n>1?"@2x":"",h={},u={},p={};for(const{id:e,url:n}of o){const o=i.transformRequest(i.normalizeSpriteURL(n,a,".json"),c.SpriteJSON),d=`${e}_${o.url}`;h[d]=t.getJSON(o,((t,i)=>{delete h[d],u[e]=i,_(r,u,p,t,s)}));const m=i.transformRequest(i.normalizeSpriteURL(n,a,".png"),c.SpriteImage),f=`${e}_${m.url}`;h[f]=l.getImage(m,((t,i)=>{delete h[f],p[e]=i,_(r,u,p,t,s)}))}return{cancel(){for(const t of Object.values(h))t.cancel()}}}(e,this.map._requestManager,this.map.getPixelRatio(),((e,r)=>{if(this._spriteRequest=null,e)this.fire(new t.ErrorEvent(e));else if(r)for(const t in r){this._spritesImagesIds[t]=[];const e=this._spritesImagesIds[t]?this._spritesImagesIds[t].filter((t=>!(t in r))):[];for(const t of e)this.imageManager.removeImage(t),this._changedImages[t]=!0;for(const e in r[t]){const n="default"===t?e:`${t}:${e}`;this._spritesImagesIds[t].push(n),n in this.imageManager.images?this.imageManager.updateImage(n,r[t][e],!1):this.imageManager.addImage(n,r[t][e]),i&&(this._changedImages[n]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"})),n&&n(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.Event("data",{dataType:"style"}))}_validateLayer(e){const i=this.sourceCaches[e.source];if(!i)return;const n=e.sourceLayer;if(!n)return;const r=i.getSource();("geojson"===r.type||r.vectorLayerIds&&-1===r.vectorLayerIds.indexOf(n))&&this.fire(new t.ErrorEvent(new Error(`Source layer "${n}" does not exist on source "${r.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 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;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 n={};for(const t in this.sourceCaches){const e=this.sourceCaches[t];n[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 n){const i=this.sourceCaches[e];n[e]!==i.used&&i.fire(new t.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:e}))}this.light.recalculate(e),this.z=e.zoom,i&&this.fire(new t.Event("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 n=this.serialize();if(e=i.transformStyle?i.transformStyle(n,e):e,Qt(this,t.validateStyle(e)))return!1;(e=t.clone$1(e)).layers=t.derefLayers(e.layers);const r=t.diffStyles(n,e).filter((t=>!(t.command in ee)));if(0===r.length)return!1;const o=r.filter((t=>!(t.command in te)));if(o.length>0)throw new Error(`Unimplemented: ${o.map((t=>t.command)).join(", ")}.`);for(const t of r)"setTransition"!==t.command&&this[t.command].apply(this,t.args);return this.stylesheet=e,!0}addImage(e,i){if(this.getImage(e))return this.fire(new t.ErrorEvent(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.ErrorEvent(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.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,i,n={}){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.validateStyle.source,`sources.${e}`,i,null,n))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const r=this.sourceCaches[e]=new K(e,i,this.dispatcher);r.style=this,r.setEventedParent(this,(()=>({isSourceLoaded:r.loaded(),source:r.serialize(),sourceId:e}))),r.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.ErrorEvent(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.Event("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,n={}){this._checkLoaded();const r=e.id;if(this.getLayer(r))return void this.fire(new t.ErrorEvent(new Error(`Layer "${r}" already exists on this map.`)));let o;if("custom"===e.type){if(Qt(this,t.validateCustomStyleLayer(e)))return;o=t.createStyleLayer(e)}else{if("source"in e&&"object"==typeof e.source&&(this.addSource(r,e.source),e=t.clone$1(e),e=t.extend(e,{source:r})),this._validate(t.validateStyle.layer,`layers.${r}`,e,{arrayIndex:-1},n))return;o=t.createStyleLayer(e),this._validateLayer(o),o.setEventedParent(this,{layer:{id:r}})}const s=i?this._order.indexOf(i):this._order.length;if(i&&-1===s)this.fire(new t.ErrorEvent(new Error(`Cannot add layer "${r}" before non-existing layer "${i}".`)));else{if(this._order.splice(s,0,r),this._layerOrderChanged=!0,this._layers[r]=o,this._removedLayers[r]&&o.source&&"custom"!==o.type){const t=this._removedLayers[r];delete this._removedLayers[r],t.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map)}}moveLayer(e,i){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===i)return;const n=this._order.indexOf(e);this._order.splice(n,1);const r=i?this._order.indexOf(i):this._order.length;i&&-1===r?this.fire(new t.ErrorEvent(new Error(`Cannot move layer "${e}" before non-existing layer "${i}".`))):(this._order.splice(r,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const i=this._layers[e];if(!i)return void this.fire(new t.ErrorEvent(new Error(`Cannot remove non-existing layer "${e}".`)));i.setEventedParent(null);const n=this._order.indexOf(e);this._order.splice(n,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]}hasLayer(t){return t in this._layers}setLayerZoomRange(e,i,n){this._checkLoaded();const r=this.getLayer(e);r?r.minzoom===i&&r.maxzoom===n||(null!=i&&(r.minzoom=i),null!=n&&(r.maxzoom=n),this._updateLayer(r)):this.fire(new t.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,i,n={}){this._checkLoaded();const r=this.getLayer(e);if(r){if(!t.deepEqual(r.filter,i))return null==i?(r.filter=void 0,void this._updateLayer(r)):void(this._validate(t.validateStyle.filter,`layers.${r.id}.filter`,i,null,n)||(r.filter=t.clone$1(i),this._updateLayer(r)))}else this.fire(new t.ErrorEvent(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return t.clone$1(this.getLayer(e).filter)}setLayoutProperty(e,i,n,r={}){this._checkLoaded();const o=this.getLayer(e);o?t.deepEqual(o.getLayoutProperty(i),n)||(o.setLayoutProperty(i,n,r),this._updateLayer(o)):this.fire(new t.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,i){const n=this.getLayer(e);if(n)return n.getLayoutProperty(i);this.fire(new t.ErrorEvent(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,i,n,r={}){this._checkLoaded();const o=this.getLayer(e);o?t.deepEqual(o.getPaintProperty(i),n)||(o.setPaintProperty(i,n,r)&&this._updateLayer(o),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(e,i){this._checkLoaded();const n=e.source,r=e.sourceLayer,o=this.sourceCaches[n];if(void 0===o)return void this.fire(new t.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)));const s=o.getSource().type;"geojson"===s&&r?this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==s||r?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),o.setFeatureState(r,e.id,i)):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,i){this._checkLoaded();const n=e.source,r=this.sourceCaches[n];if(void 0===r)return void this.fire(new t.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)));const o=r.getSource().type,s="vector"===o?e.sourceLayer:void 0;"vector"!==o||s?i&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):r.removeFeatureState(s,e.id,i):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const i=e.source,n=e.sourceLayer,r=this.sourceCaches[i];if(void 0!==r)return"vector"!==r.getSource().type||n?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),r.getFeatureState(n,e.id)):void this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new t.ErrorEvent(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=t.mapObject(this.sourceCaches,(t=>t.serialize())),i=this._serializeByIds(this._order),n=this.stylesheet;return t.filterObject({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},(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 r=this._order.length-1;r>=0;r--){const o=this._order[r];if(e(o)){i[o]=r;for(const e of t){const t=e[o];if(t)for(const e of t)n.push(e)}}}n.sort(((t,e)=>e.intersectionZ-t.intersectionZ));const r=[];for(let o=this._order.length-1;o>=0;o--){const s=this._order[o];if(e(s))for(let t=n.length-1;t>=0;t--){const e=n[t].feature;if(i[e.layer.id]<o)break;r.push(e),n.pop()}else for(const e of t){const t=e[s];if(t)for(const e of t)r.push(e.feature)}}return r}queryRenderedFeatures(e,i,n){i&&i.filter&&this._validate(t.validateStyle.filter,"queryRenderedFeatures.filter",i.filter,null,i);const r={};if(i&&i.layers){if(!Array.isArray(i.layers))return this.fire(new t.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const e of i.layers){const i=this._layers[e];if(!i)return this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be queried for features.`))),[];r[i.source]=!0}}const o=[];i.availableImages=this._availableImages;const s=this._serializedAllLayers();for(const t in this.sourceCaches)i.layers&&!r[t]||o.push($(this.sourceCaches[t],this._layers,s,e,i,n));return this.placement&&o.push(function(t,e,i,n,r,o,s){const a={},l=o.queryRenderedSymbols(n),c=[];for(const t of Object.keys(l).map(Number))c.push(s[t]);c.sort(G);for(const i of c){const n=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],e,i.bucketIndex,i.sourceLayerIndex,r.filter,r.layers,r.availableImages,t);for(const t in n){const e=a[t]=a[t]||[],r=n[t];r.sort(((t,e)=>{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 r)e.push(t)}}for(const e in a)a[e].forEach((n=>{const r=n.feature,o=i[t[e].source].getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=o}));return a}(this._layers,s,this.sourceCaches,e,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(e,i){i&&i.filter&&this._validate(t.validateStyle.filter,"querySourceFeatures.filter",i.filter,null,i);const n=this.sourceCaches[e];return n?function(t,e){const i=t.getRenderableIds().map((e=>t.getTileByID(e))),n=[],r={};for(let t=0;t<i.length;t++){const o=i[t],s=o.tileID.canonical.key;r[s]||(r[s]=!0,o.querySourceFeatures(n,e))}return n}(n,i):[]}addSourceType(t,e,i){return j(t)?i(new Error(`A source type called "${t}" already exists.`)):(((t,e)=>{Z[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 n=this.light.getLight();let r=!1;for(const i in e)if(!t.deepEqual(e[i],n[i])){r=!0;break}if(!r)return;const o={now:t.browser.now(),transition:t.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,i),this.light.updateTransitions(o)}_validate(e,i,n,r,o={}){return(!o||!1!==o.validate)&&Qt(this,e.call(t.validateStyle,t.extend({key:i,style:this.serialize(),value:n,styleSpec:t.v8Spec},r)))}_remove(e=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),t.evented.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,n,r,o=!1){let s=!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 n=this.crossTileSymbolIndex.addLayer(i,l[i.source],e.center.lng);s=s||n}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((o=o||this._layerOrderChanged||0===n)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(t.browser.now(),e.zoom))&&(this.pauseablePlacement=new Ht(e,this.map.terrain,this._order,o,i,n,r,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.browser.now()),a=!0),s&&this.pauseablePlacement.placement.setStale()),a||s)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.browser.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 n=this.sourceCaches[e.source];n&&n.setDependencies(e.tileID.key,e.type,e.icons)}getGlyphs(t,e,i){this.glyphManager.getGlyphs(e.stacks,i);const n=this.sourceCaches[e.source];n&&n.setDependencies(e.tileID.key,e.type,[""])}getResource(e,i,n){return t.makeRequest(i,n)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,i={}){this._checkLoaded(),e&&this._validate(t.validateStyle.glyphs,"glyphs",e,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,i,n={},r){this._checkLoaded();const o=[{id:e,url:i}],s=[...g(this.stylesheet.sprite),...o];this._validate(t.validateStyle.sprite,"sprite",s,null,n)||(this.stylesheet.sprite=s,this._loadSprite(o,!0,r))}removeSprite(e){this._checkLoaded();const i=g(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.Event("data",{dataType:"style"}))}else this.fire(new t.ErrorEvent(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return g(this.stylesheet.sprite)}setSprite(e,i={},n){this._checkLoaded(),e&&this._validate(t.validateStyle.sprite,"sprite",e,null,i)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,n):(this._unloadSprite(),n&&n(null)))}}ne.registerForPluginStateChange=t.registerForPluginStateChange;var re=t.createLayout([{name:"a_pos",type:"Int16",components:2}]),oe="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 se={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);}",oe),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);}",oe),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);}",oe)};function ae(t,e){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n=e.match(/attribute ([\w]+) ([\w]+)/g),r=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=o?o.concat(r):r,a={};return{fragmentSource:t=t.replace(i,((t,e,i,n,r)=>(a[r]=!0,"define"===e?`\n#ifndef HAS_UNIFORM_u_${r}\nvarying ${i} ${n} ${r};\n#else\nuniform ${i} ${n} u_${r};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${r}\n    ${i} ${n} ${r} = u_${r};\n#endif\n`))),vertexSource:e=e.replace(i,((t,e,i,n,r)=>{const o="float"===n?"vec2":"vec4",s=r.match(/color/)?"color":o;return a[r]?"define"===e?`\n#ifndef HAS_UNIFORM_u_${r}\nuniform lowp float u_${r}_t;\nattribute ${i} ${o} a_${r};\nvarying ${i} ${n} ${r};\n#else\nuniform ${i} ${n} u_${r};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${r}\n    ${r} = a_${r};\n#else\n    ${i} ${n} ${r} = u_${r};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${r}\n    ${r} = unpack_mix_${s}(a_${r}, u_${r}_t);\n#else\n    ${i} ${n} ${r} = u_${r};\n#endif\n`:"define"===e?`\n#ifndef HAS_UNIFORM_u_${r}\nuniform lowp float u_${r}_t;\nattribute ${i} ${o} a_${r};\n#else\nuniform ${i} ${n} u_${r};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${r}\n    ${i} ${n} ${r} = a_${r};\n#else\n    ${i} ${n} ${r} = u_${r};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${r}\n    ${i} ${n} ${r} = unpack_mix_${s}(a_${r}, u_${r}_t);\n#else\n    ${i} ${n} ${r} = u_${r};\n#endif\n`})),staticAttributes:n,staticUniforms:s}}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,n,r,o,s,a,l){this.context=t;let c=this.boundPaintVertexBuffers.length!==n.length;for(let t=0;!c&&t<n.length;t++)this.boundPaintVertexBuffers[t]!==n[t]&&(c=!0);!this.vao||this.boundProgram!==e||this.boundLayoutVertexBuffer!==i||c||this.boundIndexBuffer!==r||this.boundVertexOffset!==o||this.boundDynamicVertexBuffer!==s||this.boundDynamicVertexBuffer2!==a||this.boundDynamicVertexBuffer3!==l?this.freshBind(e,i,n,r,o,s,a,l):(t.bindVertexArray.set(this.vao),s&&s.bind(),r&&r.dynamicDraw&&r.bind(),a&&a.bind(),l&&l.bind())}freshBind(t,e,i,n,r,o,s,a){const l=t.numAttributes,c=this.context,h=c.gl;this.vao&&this.destroy(),this.vao=c.createVertexArray(),c.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=n,this.boundVertexOffset=r,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=s,this.boundDynamicVertexBuffer3=a,e.enableAttributes(h,t);for(const e of i)e.enableAttributes(h,t);o&&o.enableAttributes(h,t),s&&s.enableAttributes(h,t),a&&a.enableAttributes(h,t),e.bind(),e.setVertexAttribPointers(h,t,r);for(const e of i)e.bind(),e.setVertexAttribPointers(h,t,r);o&&(o.bind(),o.setVertexAttribPointers(h,t,r)),n&&n.bind(),s&&(s.bind(),s.setVertexAttribPointers(h,t,r)),a&&(a.bind(),a.setVertexAttribPointers(h,t,r)),c.currentNumAttributes=l}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}function ce(t){const e=[];for(let i=0;i<t.length;i++){if(null===t[i])continue;const n=t[i].split(" ");e.push(n.pop())}return e}class he{constructor(e,i,n,r,o,s){const a=e.gl;this.program=a.createProgram();const l=ce(i.staticAttributes),c=n?n.getBinderAttributes():[],h=l.concat(c),u=se.prelude.staticUniforms?ce(se.prelude.staticUniforms):[],p=i.staticUniforms?ce(i.staticUniforms):[],d=n?n.getBinderUniforms():[],m=u.concat(p).concat(d),f=[];for(const t of m)f.indexOf(t)<0&&f.push(t);const g=n?n.defines():[];o&&g.push("#define OVERDRAW_INSPECTOR;"),s&&g.push("#define TERRAIN3D;");const _=g.concat(se.prelude.fragmentSource,i.fragmentSource).join("\n"),y=g.concat(se.prelude.vertexSource,i.vertexSource).join("\n"),v=a.createShader(a.FRAGMENT_SHADER);if(a.isContextLost())return void(this.failedToCreate=!0);if(a.shaderSource(v,_),a.compileShader(v),!a.getShaderParameter(v,a.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${a.getShaderInfoLog(v)}`);a.attachShader(this.program,v);const x=a.createShader(a.VERTEX_SHADER);if(a.isContextLost())return void(this.failedToCreate=!0);if(a.shaderSource(x,y),a.compileShader(x),!a.getShaderParameter(x,a.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${a.getShaderInfoLog(x)}`);a.attachShader(this.program,x),this.attributes={};const b={};this.numAttributes=h.length;for(let t=0;t<this.numAttributes;t++)h[t]&&(a.bindAttribLocation(this.program,t,h[t]),this.attributes[h[t]]=t);if(a.linkProgram(this.program),!a.getProgramParameter(this.program,a.LINK_STATUS))throw new Error(`Program failed to link: ${a.getProgramInfoLog(this.program)}`);a.deleteShader(x),a.deleteShader(v);for(let t=0;t<f.length;t++){const e=f[t];if(e&&!b[e]){const t=a.getUniformLocation(this.program,e);t&&(b[e]=t)}}this.fixedUniforms=r(e,b),this.terrainUniforms=((e,i)=>({u_depth:new t.Uniform1i(e,i.u_depth),u_terrain:new t.Uniform1i(e,i.u_terrain),u_terrain_dim:new t.Uniform1f(e,i.u_terrain_dim),u_terrain_matrix:new t.UniformMatrix4f(e,i.u_terrain_matrix),u_terrain_unpack:new t.Uniform4f(e,i.u_terrain_unpack),u_terrain_exaggeration:new t.Uniform1f(e,i.u_terrain_exaggeration)}))(e,b),this.binderUniforms=n?n.getUniforms(e,b):[]}draw(t,e,i,n,r,o,s,a,l,c,h,u,p,d,m,f,g,_){const y=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(n),t.setColorMode(r),t.setCullFace(o),a){t.activeTexture.set(y.TEXTURE2),y.bindTexture(y.TEXTURE_2D,a.depthTexture),t.activeTexture.set(y.TEXTURE3),y.bindTexture(y.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(s[t]);m&&m.setUniforms(t,this.binderUniforms,p,{zoom:d});let v=0;switch(e){case y.LINES:v=2;break;case y.TRIANGLES:v=3;break;case y.LINE_STRIP:v=1}for(const i of u.get()){const n=i.vaos||(i.vaos={});(n[l]||(n[l]=new le)).bind(t,this,c,m?m.getPaintVertexBuffers():[],h,i.vertexOffset,f,g,_),y.drawElements(e,i.primitiveLength*v,y.UNSIGNED_SHORT,i.primitiveOffset*v*2)}}}function ue(t,e,i){const n=1/Pt(i,1,e.transform.tileZoom),r=Math.pow(2,i.tileID.overscaledZ),o=i.tileSize*Math.pow(2,e.transform.tileZoom)/r,s=o*(i.tileID.canonical.x+i.tileID.wrap*r),a=o*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:[s>>16,a>>16],u_pixel_coord_lower:[65535&s,65535&a]}}const pe=(e,i,n,r)=>{const o=i.style.light,s=o.properties.get("position"),a=[s.x,s.y,s.z],l=function(){var e=new t.ARRAY_TYPE(9);return t.ARRAY_TYPE!=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"===o.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],r=e[1],o=e[2];t[0]=n*i[0]+r*i[3]+o*i[6],t[1]=n*i[1]+r*i[4]+o*i[7],t[2]=n*i[2]+r*i[5]+o*i[8]}(a,a,l);const c=o.properties.get("color");return{u_matrix:e,u_lightpos:a,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[c.r,c.g,c.b],u_vertical_gradient:+n,u_opacity:r}},de=(e,i,n,r,o,s,a)=>t.extend(pe(e,i,n,r),ue(s,i,a),{u_height_factor:-Math.pow(2,o.overscaledZ)/a.tileSize/8}),me=t=>({u_matrix:t}),fe=(e,i,n,r)=>t.extend(me(e),ue(n,i,r)),ge=(t,e)=>({u_matrix:t,u_world:e}),_e=(e,i,n,r,o)=>t.extend(fe(e,i,n,r),{u_world:o}),ye=(t,e,i,n)=>{const r=t.transform;let o,s;if("map"===n.paint.get("circle-pitch-alignment")){const t=Pt(i,1,r.zoom);o=!0,s=[t,t]}else o=!1,s=r.pixelsToGLUnits;return{u_camera_to_center_distance:r.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:+o,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:s}},ve=(t,e,i)=>{const n=Pt(i,1,e.zoom),r=Math.pow(2,e.zoom-i.tileID.overscaledZ),o=i.tileID.overscaleFactor();return{u_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:n,u_extrude_scale:[e.pixelsToGLUnits[0]/(n*r),e.pixelsToGLUnits[1]/(n*r)],u_overscale_factor:o}},xe=(t,e,i=1)=>({u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:i}),be=t=>({u_matrix:t}),we=(t,e,i,n)=>({u_matrix:t,u_extrude_scale:Pt(e,1,i),u_intensity:n});function Te(e,i){const n=Math.pow(2,i.canonical.z),r=i.canonical.y;return[new t.MercatorCoordinate(0,r/n).toLngLat().lat,new t.MercatorCoordinate(0,(r+1)/n).toLngLat().lat]}const Ee=(t,e,i,n)=>{const r=t.transform;return{u_matrix:Me(t,e,i,n),u_ratio:1/Pt(e,1,r.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/r.pixelsToGLUnits[0],1/r.pixelsToGLUnits[1]]}},Se=(e,i,n,r,o)=>t.extend(Ee(e,i,n,o),{u_image:0,u_image_height:r}),Pe=(t,e,i,n,r)=>{const o=t.transform,s=Ce(e,o);return{u_matrix:Me(t,e,i,r),u_texsize:e.imageAtlasTexture.size,u_ratio:1/Pt(e,1,o.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[s,n.fromScale,n.toScale],u_fade:n.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},ze=(e,i,n,r,o,s)=>{const a=e.lineAtlas,l=Ce(i,e.transform),c="round"===n.layout.get("line-cap"),h=a.getDash(r.from,c),u=a.getDash(r.to,c),p=h.width*o.fromScale,d=u.width*o.toScale;return t.extend(Ee(e,i,n,s),{u_patternscale_a:[l/p,-h.height/2],u_patternscale_b:[l/d,-u.height/2],u_sdfgamma:a.width/(256*Math.min(p,d)*e.pixelRatio)/2,u_image:0,u_tex_y_a:h.y,u_tex_y_b:u.y,u_mix:o.t})};function Ce(t,e){return 1/Pt(t,1,e.tileZoom)}function Me(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 Ie=(t,e,i,n,r)=>{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*r.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:r.paint.get("raster-brightness-min"),u_brightness_high:r.paint.get("raster-brightness-max"),u_saturation_factor:(s=r.paint.get("raster-saturation"),s>0?1-1/(1.001-s):-s),u_contrast_factor:(o=r.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:Ae(r.paint.get("raster-hue-rotate"))};var o,s};function Ae(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 ke=(t,e,i,n,r,o,s,a,l,c)=>{const h=r.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:h.cameraToCenterDistance,u_pitch:h.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:h.width/h.height,u_fade_change:r.options.fadeDuration?r.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:s,u_coord_matrix:a,u_is_text:+l,u_pitch_with_map:+n,u_texsize:c,u_texture:0}},Le=(e,i,n,r,o,s,a,l,c,h,u)=>{const p=o.transform;return t.extend(ke(e,i,n,r,o,s,a,l,c,h),{u_gamma_scale:r?Math.cos(p._pitch)*p.cameraToCenterDistance:1,u_device_pixel_ratio:o.pixelRatio,u_is_halo:+u})},De=(e,i,n,r,o,s,a,l,c,h)=>t.extend(Le(e,i,n,r,o,s,a,l,!0,c,!0),{u_texsize_icon:h,u_texture_icon:1}),Be=(t,e,i)=>({u_matrix:t,u_opacity:e,u_color:i}),Re=(e,i,n,r,o,s)=>t.extend(function(t,e,i,n){const r=i.imageManager.getPattern(t.from.toString()),o=i.imageManager.getPattern(t.to.toString()),{width:s,height:a}=i.imageManager.getPixelSize(),l=Math.pow(2,n.tileID.overscaledZ),c=n.tileSize*Math.pow(2,i.transform.tileZoom)/l,h=c*(n.tileID.canonical.x+n.tileID.wrap*l),u=c*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:r.tl,u_pattern_br_a:r.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[s,a],u_mix:e.t,u_pattern_size_a:r.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/Pt(n,1,i.transform.tileZoom),u_pixel_coord_upper:[h>>16,u>>16],u_pixel_coord_lower:[65535&h,65535&u]}}(r,s,n,o),{u_matrix:e,u_opacity:i}),Fe={fillExtrusion:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_opacity:new t.Uniform1f(e,i.u_opacity)}),fillExtrusionPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,i.u_height_factor),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade),u_opacity:new t.Uniform1f(e,i.u_opacity)}),fill:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),fillPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),fillOutline:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world)}),fillOutlinePattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),circle:(e,i)=>({u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(e,i.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),collisionBox:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(e,i.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_overscale_factor:new t.Uniform1f(e,i.u_overscale_factor)}),collisionCircle:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,i.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,i.u_viewport_size)}),debug:(e,i)=>({u_color:new t.UniformColor(e,i.u_color),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_overlay:new t.Uniform1i(e,i.u_overlay),u_overlay_scale:new t.Uniform1f(e,i.u_overlay_scale)}),clippingMask:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),heatmap:(e,i)=>({u_extrude_scale:new t.Uniform1f(e,i.u_extrude_scale),u_intensity:new t.Uniform1f(e,i.u_intensity),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),heatmapTexture:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_color_ramp:new t.Uniform1i(e,i.u_color_ramp),u_opacity:new t.Uniform1f(e,i.u_opacity)}),hillshade:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_latrange:new t.Uniform2f(e,i.u_latrange),u_light:new t.Uniform2f(e,i.u_light),u_shadow:new t.UniformColor(e,i.u_shadow),u_highlight:new t.UniformColor(e,i.u_highlight),u_accent:new t.UniformColor(e,i.u_accent)}),hillshadePrepare:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_dimension:new t.Uniform2f(e,i.u_dimension),u_zoom:new t.Uniform1f(e,i.u_zoom),u_unpack:new t.Uniform4f(e,i.u_unpack)}),line:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels)}),lineGradient:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_image:new t.Uniform1i(e,i.u_image),u_image_height:new t.Uniform1f(e,i.u_image_height)}),linePattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texsize:new t.Uniform2f(e,i.u_texsize),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_image:new t.Uniform1i(e,i.u_image),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),lineSDF:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,i.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,i.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,i.u_sdfgamma),u_image:new t.Uniform1i(e,i.u_image),u_tex_y_a:new t.Uniform1f(e,i.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,i.u_tex_y_b),u_mix:new t.Uniform1f(e,i.u_mix)}),raster:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_tl_parent:new t.Uniform2f(e,i.u_tl_parent),u_scale_parent:new t.Uniform1f(e,i.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,i.u_buffer_scale),u_fade_t:new t.Uniform1f(e,i.u_fade_t),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image0:new t.Uniform1i(e,i.u_image0),u_image1:new t.Uniform1i(e,i.u_image1),u_brightness_low:new t.Uniform1f(e,i.u_brightness_low),u_brightness_high:new t.Uniform1f(e,i.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,i.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,i.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,i.u_spin_weights)}),symbolIcon:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture)}),symbolSDF:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}),symbolTextAndIcon:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texsize_icon:new t.Uniform2f(e,i.u_texsize_icon),u_texture:new t.Uniform1i(e,i.u_texture),u_texture_icon:new t.Uniform1i(e,i.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}),background:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_color:new t.UniformColor(e,i.u_color)}),backgroundPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image:new t.Uniform1i(e,i.u_image),u_pattern_tl_a:new t.Uniform2f(e,i.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,i.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,i.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,i.u_pattern_br_b),u_texsize:new t.Uniform2f(e,i.u_texsize),u_mix:new t.Uniform1f(e,i.u_mix),u_pattern_size_a:new t.Uniform2f(e,i.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,i.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,i.u_scale_a),u_scale_b:new t.Uniform1f(e,i.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,i.u_tile_units_to_pixels)}),terrain:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texture:new t.Uniform1i(e,i.u_texture),u_ele_delta:new t.Uniform1f(e,i.u_ele_delta)}),terrainDepth:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ele_delta:new t.Uniform1f(e,i.u_ele_delta)}),terrainCoords:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texture:new t.Uniform1i(e,i.u_texture),u_terrain_coords_id:new t.Uniform1f(e,i.u_terrain_coords_id),u_ele_delta:new t.Uniform1f(e,i.u_ele_delta)})};class Oe{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 Ue={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Ve{constructor(t,e,i,n){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=n,this.context=t;const r=t.gl;this.buffer=r.createBuffer(),t.bindVertexBuffer.set(this.buffer),r.bufferData(r.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.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;i<this.attributes.length;i++){const n=e.attributes[this.attributes[i].name];void 0!==n&&t.enableVertexAttribArray(n)}}setVertexAttribPointers(t,e,i){for(let n=0;n<this.attributes.length;n++){const r=this.attributes[n],o=e.attributes[r.name];void 0!==o&&t.vertexAttribPointer(o,r.components,t[Ue[r.type]],!1,this.itemSize,r.offset+this.itemSize*(i||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ne=new WeakMap;function Ze(t){if(Ne.has(t))return Ne.get(t);{const e=t.getParameter(t.VERSION).startsWith("WebGL 2.0");return Ne.set(t,e),e}}class je{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class qe extends je{getDefault(){return t.Color.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class $e extends je{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Ge extends je{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class He extends je{getDefault(){return[!0,!0,!0,!0]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class We extends je{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Xe extends je{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Ke extends je{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const e=this.current;(t.func!==e.func||t.ref!==e.ref||t.mask!==e.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Ye extends je{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Je extends je{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}}class Qe extends je{getDefault(){return[0,1]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class ti extends je{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}}class ei extends je{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class ii extends je{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}}class ni extends je{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class ri extends je{getDefault(){return t.Color.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class oi extends je{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class si extends je{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}}class ai extends je{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class li extends je{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class ci extends je{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class hi extends je{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class ui extends je{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class pi extends je{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class di extends je{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class mi extends je{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class fi extends je{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class gi extends je{getDefault(){return null}set(t){const e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class _i extends je{getDefault(){return null}set(t){var e;if(t===this.current&&!this.dirty)return;const i=this.gl;Ze(i)?i.bindVertexArray(t):null===(e=i.getExtension("OES_vertex_array_object"))||void 0===e||e.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class yi extends je{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class vi extends je{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class xi extends je{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class bi extends je{constructor(t,e){super(t),this.context=t,this.parent=e}getDefault(){return null}}class wi extends bi{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Ti extends bi{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Ei extends bi{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Si{constructor(t,e,i,n,r){this.context=t,this.width=e,this.height=i;const o=t.gl,s=this.framebuffer=o.createFramebuffer();if(this.colorAttachment=new wi(t,s),n)this.depthAttachment=r?new Ei(t,s):new Ti(t,s);else if(r)throw new Error("Stencil cannot be setted without depth");if(o.checkFramebufferStatus(o.FRAMEBUFFER)!==o.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){const e=this.depthAttachment.get();e&&t.deleteRenderbuffer(e)}t.deleteFramebuffer(this.framebuffer)}}class Pi{constructor(t,e,i){this.blendFunction=t,this.blendColor=e,this.mask=i}}Pi.Replace=[1,0],Pi.disabled=new Pi(Pi.Replace,t.Color.transparent,[!1,!1,!1,!1]),Pi.unblended=new Pi(Pi.Replace,t.Color.transparent,[!0,!0,!0,!0]),Pi.alphaBlended=new Pi([1,771],t.Color.transparent,[!0,!0,!0,!0]);class zi{constructor(t){var e,i;if(this.gl=t,this.clearColor=new qe(this),this.clearDepth=new $e(this),this.clearStencil=new Ge(this),this.colorMask=new He(this),this.depthMask=new We(this),this.stencilMask=new Xe(this),this.stencilFunc=new Ke(this),this.stencilOp=new Ye(this),this.stencilTest=new Je(this),this.depthRange=new Qe(this),this.depthTest=new ti(this),this.depthFunc=new ei(this),this.blend=new ii(this),this.blendFunc=new ni(this),this.blendColor=new ri(this),this.blendEquation=new oi(this),this.cullFace=new si(this),this.cullFaceSide=new ai(this),this.frontFace=new li(this),this.program=new ci(this),this.activeTexture=new hi(this),this.viewport=new ui(this),this.bindFramebuffer=new pi(this),this.bindRenderbuffer=new di(this),this.bindTexture=new mi(this),this.bindVertexBuffer=new fi(this),this.bindElementBuffer=new gi(this),this.bindVertexArray=new _i(this),this.pixelStoreUnpack=new yi(this),this.pixelStoreUnpackPremultiplyAlpha=new vi(this),this.pixelStoreUnpackFlipY=new xi(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),Ze(t)){this.HALF_FLOAT=t.HALF_FLOAT;const n=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=null!==(e=t.RGBA16F)&&void 0!==e?e:null==n?void 0:n.RGBA16F_EXT,this.RGB16F=null!==(i=t.RGB16F)&&void 0!==i?i:null==n?void 0:n.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const e=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=null==e?void 0:e.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,e){return new Oe(this,t,e)}createVertexBuffer(t,e,i){return new Ve(this,t,e,i)}createRenderbuffer(t,e,i){const n=this.gl,r=n.createRenderbuffer();return this.bindRenderbuffer.set(r),n.renderbufferStorage(n.RENDERBUFFER,t,e,i),this.bindRenderbuffer.set(null),r}createFramebuffer(t,e,i,n){return new Si(this,t,e,i,n)}clear({color:t,depth:e,stencil:i}){const n=this.gl;let r=0;t&&(r|=n.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==e&&(r|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(e),this.depthMask.set(!0)),void 0!==i&&(r|=n.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),n.clear(r)}setCullFace(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(e){t.deepEqual(e.blendFunction,Pi.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var t;return Ze(this.gl)?this.gl.createVertexArray():null===(t=this.gl.getExtension("OES_vertex_array_object"))||void 0===t?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var e;return Ze(this.gl)?this.gl.deleteVertexArray(t):null===(e=this.gl.getExtension("OES_vertex_array_object"))||void 0===e?void 0:e.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}class Ci{constructor(t,e,i){this.func=t,this.mask=e,this.range=i}}Ci.ReadOnly=!1,Ci.ReadWrite=!0,Ci.disabled=new Ci(519,Ci.ReadOnly,[0,1]);const Mi=7680;class Ii{constructor(t,e,i,n,r,o){this.test=t,this.ref=e,this.mask=i,this.fail=n,this.depthFail=r,this.pass=o}}Ii.disabled=new Ii({func:519,mask:0},0,0,Mi,Mi,Mi);class Ai{constructor(t,e,i){this.enable=t,this.mode=e,this.frontFace=i}}let ki;function Li(e,i,n,r,o,s,a){const l=e.context,c=l.gl,h=e.useProgram("collisionBox"),u=[];let p=0,d=0;for(let m=0;m<r.length;m++){const f=r[m],g=i.getTile(f),_=g.getBucket(n);if(!_)continue;let y=f.posMatrix;0===o[0]&&0===o[1]||(y=e.translatePosMatrix(f.posMatrix,g,o,s));const v=a?_.textCollisionBox:_.iconCollisionBox,x=_.collisionCircleArray;if(x.length>0){const i=t.create(),n=y;t.mul(i,_.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(i,i,_.placementViewportMatrix),u.push({circleArray:x,circleOffset:d,transform:n,invTransform:i,coord:f}),p+=x.length/4,d=p}v&&h.draw(l,c.LINES,Ci.disabled,Ii.disabled,e.colorModeForRenderPass(),Ai.disabled,ve(y,e.transform,g),e.style.map.terrain&&e.style.map.terrain.getTerrainData(f),n.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,null,e.transform.zoom,null,null,v.collisionVertexBuffer)}if(!a||!u.length)return;const m=e.useProgram("collisionCircle"),f=new t.CollisionCircleLayoutArray;f.resize(4*p),f._trim();let g=0;for(const t of u)for(let e=0;e<t.circleArray.length/4;e++){const i=4*e,n=t.circleArray[i+0],r=t.circleArray[i+1],o=t.circleArray[i+2],s=t.circleArray[i+3];f.emplace(g++,n,r,o,s,0),f.emplace(g++,n,r,o,s,1),f.emplace(g++,n,r,o,s,2),f.emplace(g++,n,r,o,s,3)}(!ki||ki.length<2*p)&&(ki=function(e){const i=2*e,n=new t.QuadTriangleArray;n.resize(i),n._trim();for(let t=0;t<i;t++){const e=6*t;n.uint16[e+0]=4*t+0,n.uint16[e+1]=4*t+1,n.uint16[e+2]=4*t+2,n.uint16[e+3]=4*t+2,n.uint16[e+4]=4*t+3,n.uint16[e+5]=4*t+0}return n}(p));const _=l.createIndexBuffer(ki,!0),y=l.createVertexBuffer(f,t.collisionCircleLayout.members,!0);for(const i of u){const r={u_matrix:i.transform,u_inv_matrix:i.invTransform,u_camera_to_center_distance:(v=e.transform).cameraToCenterDistance,u_viewport_size:[v.width,v.height]};m.draw(l,c.TRIANGLES,Ci.disabled,Ii.disabled,e.colorModeForRenderPass(),Ai.disabled,r,e.style.map.terrain&&e.style.map.terrain.getTerrainData(i.coord),n.id,y,_,t.SegmentVector.simpleSegment(0,2*i.circleOffset,i.circleArray.length,i.circleArray.length/2),null,e.transform.zoom,null,null,null)}var v;y.destroy(),_.destroy()}Ai.disabled=new Ai(!1,1029,2305),Ai.backCCW=new Ai(!0,1029,2305);const Di=t.identity(new Float32Array(16));function Bi(e,i,n,r,o,s){const{horizontalAlign:a,verticalAlign:l}=t.getAnchorAlignment(e);return new t.Point((-(a-.5)*i/o+r[0])*s,(-(l-.5)*n/o+r[1])*s)}function Ri(e,i,n,r,o,s,a,l,c,h,u){const p=e.text.placedSymbolArray,d=e.text.dynamicLayoutVertexArray,m=e.icon.dynamicLayoutVertexArray,f={};d.clear();for(let m=0;m<p.length;m++){const g=p.get(m),_=g.hidden||!g.crossTileID||e.allowVerticalPlacement&&!g.placedOrientation?null:r[g.crossTileID];if(_){const r=new t.Point(g.anchorX,g.anchorY),p=ct(r,n?a:s,u),m=ht(o.cameraToCenterDistance,p.signedDistanceFromCamera);let y=t.evaluateSizeForFeature(e.textSizeData,c,g)*m/t.ONE_EM;n&&(y*=e.tilePixelRatio/l);const{width:v,height:x,anchor:b,textOffset:w,textBoxScale:T}=_,E=Bi(b,v,x,w,T,y),S=n?ct(r.add(E),s,u).point:p.point.add(i?E.rotate(-o.angle):E),P=e.allowVerticalPlacement&&g.placedOrientation===t.WritingMode.vertical?Math.PI/2:0;for(let e=0;e<g.numGlyphs;e++)t.addDynamicAttributes(d,S,P);h&&g.associatedIconIndex>=0&&(f[g.associatedIconIndex]={shiftedAnchor:S,angle:P})}else wt(g.numGlyphs,d)}if(h){m.clear();const i=e.icon.placedSymbolArray;for(let e=0;e<i.length;e++){const n=i.get(e);if(n.hidden)wt(n.numGlyphs,m);else{const i=f[e];if(i)for(let e=0;e<n.numGlyphs;e++)t.addDynamicAttributes(m,i.shiftedAnchor,i.angle);else wt(n.numGlyphs,m)}}e.icon.dynamicLayoutVertexBuffer.updateData(m)}e.text.dynamicLayoutVertexBuffer.updateData(d)}function Fi(t,e,i){return i.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function Oi(e,i,n,r,o,s,a,l,c,h,u,p){const d=e.context,m=d.gl,f=e.transform,g="map"===l,_="map"===c,y="viewport"!==l&&"point"!==n.layout.get("symbol-placement"),v=g&&!_&&!y,x=!n.layout.get("symbol-sort-key").isConstant();let b=!1;const w=e.depthModeForSublayer(0,Ci.ReadOnly),T=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=[];for(const l of r){const r=i.getTile(l),c=r.getBucket(n);if(!c)continue;const u=o?c.text:c.icon;if(!u||!u.segments.get().length||!u.hasVisibleVertices)continue;const p=u.programConfigurations.get(n.id),d=o||c.sdfIcons,w=o?c.textSizeData:c.iconSizeData,S=_||0!==f.pitch,P=e.useProgram(Fi(d,o,c),p),z=t.evaluateSizeForZoom(w,f.zoom),C=e.style.map.terrain&&e.style.map.terrain.getTerrainData(l);let M,I,A,k,L=[0,0],D=null;if(o)I=r.glyphAtlasTexture,A=m.LINEAR,M=r.glyphAtlasTexture.size,c.iconsInText&&(L=r.imageAtlasTexture.size,D=r.imageAtlasTexture,k=S||e.options.rotating||e.options.zooming||"composite"===w.kind||"camera"===w.kind?m.LINEAR:m.NEAREST);else{const t=1!==n.layout.get("icon-size").constantOr(0)||c.iconsNeedLinear;I=r.imageAtlasTexture,A=d||e.options.rotating||e.options.zooming||t||S?m.LINEAR:m.NEAREST,M=r.imageAtlasTexture.size}const B=Pt(r,1,e.transform.zoom),R=at(l.posMatrix,_,g,e.transform,B),F=lt(l.posMatrix,_,g,e.transform,B),O=T&&c.hasTextData(),U="none"!==n.layout.get("icon-text-fit")&&O&&c.hasIconData();if(y){const t=e.style.map.terrain?(t,i)=>e.style.map.terrain.getElevation(l,t,i):null,i="map"===n.layout.get("text-rotation-alignment");pt(c,l.posMatrix,e,o,R,F,_,h,i,t)}const V=e.translatePosMatrix(l.posMatrix,r,s,a),N=y||o&&T||U?Di:R,Z=e.translatePosMatrix(F,r,s,a,!0),j=d&&0!==n.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1);let q;q=d?c.iconsInText?De(w.kind,z,v,_,e,V,N,Z,M,L):Le(w.kind,z,v,_,e,V,N,Z,o,M,!0):ke(w.kind,z,v,_,e,V,N,Z,o,M);const $={program:P,buffers:u,uniformValues:q,atlasTexture:I,atlasTextureIcon:D,atlasInterpolation:A,atlasInterpolationIcon:k,isSDF:d,hasHalo:j};if(x&&c.canOverlap){b=!0;const e=u.segments.get();for(const i of e)E.push({segments:new t.SegmentVector([i]),sortKey:i.sortKey,state:$,terrainData:C})}else E.push({segments:u.segments,sortKey:0,state:$,terrainData:C})}b&&E.sort(((t,e)=>t.sortKey-e.sortKey));for(const t of E){const i=t.state;if(d.activeTexture.set(m.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,m.CLAMP_TO_EDGE),i.atlasTextureIcon&&(d.activeTexture.set(m.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,m.CLAMP_TO_EDGE)),i.isSDF){const r=i.uniformValues;i.hasHalo&&(r.u_is_halo=1,Ui(i.buffers,t.segments,n,e,i.program,w,u,p,r,t.terrainData)),r.u_is_halo=0}Ui(i.buffers,t.segments,n,e,i.program,w,u,p,i.uniformValues,t.terrainData)}}function Ui(t,e,i,n,r,o,s,a,l,c){const h=n.context;r.draw(h,h.gl.TRIANGLES,o,s,a,Ai.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 Vi(t,e,i,n,r){if(!i||!n||!n.imageAtlas)return;const o=n.imageAtlas.patternPositions;let s=o[i.to.toString()],a=o[i.from.toString()];if(!s||!a){const t=r.getPaintProperty(e);s=o[t],a=o[t]}s&&a&&t.setConstantPatternPositions(s,a)}function Ni(t,e,i,n,r,o,s){const a=t.context.gl,l="fill-pattern",c=i.paint.get(l),h=c&&c.constantOr(1),u=i.getCrossfadeParameters();let p,d,m,f,g;s?(d=h&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",p=a.LINES):(d=h?"fillPattern":"fill",p=a.TRIANGLES);const _=c.constantOr(null);for(const c of n){const n=e.getTile(c);if(h&&!n.patternsLoaded())continue;const y=n.getBucket(i);if(!y)continue;const v=y.programConfigurations.get(i.id),x=t.useProgram(d,v),b=t.style.map.terrain&&t.style.map.terrain.getTerrainData(c);h&&(t.context.activeTexture.set(a.TEXTURE0),n.imageAtlasTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE),v.updatePaintBuffers(u)),Vi(v,l,_,n,i);const w=b?c:null,T=t.translatePosMatrix(w?w.posMatrix:c.posMatrix,n,i.paint.get("fill-translate"),i.paint.get("fill-translate-anchor"));if(s){f=y.indexBuffer2,g=y.segments2;const e=[a.drawingBufferWidth,a.drawingBufferHeight];m="fillOutlinePattern"===d&&h?_e(T,t,u,n,e):ge(T,e)}else f=y.indexBuffer,g=y.segments,m=h?fe(T,t,u,n):me(T);x.draw(t.context,p,r,t.stencilModeForClipping(c),o,Ai.disabled,m,b,i.id,y.layoutVertexBuffer,f,g,i.paint,t.transform.zoom,v)}}function Zi(t,e,i,n,r,o,s){const a=t.context,l=a.gl,c="fill-extrusion-pattern",h=i.paint.get(c),u=h.constantOr(1),p=i.getCrossfadeParameters(),d=i.paint.get("fill-extrusion-opacity"),m=h.constantOr(null);for(const h of n){const n=e.getTile(h),f=n.getBucket(i);if(!f)continue;const g=t.style.map.terrain&&t.style.map.terrain.getTerrainData(h),_=f.programConfigurations.get(i.id),y=t.useProgram(u?"fillExtrusionPattern":"fillExtrusion",_);u&&(t.context.activeTexture.set(l.TEXTURE0),n.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),_.updatePaintBuffers(p)),Vi(_,c,m,n,i);const v=t.translatePosMatrix(h.posMatrix,n,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),x=i.paint.get("fill-extrusion-vertical-gradient"),b=u?de(v,t,x,d,h,p,n):pe(v,t,x,d);y.draw(a,a.gl.TRIANGLES,r,o,s,Ai.backCCW,b,g,i.id,f.layoutVertexBuffer,f.indexBuffer,f.segments,i.paint,t.transform.zoom,_,t.style.map.terrain&&f.centroidVertexBuffer)}}function ji(t,e,i,n,r,o,s){const a=t.context,l=a.gl,c=i.fbo;if(!c)return;const h=t.useProgram("hillshade"),u=t.style.map.terrain&&t.style.map.terrain.getTerrainData(e);a.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,c.colorAttachment.get()),h.draw(a,l.TRIANGLES,r,o,s,Ai.disabled,((t,e,i,n)=>{const r=i.paint.get("hillshade-shadow-color"),o=i.paint.get("hillshade-highlight-color"),s=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:Te(0,e.tileID),u_light:[i.paint.get("hillshade-exaggeration"),a],u_shadow:r,u_highlight:o,u_accent:s}})(t,i,n,u?e:null),u,n.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}function qi(e,i,n,r,o,s){const a=e.context,l=a.gl,c=i.dem;if(c&&c.data){const h=c.dim,u=c.stride,p=c.getPixels();if(a.activeTexture.set(l.TEXTURE1),a.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||e.getTileTexture(u),i.demTexture){const t=i.demTexture;t.update(p,{premultiply:!1}),t.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else i.demTexture=new y(a,p,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 y(a,{width:h,height:h,data:null},l.RGBA);t.bind(l.LINEAR,l.CLAMP_TO_EDGE),d=i.fbo=a.createFramebuffer(h,h,!0,!1),d.colorAttachment.set(t.texture)}a.bindFramebuffer.set(d.framebuffer),a.viewport.set([0,0,h,h]),e.useProgram("hillshadePrepare").draw(a,l.TRIANGLES,r,o,s,Ai.disabled,((e,i)=>{const n=i.stride,r=t.create();return t.ortho(r,0,t.EXTENT,-t.EXTENT,0,0,1),t.translate(r,r,[0,-t.EXTENT,0]),{u_matrix:r,u_image:1,u_dimension:[n,n],u_zoom:e.overscaledZ,u_unpack:i.getUnpackVector()}})(i.tileID,c),null,n.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),i.needsHillshadePrepare=!1}}function $i(e,i,n,r,o,s){const a=r.paint.get("raster-fade-duration");if(!s&&a>0){const r=t.browser.now(),s=(r-e.timeAdded)/a,l=i?(r-i.timeAdded)/a:-1,c=n.getSource(),h=o.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),u=!i||Math.abs(i.tileID.overscaledZ-h)>Math.abs(e.tileID.overscaledZ-h),p=u&&e.refreshedUponExpiration?1:t.clamp(u?s:1-l,0,1);return e.refreshedUponExpiration&&s>=1&&(e.refreshedUponExpiration=!1),i?{opacity:1,mix:1-p}:{opacity:p,mix:0}}return{opacity:1,mix:0}}const Gi=new t.Color(1,0,0,1),Hi=new t.Color(0,1,0,1),Wi=new t.Color(0,0,1,1),Xi=new t.Color(1,0,1,1),Ki=new t.Color(0,1,1,1);function Yi(t,e,i,n){Qi(t,0,e+i/2,t.transform.width,i,n)}function Ji(t,e,i,n){Qi(t,e-i/2,0,i,t.transform.height,n)}function Qi(t,e,i,n,r,o){const s=t.context,a=s.gl;a.enable(a.SCISSOR_TEST),a.scissor(e*t.pixelRatio,i*t.pixelRatio,n*t.pixelRatio,r*t.pixelRatio),s.clear({color:o}),a.disable(a.SCISSOR_TEST)}function tn(e,i,n){const r=e.context,o=r.gl,s=n.posMatrix,a=e.useProgram("debug"),l=Ci.disabled,c=Ii.disabled,h=e.colorModeForRenderPass(),u="$debug",p=e.style.map.terrain&&e.style.map.terrain.getTerrainData(n);r.activeTexture.set(o.TEXTURE0);const d=i.getTileByID(n.key).latestRawTileData,m=Math.floor((d&&d.byteLength||0)/1024),f=i.getTile(n).tileSize,g=512/Math.min(f,512)*(n.overscaledZ/e.transform.zoom)*.5;let _=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(_+=` => ${n.overscaledZ}`),function(t,e){t.initDebugOverlayCanvas();const i=t.debugOverlayCanvas,n=t.context.gl,r=t.debugOverlayCanvas.getContext("2d");r.clearRect(0,0,i.width,i.height),r.shadowColor="white",r.shadowBlur=2,r.lineWidth=1.5,r.strokeStyle="white",r.textBaseline="top",r.font="bold 36px Open Sans, sans-serif",r.fillText(e,5,5),r.strokeText(e,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}(e,`${_} ${m}kB`),a.draw(r,o.TRIANGLES,l,c,Pi.alphaBlended,Ai.disabled,xe(s,t.Color.transparent,g),null,u,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),a.draw(r,o.LINE_STRIP,l,c,h,Ai.disabled,xe(s,t.Color.red),p,u,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function en(t,e,i){const n=t.context,r=n.gl,o=t.colorModeForRenderPass(),s=new Ci(r.LEQUAL,Ci.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),h=e.getTerrainData(c.tileID);n.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,i.texture);const u={u_matrix:t.transform.calculatePosMatrix(c.tileID.toUnwrapped()),u_texture:0,u_ele_delta:e.getMeshFrameDelta(t.transform.zoom)};a.draw(n,r.TRIANGLES,s,Ii.disabled,o,Ai.backCCW,u,h,"terrain",l.vertexBuffer,l.indexBuffer,l.segments)}}class nn{constructor(e,i){this.context=new zi(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:t.create(),renderTime:0},this.setup(),this.numSublayers=K.maxUnderzooming+K.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Jt}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.PosArray;i.emplaceBack(0,0),i.emplaceBack(t.EXTENT,0),i.emplaceBack(0,t.EXTENT),i.emplaceBack(t.EXTENT,t.EXTENT),this.tileExtentBuffer=e.createVertexBuffer(i,re.members),this.tileExtentSegments=t.SegmentVector.simpleSegment(0,0,4,2);const n=new t.PosArray;n.emplaceBack(0,0),n.emplaceBack(t.EXTENT,0),n.emplaceBack(0,t.EXTENT),n.emplaceBack(t.EXTENT,t.EXTENT),this.debugBuffer=e.createVertexBuffer(n,re.members),this.debugSegments=t.SegmentVector.simpleSegment(0,0,4,5);const r=new t.RasterBoundsArray;r.emplaceBack(0,0,0,0),r.emplaceBack(t.EXTENT,0,t.EXTENT,0),r.emplaceBack(0,t.EXTENT,0,t.EXTENT),r.emplaceBack(t.EXTENT,t.EXTENT,t.EXTENT,t.EXTENT),this.rasterBoundsBuffer=e.createVertexBuffer(r,O.members),this.rasterBoundsSegments=t.SegmentVector.simpleSegment(0,0,4,2);const o=new t.PosArray;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(o,re.members),this.viewportSegments=t.SegmentVector.simpleSegment(0,0,4,2);const s=new t.LineStripIndexArray;s.emplaceBack(0),s.emplaceBack(1),s.emplaceBack(3),s.emplaceBack(2),s.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(s);const a=new t.TriangleIndexArray;a.emplaceBack(0,1,2),a.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(a);const l=this.context.gl;this.stencilClearMode=new Ii({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 n=t.create();t.ortho(n,0,this.width,this.height,0,0,1),t.scale(n,n,[i.drawingBufferWidth,i.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,i.TRIANGLES,Ci.disabled,this.stencilClearMode,Pi.disabled,Ai.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(Pi.disabled),i.setDepthMode(Ci.disabled);const r=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const t of e){const e=this._tileClippingMaskIDs[t.key]=this.nextStencilID++,o=this.style.map.terrain&&this.style.map.terrain.getTerrainData(t);r.draw(i,n.TRIANGLES,Ci.disabled,new Ii({func:n.ALWAYS,mask:0},e,255,n.KEEP,n.KEEP,n.REPLACE),Pi.disabled,Ai.disabled,be(t.posMatrix),o,"$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 Ii({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){const e=this.context.gl;return new Ii({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,r=i[0].overscaledZ-n+1;if(r>1){this.currentStencilSource=void 0,this.nextStencilID+r>256&&this.clearStencil();const t={};for(let i=0;i<r;i++)t[i+n]=new Ii({func:e.GEQUAL,mask:255},i+this.nextStencilID,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID+=r,[t,i]}return[{[n]:Ii.disabled},i]}colorModeForRenderPass(){const e=this.context.gl;if(this._showOverdrawInspector){const i=1/8;return new Pi([e.CONSTANT_COLOR,e.ONE],new t.Color(i,i,i,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?Pi.unblended:Pi.alphaBlended}depthModeForSublayer(t,e,i){if(!this.opaquePassEnabledForLayer())return Ci.disabled;const n=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new Ci(i||this.context.gl.LEQUAL,e,[n,n])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,i){this.style=e,this.options=i,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(t.browser.now()),this.imageManager.beginFrame();const n=this.style._order,r=this.style.sourceCaches,o={},s={},a={};for(const t in r){const e=r[t];e.used&&e.prepare(this.context),o[t]=e.getVisibleCoordinates(),s[t]=o[t].slice().reverse(),a[t]=e.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let t=0;t<n.length;t++)if(this.style._layers[n[t]].is3D()){this.opaquePassCutoff=t;break}if(this.renderToTexture){this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0;const e=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!t.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||e.length)&&(t.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(e,i){const n=e.context,r=n.gl,o=Pi.unblended,s=new Ci(r.LEQUAL,Ci.ReadWrite,[0,1]),a=i.getTerrainMesh(),l=i.sourceCache.getRenderableTiles(),c=e.useProgram("terrainDepth");n.bindFramebuffer.set(i.getFramebuffer("depth").framebuffer),n.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),n.clear({color:t.Color.transparent,depth:1});for(const t of l){const l=i.getTerrainData(t.tileID),h={u_matrix:e.transform.calculatePosMatrix(t.tileID.toUnwrapped()),u_ele_delta:i.getMeshFrameDelta(e.transform.zoom)};c.draw(n,r.TRIANGLES,s,Ii.disabled,o,Ai.backCCW,h,l,"terrain",a.vertexBuffer,a.indexBuffer,a.segments)}n.bindFramebuffer.set(null),n.viewport.set([0,0,e.width,e.height])}(this,this.style.map.terrain),function(e,i){const n=e.context,r=n.gl,o=Pi.unblended,s=new Ci(r.LEQUAL,Ci.ReadWrite,[0,1]),a=i.getTerrainMesh(),l=i.getCoordsTexture(),c=i.sourceCache.getRenderableTiles(),h=e.useProgram("terrainCoords");n.bindFramebuffer.set(i.getFramebuffer("coords").framebuffer),n.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),n.clear({color:t.Color.transparent,depth:1}),i.coordsIndex=[];for(const t of c){const c=i.getTerrainData(t.tileID);n.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,l.texture);const u={u_matrix:e.transform.calculatePosMatrix(t.tileID.toUnwrapped()),u_terrain_coords_id:(255-i.coordsIndex.length)/255,u_texture:0,u_ele_delta:i.getMeshFrameDelta(e.transform.zoom)};h.draw(n,r.TRIANGLES,s,Ii.disabled,o,Ai.backCCW,u,c,"terrain",a.vertexBuffer,a.indexBuffer,a.segments),i.coordsIndex.push(t.tileID.key)}n.bindFramebuffer.set(null),n.viewport.set([0,0,e.width,e.height])}(this,this.style.map.terrain))}this.renderPass="offscreen";for(const t of n){const e=this.style._layers[t];if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;const i=s[e.source];("custom"===e.type||i.length)&&this.renderLayer(this,r[e.source],e,i)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?t.Color.black:t.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._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=r[t.source],i=o[t.source];this._renderTileClippingMasks(t,i),this.renderLayer(this,e,t,i)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<n.length;this.currentLayer++){const t=this.style._layers[n[this.currentLayer]],e=r[t.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(t))continue;const i=("symbol"===t.type?a:s)[t.source];this._renderTileClippingMasks(t,o[t.source]),this.renderLayer(this,e,t,i)}if(this.options.showTileBoundaries){const t=function(t,e){let i=null;const n=Object.values(t._layers).flatMap((i=>i.source&&!i.isHidden(e)?[t.sourceCaches[i.source]]:[])),r=n.filter((t=>"vector"===t.getSource().type)),o=n.filter((t=>"vector"!==t.getSource().type)),s=t=>{(!i||i.getSource().maxzoom<t.getSource().maxzoom)&&(i=t)};return r.forEach((t=>s(t))),i||o.forEach((t=>s(t))),i}(this.style,this.transform.zoom);t&&function(t,e,i){for(let n=0;n<i.length;n++)tn(t,e,i[n])}(this,t,t.getVisibleCoordinates())}this.options.showPadding&&function(t){const e=t.transform.padding;Yi(t,t.transform.height-(e.top||0),3,Gi),Yi(t,e.bottom||0,3,Hi),Ji(t,e.left||0,3,Wi),Ji(t,t.transform.width-(e.right||0),3,Xi);const i=t.transform.centerPoint;!function(t,e,i,n){Qi(t,e-1,i-10,2,20,n),Qi(t,e-10,i-1,20,2,n)}(t,i.x,t.transform.height-i.y,Ki)}(this),this.context.setDefault()}renderLayer(e,i,n,r){if(!n.isHidden(this.transform.zoom)&&("background"===n.type||"custom"===n.type||(r||[]).length))switch(this.id=n.id,n.type){case"symbol":!function(e,i,n,r,o){if("translucent"!==e.renderPass)return;const s=Ii.disabled,a=e.colorModeForRenderPass();(n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(e,i,n,r,o,s,a){const l=i.transform,c="map"===o,h="map"===s;for(const o of e){const e=r.getTile(o),s=e.getBucket(n);if(!s||!s.text||!s.text.segments.get().length)continue;const u=t.evaluateSizeForZoom(s.textSizeData,l.zoom),p=Pt(e,1,i.transform.zoom),d=at(o.posMatrix,h,c,i.transform,p),m="none"!==n.layout.get("icon-text-fit")&&s.hasIconData();if(u){const t=Math.pow(2,l.zoom-e.tileID.overscaledZ);Ri(s,c,h,a,l,d,o.posMatrix,t,u,m,i.style.map.terrain?(t,e)=>i.style.map.terrain.getElevation(o,t,e):null)}}}(r,e,n,i,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),o),0!==n.paint.get("icon-opacity").constantOr(1)&&Oi(e,i,n,r,!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"),s,a),0!==n.paint.get("text-opacity").constantOr(1)&&Oi(e,i,n,r,!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"),s,a),i.map.showCollisionBoxes&&(Li(e,i,n,r,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),Li(e,i,n,r,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))}(e,i,n,r,this.style.placement.variableOffsets);break;case"circle":!function(e,i,n,r){if("translucent"!==e.renderPass)return;const o=n.paint.get("circle-opacity"),s=n.paint.get("circle-stroke-width"),a=n.paint.get("circle-stroke-opacity"),l=!n.layout.get("circle-sort-key").isConstant();if(0===o.constantOr(1)&&(0===s.constantOr(1)||0===a.constantOr(1)))return;const c=e.context,h=c.gl,u=e.depthModeForSublayer(0,Ci.ReadOnly),p=Ii.disabled,d=e.colorModeForRenderPass(),m=[];for(let o=0;o<r.length;o++){const s=r[o],a=i.getTile(s),c=a.getBucket(n);if(!c)continue;const h=c.programConfigurations.get(n.id),u=e.useProgram("circle",h),p=c.layoutVertexBuffer,d=c.indexBuffer,f=e.style.map.terrain&&e.style.map.terrain.getTerrainData(s),g={programConfiguration:h,program:u,layoutVertexBuffer:p,indexBuffer:d,uniformValues:ye(e,s,a,n),terrainData:f};if(l){const e=c.segments.get();for(const i of e)m.push({segments:new t.SegmentVector([i]),sortKey:i.sortKey,state:g})}else m.push({segments:c.segments,sortKey:0,state:g})}l&&m.sort(((t,e)=>t.sortKey-e.sortKey));for(const t of m){const{programConfiguration:i,program:r,layoutVertexBuffer:o,indexBuffer:s,uniformValues:a,terrainData:l}=t.state;r.draw(c,h.TRIANGLES,u,p,d,Ai.disabled,a,l,n.id,o,s,t.segments,n.paint,e.transform.zoom,i)}}(e,i,n,r);break;case"heatmap":!function(e,i,n,r){if(0!==n.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){const o=e.context,s=o.gl,a=Ii.disabled,l=new Pi([s.ONE,s.ONE],t.Color.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 r=i.heatmapFbo;if(r)n.bindTexture(n.TEXTURE_2D,r.colorAttachment.get()),t.bindFramebuffer.set(r.framebuffer);else{const o=n.createTexture();n.bindTexture(n.TEXTURE_2D,o),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),r=i.heatmapFbo=t.createFramebuffer(e.width/4,e.height/4,!1,!1),function(t,e,i,n){var r,o;const s=t.gl,a=null!==(r=t.HALF_FLOAT)&&void 0!==r?r:s.UNSIGNED_BYTE,l=null!==(o=t.RGBA16F)&&void 0!==o?o:s.RGBA;s.texImage2D(s.TEXTURE_2D,0,l,e.width/4,e.height/4,0,s.RGBA,a,null),n.colorAttachment.set(i)}(t,e,o,r)}}(o,e,n),o.clear({color:t.Color.transparent});for(let t=0;t<r.length;t++){const c=r[t];if(i.hasRenderableParent(c))continue;const h=i.getTile(c),u=h.getBucket(n);if(!u)continue;const p=u.programConfigurations.get(n.id),d=e.useProgram("heatmap",p),{zoom:m}=e.transform;d.draw(o,s.TRIANGLES,Ci.disabled,a,l,Ai.disabled,we(c.posMatrix,h,m,n.paint.get("heatmap-intensity")),null,n.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,n.paint,e.transform.zoom,p)}o.viewport.set([0,0,e.width,e.height])}else"translucent"===e.renderPass&&(e.context.setColorMode(e.colorModeForRenderPass()),function(e,i){const n=e.context,r=n.gl,o=i.heatmapFbo;if(!o)return;n.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,o.colorAttachment.get()),n.activeTexture.set(r.TEXTURE1);let s=i.colorRampTexture;s||(s=i.colorRampTexture=new y(n,i.colorRamp,r.RGBA)),s.bind(r.LINEAR,r.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(n,r.TRIANGLES,Ci.disabled,Ii.disabled,e.colorModeForRenderPass(),Ai.disabled,((e,i,n,r)=>{const o=t.create();t.ortho(o,0,e.width,e.height,0,0,1);const s=e.context.gl;return{u_matrix:o,u_world:[s.drawingBufferWidth,s.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,n))}(e,i,n,r);break;case"line":!function(e,i,n,r){if("translucent"!==e.renderPass)return;const o=n.paint.get("line-opacity"),s=n.paint.get("line-width");if(0===o.constantOr(1)||0===s.constantOr(1))return;const a=e.depthModeForSublayer(0,Ci.ReadOnly),l=e.colorModeForRenderPass(),c=n.paint.get("line-dasharray"),h=n.paint.get("line-pattern"),u=h.constantOr(1),p=n.paint.get("line-gradient"),d=n.getCrossfadeParameters(),m=u?"linePattern":c?"lineSDF":p?"lineGradient":"line",f=e.context,g=f.gl;let _=!0;for(const o of r){const r=i.getTile(o);if(u&&!r.patternsLoaded())continue;const s=r.getBucket(n);if(!s)continue;const v=s.programConfigurations.get(n.id),x=e.context.program.get(),b=e.useProgram(m,v),w=_||b.program!==x,T=e.style.map.terrain&&e.style.map.terrain.getTerrainData(o),E=h.constantOr(null);if(E&&r.imageAtlas){const t=r.imageAtlas,e=t.patternPositions[E.to.toString()],i=t.patternPositions[E.from.toString()];e&&i&&v.setConstantPatternPositions(e,i)}const S=T?o:null,P=u?Pe(e,r,n,d,S):c?ze(e,r,n,c,d,S):p?Se(e,r,n,s.lineClipsArray.length,S):Ee(e,r,n,S);if(u)f.activeTexture.set(g.TEXTURE0),r.imageAtlasTexture.bind(g.LINEAR,g.CLAMP_TO_EDGE),v.updatePaintBuffers(d);else if(c&&(w||e.lineAtlas.dirty))f.activeTexture.set(g.TEXTURE0),e.lineAtlas.bind(f);else if(p){const r=s.gradients[n.id];let a=r.texture;if(n.gradientVersion!==r.version){let l=256;if(n.stepInterpolant){const n=i.getSource().maxzoom,r=o.canonical.z===n?Math.ceil(1<<e.transform.maxZoom-o.canonical.z):1;l=t.clamp(t.nextPowerOfTwo(s.maxLineLength/t.EXTENT*1024*r),256,f.maxTextureSize)}r.gradient=t.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:l,image:r.gradient||void 0,clips:s.lineClipsArray}),r.texture?r.texture.update(r.gradient):r.texture=new y(f,r.gradient,g.RGBA),r.version=n.gradientVersion,a=r.texture}f.activeTexture.set(g.TEXTURE0),a.bind(n.stepInterpolant?g.NEAREST:g.LINEAR,g.CLAMP_TO_EDGE)}b.draw(f,g.TRIANGLES,a,e.stencilModeForClipping(o),l,Ai.disabled,P,T,n.id,s.layoutVertexBuffer,s.indexBuffer,s.segments,n.paint,e.transform.zoom,v,s.layoutVertexBuffer2),_=!1}}(e,i,n,r);break;case"fill":!function(e,i,n,r){const o=n.paint.get("fill-color"),s=n.paint.get("fill-opacity");if(0===s.constantOr(1))return;const a=e.colorModeForRenderPass(),l=n.paint.get("fill-pattern"),c=e.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===o.constantOr(t.Color.transparent).a&&1===s.constantOr(0)?"opaque":"translucent";if(e.renderPass===c){const t=e.depthModeForSublayer(1,"opaque"===e.renderPass?Ci.ReadWrite:Ci.ReadOnly);Ni(e,i,n,r,t,a,!1)}if("translucent"===e.renderPass&&n.paint.get("fill-antialias")){const t=e.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,Ci.ReadOnly);Ni(e,i,n,r,t,a,!0)}}(e,i,n,r);break;case"fill-extrusion":!function(t,e,i,n){const r=i.paint.get("fill-extrusion-opacity");if(0!==r&&"translucent"===t.renderPass){const o=new Ci(t.context.gl.LEQUAL,Ci.ReadWrite,t.depthRangeFor3D);if(1!==r||i.paint.get("fill-extrusion-pattern").constantOr(1))Zi(t,e,i,n,o,Ii.disabled,Pi.disabled),Zi(t,e,i,n,o,t.stencilModeFor3D(),t.colorModeForRenderPass());else{const r=t.colorModeForRenderPass();Zi(t,e,i,n,o,Ii.disabled,r)}}}(e,i,n,r);break;case"hillshade":!function(t,e,i,n){if("offscreen"!==t.renderPass&&"translucent"!==t.renderPass)return;const r=t.context,o=t.depthModeForSublayer(0,Ci.ReadOnly),s=t.colorModeForRenderPass(),[a,l]="translucent"===t.renderPass?t.stencilConfigForOverlap(n):[{},n];for(const n of l){const r=e.getTile(n);void 0!==r.needsHillshadePrepare&&r.needsHillshadePrepare&&"offscreen"===t.renderPass?qi(t,r,i,o,Ii.disabled,s):"translucent"===t.renderPass&&ji(t,n,r,i,o,a[n.overscaledZ],s)}r.viewport.set([0,0,t.width,t.height])}(e,i,n,r);break;case"raster":!function(t,e,i,n){if("translucent"!==t.renderPass)return;if(0===i.paint.get("raster-opacity"))return;if(!n.length)return;const r=t.context,o=r.gl,s=e.getSource(),a=t.useProgram("raster"),l=t.colorModeForRenderPass(),[c,h]=s instanceof U?[{},n]:t.stencilConfigForOverlap(n),u=h[h.length-1].overscaledZ,p=!t.options.moving;for(const n of h){const h=t.depthModeForSublayer(n.overscaledZ-u,1===i.paint.get("raster-opacity")?Ci.ReadWrite:Ci.ReadOnly,o.LESS),d=e.getTile(n);d.registerFadeDuration(i.paint.get("raster-fade-duration"));const m=e.findLoadedParent(n,0),f=$i(d,m,e,i,t.transform,t.style.map.terrain);let g,_;const y="nearest"===i.paint.get("raster-resampling")?o.NEAREST:o.LINEAR;r.activeTexture.set(o.TEXTURE0),d.texture.bind(y,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),r.activeTexture.set(o.TEXTURE1),m?(m.texture.bind(y,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),g=Math.pow(2,m.tileID.overscaledZ-d.tileID.overscaledZ),_=[d.tileID.canonical.x*g%1,d.tileID.canonical.y*g%1]):d.texture.bind(y,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST);const v=t.style.map.terrain&&t.style.map.terrain.getTerrainData(n),x=v?n:null,b=x?x.posMatrix:t.transform.calculatePosMatrix(n.toUnwrapped(),p),w=Ie(b,_||[0,0],g||1,f,i);s instanceof U?a.draw(r,o.TRIANGLES,h,Ii.disabled,l,Ai.disabled,w,v,i.id,s.boundsBuffer,t.quadTriangleIndexBuffer,s.boundsSegments):a.draw(r,o.TRIANGLES,h,c[n.overscaledZ],l,Ai.disabled,w,v,i.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}}(e,i,n,r);break;case"background":!function(t,e,i,n){const r=i.paint.get("background-color"),o=i.paint.get("background-opacity");if(0===o)return;const s=t.context,a=s.gl,l=t.transform,c=l.tileSize,h=i.paint.get("background-pattern");if(t.isPatternMissing(h))return;const u=!h&&1===r.a&&1===o&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==u)return;const p=Ii.disabled,d=t.depthModeForSublayer(0,"opaque"===u?Ci.ReadWrite:Ci.ReadOnly),m=t.colorModeForRenderPass(),f=t.useProgram(h?"backgroundPattern":"background"),g=n||l.coveringTiles({tileSize:c,terrain:t.style.map.terrain});h&&(s.activeTexture.set(a.TEXTURE0),t.imageManager.bind(t.context));const _=i.getCrossfadeParameters();for(const e of g){const l=n?e.posMatrix:t.transform.calculatePosMatrix(e.toUnwrapped()),u=h?Re(l,o,t,h,{tileID:e,tileSize:c},_):Be(l,o,r),g=t.style.map.terrain&&t.style.map.terrain.getTerrainData(e);f.draw(s,a.TRIANGLES,d,p,m,Ai.disabled,u,g,i.id,t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments)}}(e,0,n,r);break;case"custom":!function(t,e,i){const n=t.context,r=i.implementation;if("offscreen"===t.renderPass){const e=r.prerender;e&&(t.setCustomLayerDefaults(),n.setColorMode(t.colorModeForRenderPass()),e.call(r,n.gl,t.transform.customLayerMatrix()),n.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),n.setColorMode(t.colorModeForRenderPass()),n.setStencilMode(Ii.disabled);const e="3d"===r.renderingMode?new Ci(t.context.gl.LEQUAL,Ci.ReadWrite,t.depthRangeFor3D):t.depthModeForSublayer(0,Ci.ReadOnly);n.setDepthMode(e),r.render(n.gl,t.transform.customLayerMatrix()),n.setDirty(),t.setBaseState(),n.bindFramebuffer.set(null)}}(e,0,n)}}translatePosMatrix(e,i,n,r,o){if(!n[0]&&!n[1])return e;const s=o?"map"===r?this.transform.angle:0:"viewport"===r?-this.transform.angle:0;if(s){const t=Math.sin(s),e=Math.cos(s);n=[n[0]*e-n[1]*t,n[0]*t+n[1]*e]}const a=[o?n[0]:Pt(i,n[0],this.transform.zoom),o?n[1]:Pt(i,n[1],this.transform.zoom),0],l=new Float32Array(16);return t.translate(l,e,a),l}saveTileTexture(t){const e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const e=this._tileTextures[t];return e&&e.length>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 he(this.context,se[t],e,Fe[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 y(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 rn{constructor(t,e){this.points=t,this.planes=e}static fromInvProjectionMatrix(e,i,n){const r=Math.pow(2,n),o=[[-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 o=1/(n=t.transformMat4([],n,e))[3]/i*r;return t.mul$1(n,n,[o,o,1/n[3],o])})),s=[[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],r=e[2],o=i*i+n*n+r*r;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}([],function(t,e,i){var n=e[0],r=e[1],o=e[2],s=i[0],a=i[1],l=i[2];return t[0]=r*l-o*a,t[1]=o*s-n*l,t[2]=n*a-r*s,t}([],m([],o[t[0]],o[t[1]]),m([],o[t[2]],o[t[1]]))),i=-((n=e)[0]*(r=o[t[1]])[0]+n[1]*r[1]+n[2]*r[2]);var n,r;return e.concat(i)}));return new rn(o,s)}}class on{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=p(this.min),n=p(this.max);for(let t=0;t<e.length;t++)i[t]=e[t]?this.min[t]:this.center[t],n[t]=e[t]?this.center[t]:this.max[t];return n[2]=this.max[2],new on(i,n)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(e){const i=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let n=!0;for(let r=0;r<e.planes.length;r++){const o=e.planes[r];let s=0;for(let e=0;e<i.length;e++)t.dot(o,i[e])>=0&&s++;if(0===s)return 0;s!==i.length&&(n=!1)}if(n)return 2;for(let t=0;t<3;t++){let i=Number.MAX_VALUE,n=-Number.MAX_VALUE;for(let r=0;r<e.points.length;r++){const o=e.points[r][t]-this.min[t];i=Math.min(i,o),n=Math.max(n,o)}if(n<0||i>this.max[t]-this.min[t])return 0}return 1}}class sn{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(e,i,n){return null!=i.top&&null!=e.top&&(this.top=t.interpolate.number(e.top,i.top,n)),null!=i.bottom&&null!=e.bottom&&(this.bottom=t.interpolate.number(e.bottom,i.bottom,n)),null!=i.left&&null!=e.left&&(this.left=t.interpolate.number(e.left,i.left,n)),null!=i.right&&null!=e.right&&(this.right=t.interpolate.number(e.right,i.right,n)),this}getCenter(e,i){const n=t.clamp((this.left+e-this.right)/2,0,e),r=t.clamp((this.top+i-this.bottom)/2,0,i);return new t.Point(n,r)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new sn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class an{constructor(e,i,n,r,o){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=void 0===o||!!o,this._minZoom=e||0,this._maxZoom=i||22,this._minPitch=null==n?0:n,this._maxPitch=null==r?60:r,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new sn,this._posMatrixCache={},this._alignedPosMatrixCache={},this._minEleveationForCurrentTile=0}clone(){const t=new an(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.Point(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){const i=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=function(){var e=new t.ARRAY_TYPE(4);return t.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}(),function(t,e,i){var n=e[0],r=e[1],o=e[2],s=e[3],a=Math.sin(i),l=Math.cos(i);t[0]=n*l+o*a,t[1]=r*l+s*a,t[2]=n*-a+o*l,t[3]=r*-a+s*l}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){const i=t.clamp(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.UnwrappedTileID(0,e)];if(this._renderWorldCopies){const n=this.pointCoordinate(new t.Point(0,0)),r=this.pointCoordinate(new t.Point(this.width,0)),o=this.pointCoordinate(new t.Point(this.width,this.height)),s=this.pointCoordinate(new t.Point(0,this.height)),a=Math.floor(Math.min(n.x,r.x,o.x,s.x)),l=Math.floor(Math.max(n.x,r.x,o.x,s.x)),c=1;for(let n=a-c;n<=l+c;n++)0!==n&&i.push(new t.UnwrappedTileID(n,e))}return i}coveringTiles(e){var i,n;let r=this.coveringZoomLevel(e);const o=r;if(void 0!==e.minzoom&&r<e.minzoom)return[];void 0!==e.maxzoom&&r>e.maxzoom&&(r=e.maxzoom);const s=this.pointCoordinate(this.getCameraPoint()),a=t.MercatorCoordinate.fromLngLat(this.center),l=Math.pow(2,r),c=[l*s.x,l*s.y,0],h=[l*a.x,l*a.y,0],u=rn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r);let p=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(p=r);const d=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,m=t=>({aabb:new on([t*l,0,0],[(t+1)*l,l,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),g=[],_=[],y=r,v=e.reparseOverscaled?o:r;if(this._renderWorldCopies)for(let t=1;t<=3;t++)g.push(m(-t)),g.push(m(t));for(g.push(m(0));g.length>0;){const r=g.pop(),o=r.x,s=r.y;let a=r.fullyVisible;if(!a){const t=r.aabb.intersects(u);if(0===t)continue;a=2===t}const l=e.terrain?c:h,m=r.aabb.distanceX(l),x=r.aabb.distanceY(l),b=Math.max(Math.abs(m),Math.abs(x));if(r.zoom===y||b>d+(1<<y-r.zoom)-2&&r.zoom>=p){const e=y-r.zoom,i=c[0]-.5-(o<<e),n=c[1]-.5-(s<<e);_.push({tileID:new t.OverscaledTileID(r.zoom===y?v:r.zoom,r.wrap,r.zoom,o,s),distanceSq:f([h[0]-.5-o,h[1]-.5-s]),tileDistanceToCamera:Math.sqrt(i*i+n*n)})}else for(let l=0;l<4;l++){const c=(o<<1)+l%2,h=(s<<1)+(l>>1),u=r.zoom+1;let p=r.aabb.quadrant(l);if(e.terrain){const o=new t.OverscaledTileID(u,r.wrap,u,c,h),s=e.terrain.getMinMaxElevation(o),a=null!==(i=s.minElevation)&&void 0!==i?i:this.elevation,l=null!==(n=s.maxElevation)&&void 0!==n?n:this.elevation;p=new on([p.min[0],p.min[1],a],[p.max[0],p.max[1],l])}g.push({aabb:p,zoom:u,x:c,y:h,wrap:r.wrap,fullyVisible:a})}}return _.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.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.Point(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(i)*this.worldSize)}unproject(e){return new t.MercatorCoordinate(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),n=e.getElevationForLngLatZoom(i,this.tileZoom);if(!(this.elevation-n))return;const r=this.getCameraPosition(),o=t.MercatorCoordinate.fromLngLat(r.lngLat,r.altitude),s=t.MercatorCoordinate.fromLngLat(i,n),a=o.x-s.x,l=o.y-s.y,c=o.z-s.z,h=Math.sqrt(a*a+l*l+c*c),u=this.scaleZoom(this.cameraToCenterDistance/h/this.tileSize);this._elevation=n,this._center=i,this.zoom=u}setLocationAtPoint(e,i){const n=this.pointCoordinate(i),r=this.pointCoordinate(this.centerPoint),o=this.locationCoordinate(e),s=new t.MercatorCoordinate(o.x-(n.x-r.x),o.y-(n.y-r.y));this.center=this.coordinateLocation(s),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.MercatorCoordinate.fromLngLat(e)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(e,i){if(i){const t=i.pointCoordinate(e);if(null!=t)return t}const n=[e.x,e.y,0,1],r=[e.x,e.y,1,1];t.transformMat4(n,n,this.pixelMatrixInverse),t.transformMat4(r,r,this.pixelMatrixInverse);const o=n[3],s=r[3],a=n[1]/o,l=r[1]/s,c=n[2]/o,h=r[2]/s,u=c===h?0:(0-c)/(h-c);return new t.MercatorCoordinate(t.interpolate.number(n[0]/o,r[0]/s,u)/this.worldSize,t.interpolate.number(a,l,u)/this.worldSize)}coordinatePoint(e,i=0,n=this.pixelMatrix){const r=[e.x*this.worldSize,e.y*this.worldSize,i,1];return t.transformMat4(r,r,n),new t.Point(r[0]/r[3],r[1]/r[3])}getBounds(){const e=Math.max(0,this.height/2-this.getHorizon());return(new k).extend(this.pointLocation(new t.Point(0,e))).extend(this.pointLocation(new t.Point(this.width,e))).extend(this.pointLocation(new t.Point(this.width,this.height))).extend(this.pointLocation(new t.Point(0,this.height)))}getMaxBounds(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new k([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 n=e.key,r=i?this._alignedPosMatrixCache:this._posMatrixCache;if(r[n])return r[n];const o=e.canonical,s=this.worldSize/this.zoomScale(o.z),a=o.x+Math.pow(2,o.z)*e.wrap,l=t.identity(new Float64Array(16));return t.translate(l,l,[a*s,o.y*s,0]),t.scale(l,l,[s/t.EXTENT,s/t.EXTENT,1]),t.multiply(l,i?this.alignedProjMatrix:this.projMatrix,l),r[n]=new Float32Array(l),r[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let e,i,n,r,o=-90,s=90,a=-180,l=180;const c=this.size,h=this._unmodified;if(this.latRange){const i=this.latRange;o=t.mercatorYfromLat(i[1])*this.worldSize,s=t.mercatorYfromLat(i[0])*this.worldSize,e=s-o<c.y?c.y/(s-o):0}if(this.lngRange){const e=this.lngRange;a=t.wrap(t.mercatorXfromLng(e[0])*this.worldSize,0,this.worldSize),l=t.wrap(t.mercatorXfromLng(e[1])*this.worldSize,0,this.worldSize),l<a&&(l+=this.worldSize),i=l-a<c.x?c.x/(l-a):0}const u=this.point,p=Math.max(i||0,e||0);if(p)return this.center=this.unproject(new t.Point(i?(l+a)/2:u.x,e?(s+o)/2:u.y)),this.zoom+=this.scaleZoom(p),this._unmodified=h,void(this._constraining=!1);if(this.latRange){const t=u.y,e=c.y/2;t-e<o&&(r=o+e),t+e>s&&(r=s-e)}if(this.lngRange){const e=(a+l)/2,i=t.wrap(u.x,e-this.worldSize/2,e+this.worldSize/2),r=c.x/2;i-r<a&&(n=a+r),i+r>l&&(n=l-r)}void 0===n&&void 0===r||(this.center=this.unproject(new t.Point(void 0!==n?n:u.x,void 0!==r?r:u.y)).wrap()),this._unmodified=h,this._constraining=!1}_calcMatrices(){if(!this.height)return;const e=this.centerOffset,i=this.point.x,n=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let r=t.identity(new Float64Array(16));t.scale(r,r,[this.width/2,-this.height/2,1]),t.translate(r,r,[1,-1,0]),this.labelPlaneMatrix=r,r=t.identity(new Float64Array(16)),t.scale(r,r,[1,-1,1]),t.translate(r,r,[-1,-1,0]),t.scale(r,r,[2/this.width,2/this.height,1]),this.glCoordMatrix=r;const o=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),s=Math.min(this.elevation,this._minEleveationForCurrentTile),a=o-s*this._pixelPerMeter/Math.cos(this._pitch),l=s<0?a:o,c=Math.PI/2+this._pitch,h=this._fov*(.5+e.y/this.height),u=Math.sin(h)*l/Math.sin(t.clamp(Math.PI-c-h,.01,Math.PI-.01)),p=this.getHorizon(),d=2*Math.atan(p/this.cameraToCenterDistance)*(.5+e.y/(2*p)),m=Math.sin(d)*l/Math.sin(t.clamp(Math.PI-c-d,.01,Math.PI-.01)),f=Math.min(u,m),g=1.01*(Math.cos(Math.PI/2-this._pitch)*f+l),_=this.height/50;r=new Float64Array(16),t.perspective(r,this._fov,this.width/this.height,_,g),r[8]=2*-e.x/this.width,r[9]=2*e.y/this.height,t.scale(r,r,[1,-1,1]),t.translate(r,r,[0,0,-this.cameraToCenterDistance]),t.rotateX(r,r,this._pitch),t.rotateZ(r,r,this.angle),t.translate(r,r,[-i,-n,0]),this.mercatorMatrix=t.scale([],r,[this.worldSize,this.worldSize,this.worldSize]),t.scale(r,r,[1,1,this._pixelPerMeter]),this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,r),t.translate(r,r,[0,0,-this.elevation]),this.projMatrix=r,this.invProjMatrix=t.invert([],r),this.pixelMatrix3D=t.multiply(new Float64Array(16),this.labelPlaneMatrix,r);const y=this.width%2/2,v=this.height%2/2,x=Math.cos(this.angle),b=Math.sin(this.angle),w=i-Math.round(i)+x*y+b*v,T=n-Math.round(n)+x*v+b*y,E=new Float64Array(r);if(t.translate(E,E,[w>.5?w-1:w,T>.5?T-1:T,0]),this.alignedProjMatrix=E,r=t.invert(new Float64Array(16),this.pixelMatrix),!r)throw new Error("failed to invert matrix");this.pixelMatrixInverse=r,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const e=this.pointCoordinate(new t.Point(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(i,i,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.Point(0,e))}getCameraQueryGeometry(e){const i=this.getCameraPoint();if(1===e.length)return[e[0],i];{let n=i.x,r=i.y,o=i.x,s=i.y;for(const t of e)n=Math.min(n,t.x),r=Math.min(r,t.y),o=Math.max(o,t.x),s=Math.max(s,t.y);return[new t.Point(n,r),new t.Point(o,r),new t.Point(o,s),new t.Point(n,s),new t.Point(n,r)]}}}function ln(t,e){let i,n=!1,r=null,o=null;const s=()=>{r=null,n&&(t.apply(o,i),r=setTimeout(s,e),n=!1)};return(...t)=>(n=!0,o=this,i=t,r||s(),r)}class cn{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=ln(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),r=Math.pow(10,n),o=Math.round(e.lng*r)/r,s=Math.round(e.lat*r)/r,a=this._map.getBearing(),l=this._map.getPitch();let c="";if(c+=t?`/${o}/${s}/${i}`:`${i}/${s}/${o}`,(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 hn={linearity:.3,easing:t.bezier(0,0,.3,1)},un=t.extend({deceleration:2500,maxSpeed:1400},hn),pn=t.extend({deceleration:20,maxSpeed:1400},hn),dn=t.extend({deceleration:1e3,maxSpeed:360},hn),mn=t.extend({deceleration:1e3,maxSpeed:90},hn);class fn{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:t.browser.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=t.browser.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.Point(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,r={};if(i.pan.mag()){const o=_n(i.pan.mag(),n,t.extend({},un,e||{}));r.offset=i.pan.mult(o.amount/i.pan.mag()),r.center=this._map.transform.center,gn(r,o)}if(i.zoom){const t=_n(i.zoom,n,pn);r.zoom=this._map.transform.zoom+t.amount,gn(r,t)}if(i.bearing){const e=_n(i.bearing,n,dn);r.bearing=this._map.transform.bearing+t.clamp(e.amount,-179,179),gn(r,e)}if(i.pitch){const t=_n(i.pitch,n,mn);r.pitch=this._map.transform.pitch+t.amount,gn(r,t)}if(r.zoom||r.bearing){const t=void 0===i.pinchAround?i.around:i.pinchAround;r.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),t.extend(r,{noMoveStart:!0})}}function gn(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function _n(e,i,n){const{maxSpeed:r,linearity:o,deceleration:s}=n,a=t.clamp(e*o/(i/1e3),-r,r),l=Math.abs(a)/(s*o);return{easing:n.easing,duration:1e3*l,amount:a*(l/2)}}class yn extends t.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,n,r,o={}){const s=e.mousePos(n.getCanvasContainer(),r),a=n.unproject(s);super(i,t.extend({point:s,lngLat:a,originalEvent:r},o)),this._defaultPrevented=!1,this.target=n}}class vn extends t.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,n,r){const o="touchend"===i?r.changedTouches:r.touches,s=e.touchPos(n.getCanvasContainer(),o),a=s.map((t=>n.unproject(t))),l=s.reduce(((t,e,i,n)=>t.add(e.div(n.length))),new t.Point(0,0));super(i,{points:s,point:l,lngLats:a,lngLat:n.unproject(l),originalEvent:r}),this._defaultPrevented=!1}}class xn extends t.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,i){super(t,{originalEvent:i}),this._defaultPrevented=!1}}class bn{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new xn(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new yn(t.type,this._map,t))}mouseup(t){this._map.fire(new yn(t.type,this._map,t))}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new yn(t.type,this._map,t))}dblclick(t){return this._firePreventable(new yn(t.type,this._map,t))}mouseover(t){this._map.fire(new yn(t.type,this._map,t))}mouseout(t){this._map.fire(new yn(t.type,this._map,t))}touchstart(t){return this._firePreventable(new vn(t.type,this._map,t))}touchmove(t){this._map.fire(new vn(t.type,this._map,t))}touchend(t){this._map.fire(new vn(t.type,this._map,t))}touchcancel(t){this._map.fire(new vn(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class wn{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new yn(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new yn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new yn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Tn{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.Point.convert(e),this._map.terrain)}}class En{constructor(t,e){this._map=t,this._tr=new Tn(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,i){this.isEnabled()&&t.shiftKey&&0===t.button&&(e.disableDrag(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(t,i){if(!this._active)return;const n=i;if(this._lastPos.equals(n)||!this._box&&n.dist(this._startPos)<this._clickTolerance)return;const r=this._startPos;this._lastPos=n,this._box||(this._box=e.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const o=Math.min(r.x,n.x),s=Math.max(r.x,n.x),a=Math.min(r.y,n.y),l=Math.max(r.y,n.y);e.setTransform(this._box,`translate(${o}px,${a}px)`),this._box.style.width=s-o+"px",this._box.style.height=l-a+"px"}mouseupWindow(i,n){if(!this._active)return;if(0!==i.button)return;const r=this._startPos,o=n;if(this.reset(),e.suppressClick(),r.x!==o.x||r.y!==o.y)return this._map.fire(new t.Event("boxzoomend",{originalEvent:i})),{cameraAnimation:t=>t.fitScreenCoordinates(r,o,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",i)}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&&(e.remove(this._box),this._box=null),e.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new t.Event(e,{originalEvent:i}))}}function Sn(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;n<t.length;n++)i[t[n].identifier]=e[n];return i}class Pn{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,i,n){(this.centroid||n.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),n.length===this.numTouches&&(this.centroid=function(e){const i=new t.Point(0,0);for(const t of e)i._add(t);return i.div(e.length)}(i),this.touches=Sn(n,i)))}touchmove(t,e,i){if(this.aborted||!this.centroid)return;const n=Sn(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 zn{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 Cn{constructor(t){this._tr=new Tn(t),this._zoomIn=new zn({numTouches:1,numTaps:2}),this._zoomOut=new zn({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),r=this._zoomOut.touchend(t,e,i),o=this._tr;return n?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:o.zoom+1,around:o.unproject(n)},{originalEvent:t})}):r?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:o.zoom-1,around:o.unproject(r)},{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 Mn{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)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=n,this._move(i,n))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&e.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const In={0:1,2:2};class An{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const i=e.mouseButton(t);this._eventButton=i}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(t,e){const i=In[e];return void 0===t.buttons||(t.buttons&i)!==i}(t,this._eventButton)}isValidEndEvent(t){return e.mouseButton(t)===this._eventButton}}class kn{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return 1===t.targetTouches.length}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}const Ln=t=>{t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=function(t){t.preventDefault()}},Dn=({enable:t,clickTolerance:i,bearingDegreesPerPixelMoved:n=.8})=>{const r=new An({checkCorrectEvent:t=>0===e.mouseButton(t)&&t.ctrlKey||2===e.mouseButton(t)});return new Mn({clickTolerance:i,move:(t,e)=>({bearingDelta:(e.x-t.x)*n}),moveStateManager:r,enable:t,assignEvents:Ln})},Bn=({enable:t,clickTolerance:i,pitchDegreesPerPixelMoved:n=-.5})=>{const r=new An({checkCorrectEvent:t=>0===e.mouseButton(t)&&t.ctrlKey||2===e.mouseButton(t)});return new Mn({clickTolerance:i,move:(t,e)=>({pitchDelta:(e.y-t.y)*n}),moveStateManager:r,enable:t,assignEvents:Ln})};class Rn{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.Point(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.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,e,i)}touchend(t,e,i){this._calculateTransform(t,e,i),this._active&&i.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,n){n.length>0&&(this._active=!0);const r=Sn(n,i),o=new t.Point(0,0),s=new t.Point(0,0);let a=0;for(const t in r){const e=r[t],i=this._touches[t];i&&(o._add(e),s._add(e.sub(i)),a++,r[t]=e)}if(this._touches=r,a<this._minTouches||!s.mag())return;const l=s.div(a);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(a),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Fn{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,e,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([e[0],e[1]]))}touchmove(t,e,i){if(!this._firstTwoTouches)return;t.preventDefault();const[n,r]=this._firstTwoTouches,o=On(i,e,n),s=On(i,e,r);if(!o||!s)return;const a=this._aroundCenter?null:o.add(s).div(2);return this._move([o,s],a,t)}touchend(t,i,n){if(!this._firstTwoTouches)return;const[r,o]=this._firstTwoTouches,s=On(n,i,r),a=On(n,i,o);s&&a||(this._active&&e.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function On(t,e,i){for(let n=0;n<t.length;n++)if(t[n].identifier===i)return e[n]}function Un(t,e){return Math.log(t/e)/Math.LN2}class Vn extends Fn{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,e){const i=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Un(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Un(this._distance,i),pinchAround:e}}}function Nn(t,e){return 180*t.angleWith(e)/Math.PI}class Zn extends Fn{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,e){const i=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Nn(this._vector,i),pinchAround:e}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const e=25/(Math.PI*this._minDiameter)*360,i=Nn(t,this._startVector);return Math.abs(i)<e}}function jn(t){return Math.abs(t.y)>Math.abs(t.x)}class qn extends Fn{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,jn(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,e,i){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const n=t[0].sub(this._lastPoints[0]),r=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(n,r,i.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(n.y+r.y)/2*-.5}):void 0}gestureBeginsVertically(t,e,i){if(void 0!==this._valid)return this._valid;const n=t.mag()>=2,r=e.mag()>=2;if(!n&&!r)return;if(!n||!r)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const o=t.y>0==e.y>0;return jn(t)&&jn(e)&&o}}const $n={panStep:100,bearingStep:15,pitchStep:10};class Gn{constructor(t){this._tr=new Tn(t);const e=$n;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,r=0,o=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(),r=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),r=1);break;case 38:t.shiftKey?n=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?n=-1:(t.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(i=0,n=0),{cameraAnimation:s=>{const a=this._tr;s.easeTo({duration:300,easeId:"keyboardHandler",easing:Hn,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:[-r*this._panStep,-o*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 Hn(t){return t*(2-t)}const Wn=4.000244140625;class Xn{constructor(t,e){this._onTimeout=t=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},this._map=t,this._tr=new Tn(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 n=t.browser.now(),r=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==i&&i%Wn==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(r*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(i){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 n=e.mousePos(this._el,i),r=this._tr;this._around=t.LngLat.convert(this._aroundCenter?r.center:r.unproject(n)),this._aroundPoint=r.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)>Wn?this._wheelZoomRate:this._defaultZoomRate;let i=2/(1+Math.exp(-Math.abs(this._delta*t)));this._delta<0&&0!==i&&(i=1/i);const n="number"==typeof this._targetZoom?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(n*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,n=this._startZoom,r=this._easing;let o,s=!1;if("wheel"===this._type&&n&&r){const e=Math.min((t.browser.now()-this._lastWheelEventTime)/200,1),a=r(e);o=t.interpolate.number(n,i,a),e<1?this._frameId||(this._frameId=!0):s=!0}else o=i,s=!0;return this._active=!0,s&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!s,zoomDelta:o-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=t.defaultEasing;if(this._prevEase){const e=this._prevEase,n=(t.browser.now()-e.start)/e.duration,r=e.easing(n+.01)-e.easing(n),o=.27/Math.sqrt(r*r+1e-4)*.01,s=Math.sqrt(.0729-o*o);i=t.bezier(o,s,.25,1)}return this._prevEase={start:t.browser.now(),duration:e,easing:i},i}reset(){this._active=!1}}class Kn{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 Yn{constructor(t){this._tr=new Tn(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 Jn{constructor(){this._tap=new zn({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],r=t.timeStamp-this._tapTime<500,o=this._tapPoint.dist(n)<30;r&&o?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],r=n.y-this._swipePoint.y;return this._swipePoint=n,t.preventDefault(),this._active=!0,{zoomDelta:r/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 Qn{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 tr{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 er{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()}}const ir=t=>t.zoom||t.drag||t.pitch||t.rotate;class nr extends t.Event{}function rr(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}class or{constructor(t,i){this.handleWindowEvent=t=>{this.handleEvent(t,`${t.type}Window`)},this.handleEvent=(t,i)=>{if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;const n="renderFrame"===t.type?void 0:t,r={needsRenderFrame:!1},o={},s={},a=t.touches,l=a?this._getMapTouches(a):void 0,c=l?e.touchPos(this._el,l):e.mousePos(this._el,t);for(const{handlerName:e,handler:a,allowed:h}of this._handlers){if(!a.isEnabled())continue;let u;this._blockedByActive(s,h,e)?a.reset():a[i||t.type]&&(u=a[i||t.type](t,c,l),this.mergeHandlerResult(r,o,u,e,n),u&&u.needsRenderFrame&&this._triggerRenderFrame()),(u||a.isActive())&&(s[e]=a)}const h={};for(const t in this._previousActiveHandlers)s[t]||(h[t]=n);this._previousActiveHandlers=s,(Object.keys(h).length||rr(r))&&(this._changes.push([r,o,h]),this._triggerRenderFrame()),(Object.keys(s).length||rr(r))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:u}=r;u&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],u(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new fn(t),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);const n=this._el;this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[window,"blur",void 0]];for(const[t,i,n]of this._listeners)e.addEventListener(t,i,t===document?this.handleWindowEvent:this.handleEvent,n)}destroy(){for(const[t,i,n]of this._listeners)e.removeEventListener(t,i,t===document?this.handleWindowEvent:this.handleEvent,n)}_addDefaultHandlers(t){const i=this._map,n=i.getCanvasContainer();this._add("mapEvent",new bn(i,t));const r=i.boxZoom=new En(i,t);this._add("boxZoom",r),t.interactive&&t.boxZoom&&r.enable();const o=new Cn(i),s=new Yn(i);i.doubleClickZoom=new Kn(s,o),this._add("tapZoom",o),this._add("clickZoom",s),t.interactive&&t.doubleClickZoom&&i.doubleClickZoom.enable();const a=new Jn;this._add("tapDragZoom",a);const l=i.touchPitch=new qn(i);this._add("touchPitch",l),t.interactive&&t.touchPitch&&i.touchPitch.enable(t.touchPitch);const c=Dn(t),h=Bn(t);i.dragRotate=new tr(t,c,h),this._add("mouseRotate",c,["mousePitch"]),this._add("mousePitch",h,["mouseRotate"]),t.interactive&&t.dragRotate&&i.dragRotate.enable();const u=(({enable:t,clickTolerance:i})=>{const n=new An({checkCorrectEvent:t=>0===e.mouseButton(t)&&!t.ctrlKey});return new Mn({clickTolerance:i,move:(t,e)=>({around:e,panDelta:e.sub(t)}),activateOnStart:!0,moveStateManager:n,enable:t,assignEvents:Ln})})(t),p=new Rn(t,i);i.dragPan=new Qn(n,u,p),this._add("mousePan",u),this._add("touchPan",p,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&i.dragPan.enable(t.dragPan);const d=new Zn,m=new Vn;i.touchZoomRotate=new er(n,m,d,a),this._add("touchRotate",d,["touchPan","touchZoom"]),this._add("touchZoom",m,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&i.touchZoomRotate.enable(t.touchZoomRotate);const f=i.scrollZoom=new Xn(i,(()=>this._triggerRenderFrame()));this._add("scrollZoom",f,["mousePan"]),t.interactive&&t.scrollZoom&&i.scrollZoom.enable(t.scrollZoom);const g=i.keyboard=new Gn(i);this._add("keyboard",g),t.interactive&&t.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new wn(i))}_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(ir(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(e,i,n,r,o){if(!n)return;t.extend(e,n);const s={handlerName:r,originalEvent:n.originalEvent||o};void 0!==n.zoomDelta&&(i.zoom=s),void 0!==n.panDelta&&(i.drag=s),void 0!==n.pitchDelta&&(i.pitch=s),void 0!==n.bearingDelta&&(i.rotate=s)}_applyChanges(){const e={},i={},n={};for(const[r,o,s]of this._changes)r.panDelta&&(e.panDelta=(e.panDelta||new t.Point(0,0))._add(r.panDelta)),r.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+r.zoomDelta),r.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+r.bearingDelta),r.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+r.pitchDelta),void 0!==r.around&&(e.around=r.around),void 0!==r.pinchAround&&(e.pinchAround=r.pinchAround),r.noInertia&&(e.noInertia=r.noInertia),t.extend(i,o),t.extend(n,s);this._updateMapTransform(e,i,n),this._changes=[]}_updateMapTransform(t,e,i){const n=this._map,r=n._getTransformForUpdate(),o=n.terrain;if(!(rr(t)||o&&this._terrainMovement))return this._fireEvents(e,i,!0);let{panDelta:s,zoomDelta:a,bearingDelta:l,pitchDelta:c,around:h,pinchAround:u}=t;void 0!==u&&(h=u),n._stop(!0),h=h||n.transform.centerPoint;const p=r.pointLocation(s?h.sub(s):h);l&&(r.bearing+=l),c&&(r.pitch+=c),a&&(r.zoom+=a),o?this._terrainMovement||!e.drag&&!e.zoom?e.drag&&this._terrainMovement?r.center=r.pointLocation(r.centerPoint.sub(s)):r.setLocationAtPoint(p,h):(this._terrainMovement=!0,this._map._elevationFreeze=!0,r.setLocationAtPoint(p,h),this._map.once("moveend",(()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,r.recalculateZoom(n.terrain)}))):r.setLocationAtPoint(p,h),n._applyUpdatedTransform(r),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,i,!0)}_fireEvents(e,i,n){const r=ir(this._eventsInProgress),o=ir(e),s={};for(const t in e){const{originalEvent:i}=e[t];this._eventsInProgress[t]||(s[`${t}start`]=i),this._eventsInProgress[t]=e[t]}!r&&o&&this._fireEvent("movestart",o.originalEvent);for(const t in s)this._fireEvent(t,s[t]);o&&this._fireEvent("move",o.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:n}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],l=i[e]||n,a[`${t}end`]=l)}for(const t in a)this._fireEvent(t,a[t]);const c=ir(this._eventsInProgress);if(n&&(r||o)&&!c){this._updatingCamera=!0;const e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=t=>0!==t&&-this._bearingSnap<t&&t<this._bearingSnap;e?(i(e.bearing||this._map.getBearing())&&(e.bearing=0),e.freezeElevation=!0,this._map.easeTo(e,{originalEvent:l})):(this._map.fire(new t.Event("moveend",{originalEvent:l})),i(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new t.Event(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{delete this._frameId,this.handleEvent(new nr("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class sr extends t.Evented{constructor(e,i){super(),this._renderFrameCallback=()=>{const e=Math.min((t.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?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.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}panBy(e,i,n){return e=t.Point.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},i),n)}panTo(e,i,n){return this.easeTo(t.extend({center:e},i),n)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(e,i,n){return this.easeTo(t.extend({zoom:e},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(e,i,n){return this.easeTo(t.extend({bearing:e},i),n)}resetNorth(e,i){return this.rotateTo(0,t.extend({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(t.extend({bearing:0,pitch:0,duration:1e3},e),i),this}snapToNorth(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this}getPitch(){return this.transform.pitch}setPitch(t,e){return this.jumpTo({pitch:t},e),this}cameraForBounds(t,e){t=k.convert(t);const i=e&&e.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),i,e)}_cameraForBoxAndBearing(e,i,n,r){const o={top:0,bottom:0,right:0,left:0};if("number"==typeof(r=t.extend({padding:o,offset:[0,0],maxZoom:this.transform.maxZoom},r)).padding){const t=r.padding;r.padding={top:t,bottom:t,right:t,left:t}}r.padding=t.extend(o,r.padding);const s=this.transform,a=s.padding,l=s.project(t.LngLat.convert(e)),c=s.project(t.LngLat.convert(i)),h=l.rotate(-n*Math.PI/180),u=c.rotate(-n*Math.PI/180),p=new t.Point(Math.max(h.x,u.x),Math.max(h.y,u.y)),d=new t.Point(Math.min(h.x,u.x),Math.min(h.y,u.y)),m=p.sub(d),f=(s.width-(a.left+a.right+r.padding.left+r.padding.right))/m.x,g=(s.height-(a.top+a.bottom+r.padding.top+r.padding.bottom))/m.y;if(g<0||f<0)return void t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const _=Math.min(s.scaleZoom(s.scale*Math.min(f,g)),r.maxZoom),y=t.Point.convert(r.offset),v=new t.Point((r.padding.left-r.padding.right)/2,(r.padding.top-r.padding.bottom)/2).rotate(n*Math.PI/180),x=y.add(v).mult(s.scale/s.zoomScale(_));return{center:s.unproject(l.add(c).div(2).sub(x)),zoom:_,bearing:n}}fitBounds(t,e,i){return this._fitInternal(this.cameraForBounds(t,e),e,i)}fitScreenCoordinates(e,i,n,r,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(t.Point.convert(e)),this.transform.pointLocation(t.Point.convert(i)),n,r),r,o)}_fitInternal(e,i,n){return e?(delete(i=t.extend(e,i)).padding,i.linear?this.easeTo(i,n):this.flyTo(i,n)):this}jumpTo(e,i){this.stop();const n=this._getTransformForUpdate();let r=!1,o=!1,s=!1;return"zoom"in e&&n.zoom!==+e.zoom&&(r=!0,n.zoom=+e.zoom),void 0!==e.center&&(n.center=t.LngLat.convert(e.center)),"bearing"in e&&n.bearing!==+e.bearing&&(o=!0,n.bearing=+e.bearing),"pitch"in e&&n.pitch!==+e.pitch&&(s=!0,n.pitch=+e.pitch),null==e.padding||n.isPaddingEqual(e.padding)||(n.padding=e.padding),this._applyUpdatedTransform(n),this.fire(new t.Event("movestart",i)).fire(new t.Event("move",i)),r&&this.fire(new t.Event("zoomstart",i)).fire(new t.Event("zoom",i)).fire(new t.Event("zoomend",i)),o&&this.fire(new t.Event("rotatestart",i)).fire(new t.Event("rotate",i)).fire(new t.Event("rotateend",i)),s&&this.fire(new t.Event("pitchstart",i)).fire(new t.Event("pitch",i)).fire(new t.Event("pitchend",i)),this.fire(new t.Event("moveend",i))}calculateCameraOptionsFromTo(e,i,n,r=0){const o=t.MercatorCoordinate.fromLngLat(e,i),s=t.MercatorCoordinate.fromLngLat(n,r),a=s.x-o.x,l=s.y-o.y,c=s.z-o.z,h=Math.hypot(a,l,c);if(0===h)throw new Error("Can't calculate camera options with same From and To");const u=Math.hypot(a,l),p=this.transform.scaleZoom(this.transform.cameraToCenterDistance/h/this.transform.tileSize),d=180*Math.atan2(a,-l)/Math.PI;let m=180*Math.acos(u/h)/Math.PI;return m=c<0?90-m:90+m,{center:s.toLngLat(),zoom:p,pitch:m,bearing:d}}easeTo(e,i){this._stop(!1,e.easeId),(!1===(e=t.extend({offset:[0,0],duration:500,easing:t.defaultEasing},e)).animate||!e.essential&&t.browser.prefersReducedMotion)&&(e.duration=0);const n=this._getTransformForUpdate(),r=this.getZoom(),o=this.getBearing(),s=this.getPitch(),a=this.getPadding(),l="zoom"in e?+e.zoom:r,c="bearing"in e?this._normalizeBearing(e.bearing,o):o,h="pitch"in e?+e.pitch:s,u="padding"in e?e.padding:n.padding,p=t.Point.convert(e.offset);let d=n.centerPoint.add(p);const m=n.pointLocation(d),f=t.LngLat.convert(e.center||m);this._normalizeCenter(f);const g=n.project(m),_=n.project(f).sub(g),y=n.zoomScale(l-r);let v,x;e.around&&(v=t.LngLat.convert(e.around),x=n.locationPoint(v));const b={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||l!==r,this._rotating=this._rotating||o!==c,this._pitching=this._pitching||h!==s,this._padding=!n.isPaddingEqual(u),this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,b),this.terrain&&this._prepareElevation(f),this._ease((m=>{if(this._zooming&&(n.zoom=t.interpolate.number(r,l,m)),this._rotating&&(n.bearing=t.interpolate.number(o,c,m)),this._pitching&&(n.pitch=t.interpolate.number(s,h,m)),this._padding&&(n.interpolatePadding(a,u,m),d=n.centerPoint.add(p)),this.terrain&&!e.freezeElevation&&this._updateElevation(m),v)n.setLocationAtPoint(v,x);else{const t=n.zoomScale(n.zoom-r),e=l>r?Math.min(2,y):Math.max(.5,y),i=Math.pow(e,1-m),o=n.unproject(g.add(_.mult(m*i)).mult(t));n.setLocationAtPoint(n.renderWorldCopies?o.wrap():o,d)}this._applyUpdatedTransform(n),this._fireMoveEvents(i)}),(t=>{this.terrain&&this._finalizeElevation(),this._afterEase(i,t)}),e),this}_prepareEase(e,i,n={}){this._moving=!0,i||n.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!n.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!n.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!n.pitching&&this.fire(new t.Event("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.interpolate.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:n,pitch:r,bearing:o,elevation:s}=this.transformCameraUpdate(e);i&&(e.center=i),void 0!==n&&(e.zoom=n),void 0!==r&&(e.pitch=r),void 0!==o&&(e.bearing=o),void 0!==s&&(e.elevation=s),this.transform.apply(e)}_fireMoveEvents(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const n=this._zooming,r=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,n&&this.fire(new t.Event("zoomend",e)),r&&this.fire(new t.Event("rotateend",e)),o&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))}flyTo(e,i){if(!e.essential&&t.browser.prefersReducedMotion){const n=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(n,i)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.defaultEasing},e);const n=this._getTransformForUpdate(),r=this.getZoom(),o=this.getBearing(),s=this.getPitch(),a=this.getPadding(),l="zoom"in e?t.clamp(+e.zoom,n.minZoom,n.maxZoom):r,c="bearing"in e?this._normalizeBearing(e.bearing,o):o,h="pitch"in e?+e.pitch:s,u="padding"in e?e.padding:n.padding,p=n.zoomScale(l-r),d=t.Point.convert(e.offset);let m=n.centerPoint.add(d);const f=n.pointLocation(m),g=t.LngLat.convert(e.center||f);this._normalizeCenter(g);const _=n.project(f),y=n.project(g).sub(_);let v=e.curve;const x=Math.max(n.width,n.height),b=x/p,w=y.mag();if("minZoom"in e){const i=t.clamp(Math.min(e.minZoom,r,l),n.minZoom,n.maxZoom),o=x/n.zoomScale(i-r);v=Math.sqrt(o/w*2)}const T=v*v;function E(t){const e=(b*b-x*x+(t?-1:1)*T*T*w*w)/(2*(t?b:x)*T*w);return Math.log(Math.sqrt(e*e+1)-e)}function S(t){return(Math.exp(t)-Math.exp(-t))/2}function P(t){return(Math.exp(t)+Math.exp(-t))/2}const z=E(!1);let C=function(t){return P(z)/P(z+v*t)},M=function(t){return x*((P(z)*(S(e=z+v*t)/P(e))-S(z))/T)/w;var e},I=(E(!0)-z)/v;if(Math.abs(w)<1e-6||!isFinite(I)){if(Math.abs(x-b)<1e-6)return this.easeTo(e,i);const t=b<x?-1:1;I=Math.abs(Math.log(b/x))/v,M=function(){return 0},C=function(e){return Math.exp(t*v*e)}}return e.duration="duration"in e?+e.duration:1e3*I/("screenSpeed"in e?+e.screenSpeed/v:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=o!==c,this._pitching=h!==s,this._padding=!n.isPaddingEqual(u),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(g),this._ease((p=>{const f=p*I,v=1/C(f);n.zoom=1===p?l:r+n.scaleZoom(v),this._rotating&&(n.bearing=t.interpolate.number(o,c,p)),this._pitching&&(n.pitch=t.interpolate.number(s,h,p)),this._padding&&(n.interpolatePadding(a,u,p),m=n.centerPoint.add(d)),this.terrain&&!e.freezeElevation&&this._updateElevation(p);const x=1===p?g:n.unproject(_.add(y.mult(M(f))).mult(v));n.setLocationAtPoint(n.renderWorldCopies?x.wrap():x,m),this._applyUpdatedTransform(n),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,n){!1===n.animate||0===n.duration?(e(1),i()):(this._easeStart=t.browser.now(),this._easeOptions=n,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=t.wrap(e,-180,180);const n=Math.abs(e-i);return Math.abs(e-360-i)<n&&(e-=360),Math.abs(e+360-i)<n&&(e+=360),e}_normalizeCenter(t){const e=this.transform;if(!e.renderWorldCopies||e.lngRange)return;const i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(t.LngLat.convert(e),this.transform.tileZoom)-this.transform.elevation:null}}class ar{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=e.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=e.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=e.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(){e.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<t.length;n++)if(t[n].indexOf(e)>=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 lr{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=e.create("div","maplibregl-ctrl");const i=e.create("a","maplibregl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://maplibre.org/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){e.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class cr{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 hr={"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 ur=t.createLayout([{name:"a_pos3d",type:"Int16",components:3}]);class pr extends t.Evented{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 n={};for(const r of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i}))n[r.key]=!0,this._renderableTilesKeys.push(r.key),this._tiles[r.key]||(r.posMatrix=new Float64Array(16),t.ortho(r.posMatrix,0,t.EXTENT,0,t.EXTENT,0,1),this._tiles[r.key]=new H(r,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(e){const i={};for(const n of this._renderableTilesKeys){const r=this._tiles[n].tileID;if(r.canonical.equals(e.canonical)){const r=e.clone();r.posMatrix=new Float64Array(16),t.ortho(r.posMatrix,0,t.EXTENT,0,t.EXTENT,0,1),i[n]=r}else if(r.canonical.isChildOf(e.canonical)){const o=e.clone();o.posMatrix=new Float64Array(16);const s=r.canonical.z-e.canonical.z,a=r.canonical.x-(r.canonical.x>>s<<s),l=r.canonical.y-(r.canonical.y>>s<<s),c=t.EXTENT>>s;t.ortho(o.posMatrix,0,c,0,c,0,1),t.translate(o.posMatrix,o.posMatrix,[-a*c,-l*c,0]),i[n]=o}else if(e.canonical.isChildOf(r.canonical)){const o=e.clone();o.posMatrix=new Float64Array(16);const s=e.canonical.z-r.canonical.z,a=e.canonical.x-(e.canonical.x>>s<<s),l=e.canonical.y-(e.canonical.y>>s<<s),c=t.EXTENT>>s;t.ortho(o.posMatrix,0,t.EXTENT,0,t.EXTENT,0,1),t.translate(o.posMatrix,o.posMatrix,[a*c,l*c,0]),t.scale(o.posMatrix,o.posMatrix,[1/2**s,1/2**s,0]),i[n]=o}}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)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(n).key);let r=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!r||!r.dem)&&e)for(;n>=i.minzoom&&(!r||!r.dem);)r=this.sourceCache.getTileByID(t.scaledTo(n--).key);return r}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter((e=>e.timeAdded>=t))}}class dr{constructor(t,e,i){this.painter=t,this.sourceCache=new pr(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,n,r=t.EXTENT){var o;if(!(i>=0&&i<r&&n>=0&&n<r))return 0;const s=this.getTerrainData(e),a=null===(o=s.tile)||void 0===o?void 0:o.dem;if(!a)return 0;const l=function(t,e,i){var n=e[0],r=e[1];return t[0]=i[0]*n+i[4]*r+i[12],t[1]=i[1]*n+i[5]*r+i[13],t}([],[i/r*t.EXTENT,n/r*t.EXTENT],s.u_terrain_matrix),c=[l[0]*a.dim,l[1]*a.dim],h=Math.floor(c[0]),u=Math.floor(c[1]),p=c[0]-h,d=c[1]-u;return a.get(h,u)*(1-p)*(1-d)+a.get(h+1,u)*p*(1-d)+a.get(h,u+1)*(1-p)*d+a.get(h+1,u+1)*p*d}getElevationForLngLatZoom(e,i){const{tileID:n,mercatorX:r,mercatorY:o}=this._getOverscaledTileIDFromLngLatZoom(e,i);return this.getElevation(n,r%t.EXTENT,o%t.EXTENT,t.EXTENT)}getElevation(e,i,n,r=t.EXTENT){return this.getDEMElevation(e,i,n,r)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const e=this.painter.context,i=new t.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new y(e,i,e.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new y(e,new t.RGBAImage({width:1,height:1}),e.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=t.identity([])}const i=this.sourceCache.getSourceTile(e,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const t=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new y(t,i.dem.getPixels(),t.gl.RGBA,{premultiply:!1}),i.demTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const n=i&&i+i.tileID.key+e.key;if(n&&!this._demMatrixCache[n]){const n=this.sourceCache.sourceCache._source.maxzoom;let r=e.canonical.z-i.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=n?r=e.canonical.z-n:t.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const o=e.canonical.x-(e.canonical.x>>r<<r),s=e.canonical.y-(e.canonical.y>>r<<r),a=t.fromScaling(new Float64Array(16),[1/(t.EXTENT<<r),1/(t.EXTENT<<r),0]);t.translate(a,a,[o*t.EXTENT,s*t.EXTENT,0]),this._demMatrixCache[e.key]={matrix:a,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:n?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(t){const e=this.painter,i=e.width/devicePixelRatio,n=e.height/devicePixelRatio;return!this._fbo||this._fbo.width===i&&this._fbo.height===n||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new y(e.context,{width:i,height:n,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new y(e.context,{width:i,height:n,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=e.context.createFramebuffer(i,n,!0,!1),this._fbo.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,i,n))),this._fbo.colorAttachment.set("coords"===t?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let t=0,e=0;t<this._coordsTextureSize;t++)for(let n=0;n<this._coordsTextureSize;n++,e+=4)i[e+0]=255&n,i[e+1]=255&t,i[e+2]=n>>8<<4|t>>8,i[e+3]=0;const n=new t.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),r=new y(e,n,e.gl.RGBA,{premultiply:!1});return r.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=r,r}pointCoordinate(e){const i=new Uint8Array(4),n=this.painter.context,r=n.gl;n.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),r.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,r.RGBA,r.UNSIGNED_BYTE,i),n.bindFramebuffer.set(null);const o=i[0]+(i[2]>>4<<8),s=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,h=(1<<l.tileID.canonical.z)*c;return new t.MercatorCoordinate((l.tileID.canonical.x*c+o)/h,(l.tileID.canonical.y*c+s)/h,this.getElevation(l.tileID,o,s,c))}getTerrainMesh(){if(this._mesh)return this._mesh;const e=this.painter.context,i=new t.Pos3dArray,n=new t.TriangleIndexArray,r=this.meshSize,o=t.EXTENT/r,s=r*r;for(let t=0;t<=r;t++)for(let e=0;e<=r;e++)i.emplaceBack(e*o,t*o,0);for(let t=0;t<s;t+=r+1)for(let e=0;e<r;e++)n.emplaceBack(e+t,r+e+t+1,r+e+t+2),n.emplaceBack(e+t,r+e+t+2,e+t+1);const a=i.length,l=a+2*(r+1);for(const e of[0,1])for(let n=0;n<=r;n++)for(const r of[0,1])i.emplaceBack(n*o,e*t.EXTENT,r);for(let t=0;t<2*r;t+=2)n.emplaceBack(l+t,l+t+1,l+t+3),n.emplaceBack(l+t,l+t+3,l+t+2),n.emplaceBack(a+t,a+t+3,a+t+1),n.emplaceBack(a+t,a+t+2,a+t+3);const c=i.length,h=c+2*(r+1);for(const e of[0,1])for(let n=0;n<=r;n++)for(const r of[0,1])i.emplaceBack(e*t.EXTENT,n*o,r);for(let t=0;t<2*r;t+=2)n.emplaceBack(c+t,c+t+1,c+t+3),n.emplaceBack(c+t,c+t+3,c+t+2),n.emplaceBack(h+t,h+t+3,h+t+1),n.emplaceBack(h+t,h+t+2,h+t+3);return this._mesh={indexBuffer:e.createIndexBuffer(n),vertexBuffer:e.createVertexBuffer(i,ur.members),segments:t.SegmentVector.simpleSegment(0,0,i.length,n.length)},this._mesh}getMeshFrameDelta(e){return 2*Math.PI*t.earthRadius/Math.pow(2,e)/5}getMinTileElevationForLngLatZoom(t,e){var i;const{tileID:n}=this._getOverscaledTileIDFromLngLatZoom(t,e);return null!==(i=this.getMinMaxElevation(n).minElevation)&&void 0!==i?i:0}getMinMaxElevation(t){const e=this.getTerrainData(t).tile,i={minElevation:null,maxElevation:null};return e&&e.dem&&(i.minElevation=e.dem.min*this.exaggeration,i.maxElevation=e.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(e,i){const n=t.MercatorCoordinate.fromLngLat(e.wrap()),r=(1<<i)*t.EXTENT,o=n.x*r,s=n.y*r,a=Math.floor(o/t.EXTENT),l=Math.floor(s/t.EXTENT);return{tileID:new t.OverscaledTileID(i,0,i,a,l),mercatorX:o,mercatorY:s}}}class mr{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 y(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<this._size)&&!1===this._objects.some((t=>!t.inUse))}}const fr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class gr{constructor(t,e){this.painter=t,this.terrain=e,this.pool=new mr(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(fr[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(e){if(e.isHidden(this.painter.transform.zoom))return!1;const i=e.type,n=this.painter,r=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(fr[i]&&(this._prevType&&fr[this._prevType]||this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(e.id),!r))return!0;if(fr[this._prevType]||fr[i]&&r){this._prevType=i;const e=this._stacks.length-1,r=this._stacks[e]||[];for(const i of this._renderableTiles){if(this.pool.isFull()&&(en(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 o=this.pool.getOrCreateFreeObject();this.pool.useObject(o),this.pool.stampObject(o),i.rtt[e]={id:o.id,stamp:o.stamp},n.context.bindFramebuffer.set(o.fbo.framebuffer),n.context.clear({color:t.Color.transparent,stencil:0}),n.currentStencilSource=void 0;for(let t=0;t<r.length;t++){const e=n.style._layers[r[t]],s=e.source?this._coordsDescendingInv[e.source][i.tileID.key]:[i.tileID];n.context.viewport.set([0,0,o.fbo.width,o.fbo.height]),n._renderTileClippingMasks(e,s),n.renderLayer(n,n.style.sourceCaches[e.source],e,s),e.source&&(i.rttCoords[e.source]=this._coordsDescendingInvStr[e.source][i.tileID.key])}}return en(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),fr[i]}return!1}}const _r={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:t.config.MAX_TILE_CACHE_ZOOM_LEVELS,localIdeographFontFamily:"sans-serif",transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,validateStyle:!0,maxCanvasSize:[4096,4096]},yr=t=>{t.touchstart=t.dragStart,t.touchmoveWindow=t.dragMove,t.touchend=t.dragEnd},vr={showCompass:!0,showZoom:!0,visualizePitch:!1};class xr{constructor(i,n,r=!1){this.mousedown=i=>{this.startMouse(t.extend({},i,{ctrlKey:!0,preventDefault:()=>i.preventDefault()}),e.mousePos(this.element,i)),e.addEventListener(window,"mousemove",this.mousemove),e.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=t=>{this.moveMouse(t,e.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=e.touchPos(this.element,t.targetTouches)[0],this.startTouch(t,this._startPos),e.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),e.addEventListener(window,"touchend",this.touchend))},this.touchmove=t=>{1!==t.targetTouches.length?this.reset():(this._lastPos=e.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._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{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 o=i.dragRotate._mouseRotate.getClickTolerance(),s=i.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=Dn({clickTolerance:o,enable:!0}),this.touchRotate=(({enable:t,clickTolerance:e,bearingDegreesPerPixelMoved:i=.8})=>{const n=new kn;return new Mn({clickTolerance:e,move:(t,e)=>({bearingDelta:(e.x-t.x)*i}),moveStateManager:n,enable:t,assignEvents:yr})})({clickTolerance:o,enable:!0}),this.map=i,r&&(this.mousePitch=Bn({clickTolerance:s,enable:!0}),this.touchPitch=(({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:i=-.5})=>{const n=new kn;return new Mn({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*i}),moveStateManager:n,enable:t,assignEvents:yr})})({clickTolerance:s,enable:!0})),e.addEventListener(n,"mousedown",this.mousedown),e.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),e.addEventListener(n,"touchcancel",this.reset)}startMouse(t,i){this.mouseRotate.dragStart(t,i),this.mousePitch&&this.mousePitch.dragStart(t,i),e.disableDrag()}startTouch(t,i){this.touchRotate.dragStart(t,i),this.touchPitch&&this.touchPitch.dragStart(t,i),e.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;e.removeEventListener(t,"mousedown",this.mousedown),e.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),e.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),e.removeEventListener(window,"touchend",this.touchend),e.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){e.enableDrag(),e.removeEventListener(window,"mousemove",this.mousemove),e.removeEventListener(window,"mouseup",this.mouseup),e.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),e.removeEventListener(window,"touchend",this.touchend)}}let br;function wr(e,i,n){if(e=new t.LngLat(e.lng,e.lat),i){const r=new t.LngLat(e.lng-360,e.lat),o=new t.LngLat(e.lng+360,e.lat),s=n.locationPoint(e).distSqr(i);n.locationPoint(r).distSqr(i)<s?e=r:n.locationPoint(o).distSqr(i)<s&&(e=o)}for(;Math.abs(e.lng-n.center.lng)>180;){const t=n.locationPoint(e);if(t.x>=0&&t.y>=0&&t.x<=n.width&&t.y<=n.height)break;e.lng>n.center.lng?e.lng-=360:e.lng+=360}return e}const Tr={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 Er(t,e,i){const n=t.classList;for(const t in Tr)n.remove(`maplibregl-${i}-anchor-${t}`);n.add(`maplibregl-${i}-anchor-${e}`)}class Sr extends t.Evented{constructor(i){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;this._map.transform.renderWorldCopies&&(this._lngLat=wr(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let i="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?i=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(i=`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()),e.setTransform(this._element,`${Tr[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${n} ${i}`),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.Event("dragstart"))),this.fire(new t.Event("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.Event("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=i&&i.anchor||"center",this._color=i&&i.color||"#3FB1CE",this._scale=i&&i.scale||1,this._draggable=i&&i.draggable||!1,this._clickTolerance=i&&i.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=i&&i.rotation||0,this._rotationAlignment=i&&i.rotationAlignment||"auto",this._pitchAlignment=i&&i.pitchAlignment&&"auto"!==i.pitchAlignment?i.pitchAlignment:this._rotationAlignment,i&&i.element)this._element=i.element,this._offset=t.Point.convert(i&&i.offset||[0,0]);else{this._defaultMarker=!0,this._element=e.create("div"),this._element.setAttribute("aria-label","Map marker");const n=e.createNS("http://www.w3.org/2000/svg","svg"),r=41,o=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${r}px`),n.setAttributeNS(null,"width",`${o}px`),n.setAttributeNS(null,"viewBox",`0 0 ${o} ${r}`);const s=e.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"stroke","none"),s.setAttributeNS(null,"stroke-width","1"),s.setAttributeNS(null,"fill","none"),s.setAttributeNS(null,"fill-rule","evenodd");const a=e.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"fill-rule","nonzero");const l=e.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 i=e.createNS("http://www.w3.org/2000/svg","ellipse");i.setAttributeNS(null,"opacity","0.04"),i.setAttributeNS(null,"cx","10.5"),i.setAttributeNS(null,"cy","5.80029008"),i.setAttributeNS(null,"rx",t.rx),i.setAttributeNS(null,"ry",t.ry),l.appendChild(i)}const h=e.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"fill",this._color);const u=e.createNS("http://www.w3.org/2000/svg","path");u.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"),h.appendChild(u);const p=e.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"opacity","0.25"),p.setAttributeNS(null,"fill","#000000");const d=e.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"),p.appendChild(d);const m=e.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(6.0, 7.0)"),m.setAttributeNS(null,"fill","#FFFFFF");const f=e.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"transform","translate(8.0, 8.0)");const g=e.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#000000"),g.setAttributeNS(null,"opacity","0.25"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962");const _=e.createNS("http://www.w3.org/2000/svg","circle");_.setAttributeNS(null,"fill","#FFFFFF"),_.setAttributeNS(null,"cx","5.5"),_.setAttributeNS(null,"cy","5.5"),_.setAttributeNS(null,"r","5.4999962"),f.appendChild(g),f.appendChild(_),a.appendChild(l),a.appendChild(h),a.appendChild(p),a.appendChild(m),a.appendChild(f),n.appendChild(a),n.setAttributeNS(null,"height",r*this._scale+"px"),n.setAttributeNS(null,"width",o*this._scale+"px"),this._element.appendChild(n),this._offset=t.Point.convert(i&&i.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(t=>{t.preventDefault()})),this._element.addEventListener("mousedown",(t=>{t.preventDefault()})),Er(this._element,this._anchor,"marker"),i&&i.className)for(const t of i.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),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),e.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.LngLat.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,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._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.Point.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 Pr={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let zr=0,Cr=!1;const Mr={maxWidth:100,unit:"metric"};function Ir(t,e,i){const n=i&&i.maxWidth||100,r=t._container.clientHeight/2,o=t.unproject([0,r]),s=t.unproject([n,r]),a=o.distanceTo(s);if(i&&"imperial"===i.unit){const i=3.2808*a;i>5280?Ar(e,n,i/5280,t._getUIString("ScaleControl.Miles")):Ar(e,n,i,t._getUIString("ScaleControl.Feet"))}else i&&"nautical"===i.unit?Ar(e,n,a/1852,t._getUIString("ScaleControl.NauticalMiles")):a>=1e3?Ar(e,n,a/1e3,t._getUIString("ScaleControl.Kilometers")):Ar(e,n,a,t._getUIString("ScaleControl.Meters"))}function Ar(t,e,i,n){const r=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*(r/i)+"px",t.innerHTML=`${r}&nbsp;${n}`}const kr={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Lr=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Dr(e){if(e){if("number"==typeof e){const i=Math.round(Math.abs(e)/Math.SQRT2);return{center:new t.Point(0,0),top:new t.Point(0,e),"top-left":new t.Point(i,i),"top-right":new t.Point(-i,i),bottom:new t.Point(0,-e),"bottom-left":new t.Point(i,-i),"bottom-right":new t.Point(-i,-i),left:new t.Point(e,0),right:new t.Point(-e,0)}}if(e instanceof t.Point||Array.isArray(e)){const i=t.Point.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.Point.convert(e.center||[0,0]),top:t.Point.convert(e.top||[0,0]),"top-left":t.Point.convert(e["top-left"]||[0,0]),"top-right":t.Point.convert(e["top-right"]||[0,0]),bottom:t.Point.convert(e.bottom||[0,0]),"bottom-left":t.Point.convert(e["bottom-left"]||[0,0]),"bottom-right":t.Point.convert(e["bottom-right"]||[0,0]),left:t.Point.convert(e.left||[0,0]),right:t.Point.convert(e.right||[0,0])}}return Dr(new t.Point(0,0))}const Br={extend:(e,...i)=>t.extend(e,...i),run(t){t()},logToElement(t,e=!1,i="log"){const n=window.document.getElementById(i);n&&(e&&(n.innerHTML=""),n.innerHTML+=`<br>${t}`)}};class Rr{static get version(){return"3.3.1"}static get workerCount(){return tt.workerCount}static set workerCount(t){tt.workerCount=t}static get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e}static get workerUrl(){return t.config.WORKER_URL}static set workerUrl(e){t.config.WORKER_URL=e}static addProtocol(e,i){t.config.REGISTERED_PROTOCOLS[e]=i}static removeProtocol(e){delete t.config.REGISTERED_PROTOCOLS[e]}}return Rr.Map=class extends sr{constructor(e){if(t.PerformanceUtils.mark(t.PerformanceMarkers.create),null!=(e=t.extend({},_r,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 an(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.Event("webglcontextlost",{originalEvent:e}))},this._contextRestored=e=>{this._setupPainter(),this.resize(),this._update(),this.fire(new t.Event("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 cr,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},hr,e.locale),this._clickTolerance=e.clickTolerance,this._overridePixelRatio=e.pixelRatio,this._maxCanvasSize=e.maxCanvasSize,this.transformCameraUpdate=e.transformCameraUpdate,this._imageQueueHandle=l.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=ln((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 or(this,e),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=e.hash&&new cn("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.extend({},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 ar({customAttribution:e.customAttribution})),e.maplibreLogo&&this.addControl(new lr,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.Event(`${e.dataType}data`,e))})),this.on("dataloading",(e=>{this.fire(new t.Event(`${e.dataType}dataloading`,e))})),this.on("dataabort",(e=>{this.fire(new t.Event("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.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=e.onAdd(this);this._controls.push(e);const r=this._controlPositions[i];return-1!==i.indexOf("bottom")?r.insertBefore(n,r.firstChild):r.appendChild(n),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(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,n){return null==n&&this.terrain&&(n=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(t,e,i,n)}resize(e){var i;const n=this._containerDimensions(),r=n[0],o=n[1],s=this._getClampedPixelRatio(r,o);if(this._resizeCanvas(r,o,s),this.painter.resize(r,o,s),this.painter.overLimit()){const t=this.painter.context.gl;this._maxCanvasSize=[t.drawingBufferWidth,t.drawingBufferHeight];const e=this._getClampedPixelRatio(r,o);this._resizeCanvas(r,o,e),this.painter.resize(r,o,e)}this.transform.resize(r,o),null===(i=this._requestedCameraState)||void 0===i||i.resize(r,o);const a=!this._moving;return a&&(this.stop(),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e))),this.fire(new t.Event("resize",e)),a&&this.fire(new t.Event("moveend",e)),this}_getClampedPixelRatio(t,e){const{0:i,1:n}=this._maxCanvasSize,r=this.getPixelRatio(),o=t*r,s=e*r;return Math.min(o>i?i/o:1,s>n?n/s:1)*r}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(k.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()<t&&this.setZoom(t),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if((t=null==t?22:t)>=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()<t&&this.setPitch(t),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if((t=null==t?60:t)>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.LngLat.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.pointLocation(t.Point.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 n=!1;const r=r=>{const o=this.getLayer(e)?this.queryRenderedFeatures(r.point,{layers:[e]}):[];o.length?n||(n=!0,i.call(this,new yn(t,this,r.originalEvent,{features:o}))):n=!1};return{layer:e,listener:i,delegates:{mousemove:r,mouseout:()=>{n=!1}}}}if("mouseleave"===t||"mouseout"===t){let n=!1;const r=r=>{(this.getLayer(e)?this.queryRenderedFeatures(r.point,{layers:[e]}):[]).length?n=!0:n&&(n=!1,i.call(this,new yn(t,this,r.originalEvent)))},o=e=>{n&&(n=!1,i.call(this,new yn(t,this,e.originalEvent)))};return{layer:e,listener:i,delegates:{mousemove:r,mouseout:o}}}{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 r=this._delegatedListeners[t];for(let t=0;t<r.length;t++){const n=r[t];if(n.layer===e&&n.listener===i){for(const t in n.delegates)this.off(t,n.delegates[t]);return r.splice(t,1),this}}})(),this)}queryRenderedFeatures(e,i){if(!this.style)return[];let n;const r=e instanceof t.Point||Array.isArray(e),o=r?e:[[0,0],[this.transform.width,this.transform.height]];if(i=i||(r?{}:e)||{},o instanceof t.Point||"number"==typeof o[0])n=[t.Point.convert(o)];else{const e=t.Point.convert(o[0]),i=t.Point.convert(o[1]);n=[e,new t.Point(i.x,e.y),i,new t.Point(e.x,i.y),e]}return this.style.queryRenderedFeatures(n,i,this.transform)}querySourceFeatures(t,e){return this.style.querySourceFeatures(t,e)}setStyle(e,i){return!1!==(i=t.extend({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},i)).diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(e,i))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){const e=this._locale[t];if(null==e)throw new Error(`Missing UI string '${t}'`);return e}_updateStyle(t,e){if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._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 ne(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 ne(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,i){if("string"==typeof e){const n=this._requestManager.transformRequest(e,c.Style);t.getJSON(n,((e,n)=>{e?this.fire(new t.ErrorEvent(e)):n&&this._updateDiff(n,i)}))}else"object"==typeof e&&this._updateDiff(e,i)}_updateDiff(e,i){try{this.style.setState(e,i)&&this._update(!0)}catch(n){t.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}.  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.warnOnce("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.ErrorEvent(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 n=this.style._layers[i];"hillshade"===n.type&&n.source===e.source&&t.warnOnce("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 dr(this.painter,i,e),this.painter.renderToTexture=new gr(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.Event("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,n={}){const{pixelRatio:r=1,sdf:o=!1,stretchX:s,stretchY:a,content:l}=n;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||t.isImageBitmap(i))){if(void 0===i.width||void 0===i.height)return this.fire(new t.ErrorEvent(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:c,data:h}=i,u=i;return this.style.addImage(e,{data:new t.RGBAImage({width:n,height:c},new Uint8Array(h)),pixelRatio:r,stretchX:s,stretchY:a,content:l,sdf:o,version:0,userImage:u}),u.onAdd&&u.onAdd(this,e),this}}{const{width:n,height:c,data:h}=t.browser.getImageData(i);this.style.addImage(e,{data:new t.RGBAImage({width:n,height:c},h),pixelRatio:r,stretchX:s,stretchY:a,content:l,sdf:o,version:0})}}updateImage(e,i){const n=this.style.getImage(e);if(!n)return this.fire(new t.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const r=i instanceof HTMLImageElement||t.isImageBitmap(i)?t.browser.getImageData(i):i,{width:o,height:s,data:a}=r;if(void 0===o||void 0===s)return this.fire(new t.ErrorEvent(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||s!==n.data.height)return this.fire(new t.ErrorEvent(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.isImageBitmap(i));return n.data.replace(a,l),this.style.updateImage(e,n),this}getImage(t){return this.style.getImage(t)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new t.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(t,e){l.getImage(this._requestManager.transformRequest(t,c.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)}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()}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 i=this._canvasContainer=e.create("div","maplibregl-canvas-container",t);this._interactive&&i.classList.add("maplibregl-interactive"),this._canvas=e.create("canvas","maplibregl-canvas",i),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 n=this._containerDimensions(),r=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],r);const o=this._controlContainer=e.create("div","maplibregl-control-container",t),s=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((t=>{s[t]=e.create("div",`maplibregl-ctrl-${t} `,o)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=e.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            <div class="maplibregl-desktop-message">${t}</div>\n            <div class="maplibregl-mobile-message">${"boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}</div>\n        `,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){e.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 n=this._canvas.getContext("webgl2",t)||this._canvas.getContext("webgl",t);if(!n){const t="Failed to initialize WebGL";throw e?(e.message=t,new Error(JSON.stringify(e))):new Error(t)}this.painter=new nn(n,this.transform),i.testSupport(n)}_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 n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const e=this.transform.zoom,r=t.browser.now();this.style.zoomHistory.update(e,r);const o=new t.EvaluationParameters(e,{now:r,fadeDuration:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),s=o.crossFadingFactor();1===s&&s===this._crossFadingFactor||(n=!0,this._crossFadingFactor=s),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._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.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,t.PerformanceUtils.mark(t.PerformanceMarkers.load),this.fire(new t.Event("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const r=this._sourcesDirty||this._styleDirty||this._placementDirty;return r||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.Event("idle")),!this._loaded||this._fullyLoaded||r||(this._fullyLoaded=!0,t.PerformanceUtils.mark(t.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var i;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),l.removeThrottleControl(this._imageQueueHandle),null===(i=this._resizeObserver)||void 0===i||i.disconnect();const n=this.painter.context.gl.getExtension("WEBGL_lose_context");n&&n.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),e.remove(this._canvasContainer),e.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),t.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new t.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=t.browser.frame((e=>{t.PerformanceUtils.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"3.3.1"}getCameraTargetElevation(){return this.transform.elevation}},Rr.NavigationControl=class{constructor(i){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.extend({},vr,i),this._container=e.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}))),e.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}))),e.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=e.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 xr(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){e.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,i){const n=e.create("button",t,this._container);return n.type="button",n.addEventListener("click",i),n}},Rr.GeolocateControl=class extends t.Evented{constructor(i){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event("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.Event("geolocate",e)),this._finish()}},this._updateCamera=e=>{const i=new t.LngLat(e.coords.longitude,e.coords.latitude),n=e.coords.accuracy,r=this._map.getBearing(),o=t.extend({bearing:r},this.options.fitBoundsOptions),s=k.fromLngLat(i,n);this._map.fitBounds(s,o,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new t.LngLat(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&&Cr)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=i=>{if(this._map){if(this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this._geolocateButton=e.create("button","maplibregl-ctrl-geolocate",this._container),e.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===i){t.warnOnce("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=e.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Sr({element:this._dotElement}),this._circleElement=e.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Sr({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.Event("trackuserlocationend")))}))}},this.options=t.extend({},Pr,i)}onAdd(t){return this._map=t,this._container=e.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(t,e=!1){void 0===br||e?void 0!==window.navigator.permissions?window.navigator.permissions.query({name:"geolocation"}).then((e=>{br="denied"!==e.state,t(br)})).catch((()=>{br=!!window.navigator.geolocation,t(br)})):(br=!!window.navigator.geolocation,t(br)):t(br)}(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(),e.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,zr=0,Cr=!1}_isOutOfMapMaxBounds(t){const e=this._map.getMaxBounds(),i=t.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.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),r=Math.ceil(this._accuracy/(n/this._map._container.clientHeight)*2);this._circleElement.style.width=`${r}px`,this._circleElement.style.height=`${r}px`}trigger(){if(!this._setup)return t.warnOnce("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.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":zr--,Cr=!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.Event("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.Event("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"),zr++,zr>1?(t={maximumAge:6e5,timeout:0},Cr=!0):(t=this.options.positionOptions,Cr=!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)}},Rr.AttributionControl=ar,Rr.LogoControl=lr,Rr.ScaleControl=class{constructor(e){this._onMove=()=>{Ir(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,Ir(this._map,this._container,this.options)},this.options=t.extend({},Mr,e)}getDefaultPosition(){return"bottom-left"}onAdd(t){return this._map=t,this._container=e.create("div","maplibregl-ctrl maplibregl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){e.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},Rr.FullscreenControl=class extends t.Evented{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.warnOnce("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=e.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){e.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const t=this._fullscreenButton=e.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);e.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.Event("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new t.Event("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()}},Rr.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=e.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=e.create("button","maplibregl-ctrl-terrain",this._container),e.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(){e.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},Rr.Popup=class extends t.Evented{constructor(i){super(),this.remove=()=>(this._content&&e.remove(this._content),this._container&&(e.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.Event("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=e.create("div","maplibregl-popup",this._map.getContainer()),this._tip=e.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=wr(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!t)return;const i=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);let n=this.options.anchor;const r=Dr(this.options.offset);if(!n){const t=this._container.offsetWidth,e=this._container.offsetHeight;let o;o=i.y+r.bottom.y<e?["top"]:i.y>this._map.transform.height-e?["bottom"]:[],i.x<t/2?o.push("left"):i.x>this._map.transform.width-t/2&&o.push("right"),n=0===o.length?"bottom":o.join("-")}const o=i.add(r[n]).round();e.setTransform(this._container,`${Tr[n]} translate(${o.x}px,${o.y}px)`),Er(this._container,n,"popup")},this._onClose=()=>{this.remove()},this.options=t.extend(Object.create(kr),i)}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.Event("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.LngLat.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 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=e.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=e.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const t=this._container.querySelector(Lr);t&&t.focus()}},Rr.Marker=Sr,Rr.Style=ne,Rr.LngLat=t.LngLat,Rr.LngLatBounds=k,Rr.Point=t.Point,Rr.MercatorCoordinate=t.MercatorCoordinate,Rr.Evented=t.Evented,Rr.AJAXError=t.AJAXError,Rr.config=t.config,Rr.CanvasSource=N,Rr.GeoJSONSource=F,Rr.ImageSource=U,Rr.RasterDEMTileSource=R,Rr.RasterTileSource=B,Rr.VectorTileSource=D,Rr.VideoSource=V,Rr.setRTLTextPlugin=t.setRTLTextPlugin,Rr.getRTLTextPluginStatus=t.getRTLTextPluginStatus,Rr.prewarm=function(){nt().acquire(Q)},Rr.clearPrewarmedResources=function(){const t=it;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(Q),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()"))},Br.extend(Rr,{isSafari:t.isSafari,getPerformanceMetrics:t.PerformanceUtils.getPerformanceMetrics}),Rr})),i}()}},e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var o=e[n]={id:n,exports:{}};return t[n].call(o.exports,o,o.exports,i),o.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;i.g.importScripts&&(t=i.g.location+"");var e=i.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var n=e.getElementsByTagName("script");n.length&&(t=n[n.length-1].src)}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=t})(),i.nc=void 0;var n=i(594);MaplinkMap=n})();